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

@@ -30,12 +30,11 @@ class _SearchPgcPanelState extends CommonSearchPanelState<SearchPgcPanel,
tag: widget.searchType.name + widget.tag,
);
late final TextStyle style = TextStyle(fontSize: 13);
@override
Widget buildList(List<SearchMBangumiItemModel> list) {
Widget buildList(ThemeData theme, List<SearchMBangumiItemModel> list) {
return SliverPadding(
padding: const EdgeInsets.only(bottom: 80),
padding:
EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 80),
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: Grid.smallCardWidth * 2,
@@ -46,7 +45,7 @@ class _SearchPgcPanelState extends CommonSearchPanelState<SearchPgcPanel,
if (index == list.length - 1) {
controller.onLoadMore();
}
return SearchPgcItem(style: style, item: list[index]);
return SearchPgcItem(item: list[index]);
},
childCount: list.length,
),

View File

@@ -10,21 +10,20 @@ import 'package:flutter/material.dart';
class SearchPgcItem extends StatelessWidget {
const SearchPgcItem({
super.key,
required this.style,
required this.item,
});
final TextStyle style;
final SearchMBangumiItemModel item;
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle style = TextStyle(fontSize: 13);
return InkWell(
onTap: () {
PageUtils.viewBangumi(seasonId: item.seasonId);
},
onLongPress: () => imageSaveDialog(
context: context,
title: item.title?.map((item) => item['text']).join() ?? '',
cover: item.cover,
),
@@ -60,21 +59,17 @@ class SearchPgcItem extends StatelessWidget {
const SizedBox(height: 4),
Text.rich(
TextSpan(
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface),
style: TextStyle(color: theme.colorScheme.onSurface),
children: [
for (var i in item.title!) ...[
TextSpan(
text: i['text'],
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.titleSmall!
.fontSize!,
fontSize: theme.textTheme.titleSmall!.fontSize!,
fontWeight: FontWeight.bold,
color: i['type'] == 'em'
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurface,
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
),
),
],