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

@@ -8,6 +8,7 @@ class CustomToast extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final double toastOpacity = GStorage.setting
.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0) as double;
return Container(
@@ -15,17 +16,14 @@ class CustomToast extends StatelessWidget {
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30),
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.primaryContainer
.withOpacity(toastOpacity),
color: theme.colorScheme.primaryContainer.withOpacity(toastOpacity),
borderRadius: BorderRadius.circular(20),
),
child: Text(
msg,
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.onPrimaryContainer,
color: theme.colorScheme.onPrimaryContainer,
),
),
);
@@ -40,26 +38,25 @@ class LoadingWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final onSurfaceVariant = theme.colorScheme.onSurfaceVariant;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
color: theme.dialogBackgroundColor,
borderRadius: BorderRadius.circular(15),
),
child: Column(mainAxisSize: MainAxisSize.min, children: [
//loading animation
CircularProgressIndicator(
strokeWidth: 3,
valueColor: AlwaysStoppedAnimation(
Theme.of(context).colorScheme.onSurfaceVariant),
valueColor: AlwaysStoppedAnimation(onSurfaceVariant),
),
//msg
Container(
margin: const EdgeInsets.only(top: 20),
child: Text(msg,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)),
child: Text(msg, style: TextStyle(color: onSurfaceVariant)),
),
]),
);