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

@@ -42,14 +42,13 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
final ColorSelectController ctr = Get.put(ColorSelectController());
FlexSchemeVariant _dynamicSchemeVariant =
FlexSchemeVariant.values[GStorage.schemeVariant];
TextStyle get titleStyle => Theme.of(context).textTheme.titleMedium!;
TextStyle get subTitleStyle => Theme.of(context)
.textTheme
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
TextStyle titleStyle = theme.textTheme.titleMedium!;
TextStyle subTitleStyle =
theme.textTheme.labelMedium!.copyWith(color: theme.colorScheme.outline);
return Scaffold(
appBar: AppBar(title: const Text('选择应用主题')),
body: SafeArea(
@@ -119,11 +118,8 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
height: 1,
fontSize: 13,
color: ctr.type.value == 0
? Theme.of(context)
.colorScheme
.outline
.withOpacity(0.8)
: Theme.of(context).colorScheme.secondary,
? theme.colorScheme.outline.withOpacity(0.8)
: theme.colorScheme.secondary,
),
strutStyle: StrutStyle(leading: 0, height: 1),
),
@@ -131,11 +127,8 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
size: 20,
Icons.keyboard_arrow_right,
color: ctr.type.value == 0
? Theme.of(context)
.colorScheme
.outline
.withOpacity(0.8)
: Theme.of(context).colorScheme.secondary,
? theme.colorScheme.outline.withOpacity(0.8)
: theme.colorScheme.secondary,
)
],
),
@@ -236,9 +229,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
style: TextStyle(
fontSize: 12,
color: ctr.currentColor.value != index
? Theme.of(context)
.colorScheme
.outline
? theme.colorScheme.outline
: null,
),
),

View File

@@ -35,6 +35,7 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
actions: [
@@ -65,11 +66,8 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.3))),
color: Theme.of(context).colorScheme.surface,
color: theme.colorScheme.primary.withOpacity(0.3))),
color: theme.colorScheme.surface,
),
child: Row(
children: [

View File

@@ -129,7 +129,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
}
// 设定倍速弹窗
void showBottomSheet(index) {
void showBottomSheet(ThemeData theme, int index) {
showModalBottomSheet(
context: context,
useSafeArea: true,
@@ -150,11 +150,11 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
menuAction(index, item['id']);
},
minLeadingWidth: 0,
iconColor: Theme.of(context).colorScheme.onSurface,
iconColor: theme.colorScheme.onSurface,
leading: item['leading'],
title: Text(
item['title'],
style: Theme.of(context).textTheme.titleSmall,
style: theme.textTheme.titleSmall,
),
),
),
@@ -194,6 +194,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
title: const Text('倍速设置'),
@@ -218,7 +219,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
const EdgeInsets.only(left: 14, right: 14, top: 6, bottom: 0),
child: Text(
'点击下方按钮设置默认(长按)倍速',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
style: TextStyle(color: theme.colorScheme.outline),
),
),
ListTile(
@@ -255,7 +256,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
children: [
Text(
'倍速列表',
style: Theme.of(context).textTheme.titleMedium,
style: theme.textTheme.titleMedium,
),
const SizedBox(width: 12),
TextButton(
@@ -278,7 +279,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
children: List.generate(
speedList.length,
(index) => FilledButton.tonal(
onPressed: () => showBottomSheet(index),
onPressed: () => showBottomSheet(theme, index),
child: Text(speedList[index].toString()),
),
),