opt: get theme color

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-28 21:32:30 +08:00
parent 451a84e696
commit ca993df0c6
149 changed files with 4415 additions and 4803 deletions

View File

@@ -56,6 +56,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Obx(
() => PopScope(
canPop: _favDetailController.enableMultiSelect.value.not,
@@ -111,13 +112,11 @@ class _FavDetailPageState extends State<FavDetailPage> {
children: [
Text(
_favDetailController.item.value.title ?? '',
style:
Theme.of(context).textTheme.titleMedium,
style: theme.textTheme.titleMedium,
),
Text(
'${_favDetailController.item.value.mediaCount}条视频',
style:
Theme.of(context).textTheme.labelMedium,
style: theme.textTheme.labelMedium,
)
],
),
@@ -152,9 +151,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
child: Text(
'复制',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
color: theme.colorScheme.onSurfaceVariant,
),
),
),
@@ -176,9 +173,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
child: Text(
'移动',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
color: theme.colorScheme.onSurfaceVariant,
),
),
),
@@ -191,8 +186,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
_favDetailController.onDelChecked(context),
child: Text(
'删除',
style: TextStyle(
color: Theme.of(context).colorScheme.error),
style:
TextStyle(color: theme.colorScheme.error),
),
),
const SizedBox(width: 6),
@@ -310,9 +305,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
child: Text(
'删除',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.error,
color: theme.colorScheme.error,
),
),
),
@@ -362,10 +355,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
.item.value.title ??
'',
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.titleMedium!
.fontSize,
fontSize: theme.textTheme
.titleMedium!.fontSize,
fontWeight: FontWeight.bold),
),
if (_favDetailController
@@ -376,13 +367,10 @@ class _FavDetailPageState extends State<FavDetailPage> {
.item.value.intro ??
'',
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.labelSmall!
.fontSize,
color: Theme.of(context)
.colorScheme
.outline),
fontSize: theme.textTheme
.labelSmall!.fontSize,
color:
theme.colorScheme.outline),
),
const SizedBox(height: 4),
Text(
@@ -390,13 +378,9 @@ class _FavDetailPageState extends State<FavDetailPage> {
.item.value.upper?.name ??
'',
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.labelSmall!
.fontSize,
color: Theme.of(context)
.colorScheme
.outline),
fontSize: theme.textTheme
.labelSmall!.fontSize,
color: theme.colorScheme.outline),
),
const Spacer(),
if (_favDetailController
@@ -405,13 +389,10 @@ class _FavDetailPageState extends State<FavDetailPage> {
Text(
'${_favDetailController.item.value.mediaCount}条视频 · ${Utils.isPublicFavText(_favDetailController.item.value.attr ?? 0)}',
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.labelSmall!
.fontSize,
color: Theme.of(context)
.colorScheme
.outline),
fontSize: theme.textTheme
.labelSmall!.fontSize,
color:
theme.colorScheme.outline),
),
],
),
@@ -424,8 +405,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
),
),
),
Obx(() =>
_buildBody(_favDetailController.loadingState.value)),
Obx(() => _buildBody(
theme, _favDetailController.loadingState.value)),
],
),
),
@@ -435,7 +416,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
);
}
Widget _buildBody(LoadingState<List<FavDetailItemData>?> loadingState) {
Widget _buildBody(
ThemeData theme, LoadingState<List<FavDetailItemData>?> loadingState) {
return switch (loadingState) {
Loading() => SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
@@ -463,7 +445,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
child: Text(
_favDetailController.isEnd.not ? '加载中...' : '没有更多了',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
fontSize: 13,
),
),
@@ -552,9 +534,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
backgroundColor:
WidgetStateProperty.resolveWith(
(states) {
return Theme.of(context)
.colorScheme
.surface
return theme.colorScheme.surface
.withOpacity(0.8);
},
),
@@ -562,9 +542,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
onPressed: null,
icon: Icon(
Icons.done_all_outlined,
color: Theme.of(context)
.colorScheme
.primary,
color: theme.colorScheme.primary,
),
),
),

View File

@@ -75,7 +75,6 @@ class FavVideoCardH extends StatelessWidget {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title,
cover: videoItem.pic,
);
@@ -130,6 +129,7 @@ class FavVideoCardH extends StatelessWidget {
}
Widget videoContent(context) {
final theme = Theme.of(context);
return Expanded(
child: Stack(
children: [
@@ -154,7 +154,7 @@ class FavVideoCardH extends StatelessWidget {
style: TextStyle(
height: 1,
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
const SizedBox(height: 3),
@@ -184,7 +184,7 @@ class FavVideoCardH extends StatelessWidget {
context: context,
icon: Icons.clear,
tooltip: '取消收藏',
iconColor: Theme.of(context).colorScheme.outline,
iconColor: theme.colorScheme.outline,
bgColor: Colors.transparent,
onPressed: () {
showDialog(
@@ -198,8 +198,8 @@ class FavVideoCardH extends StatelessWidget {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline),
style:
TextStyle(color: theme.colorScheme.outline),
),
),
TextButton(