fix color

This commit is contained in:
2024-12-21 17:50:05 +08:00
parent aa66111f2c
commit 6a79f68909
2 changed files with 20 additions and 9 deletions

View File

@@ -290,6 +290,7 @@ class ContentDialog extends StatelessWidget {
: const EdgeInsets.symmetric(horizontal: 16), : const EdgeInsets.symmetric(horizontal: 16),
elevation: 2, elevation: 2,
shadowColor: context.colorScheme.shadow, shadowColor: context.colorScheme.shadow,
backgroundColor: context.colorScheme.surface,
child: AnimatedSize( child: AnimatedSize(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
alignment: Alignment.topCenter, alignment: Alignment.topCenter,

View File

@@ -156,30 +156,40 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
home = const MainPage(); home = const MainPage();
} }
return DynamicColorBuilder(builder: (light, dark) { return DynamicColorBuilder(builder: (light, dark) {
if (appdata.settings['color'] != 'system' || light == null || dark == null) { if (appdata.settings['color'] != 'system' ||
light == null ||
dark == null) {
var color = translateColorSetting(); var color = translateColorSetting();
light = ColorScheme.fromSeed( light = ColorScheme.fromSeed(
seedColor: color, seedColor: color,
surface: Colors.white,
); );
dark = ColorScheme.fromSeed( dark = ColorScheme.fromSeed(
seedColor: color, seedColor: color,
brightness: Brightness.dark, brightness: Brightness.dark,
surface: Colors.black,
);
} else {
light = ColorScheme.fromSeed(
seedColor: light.primary,
surface: Colors.white,
);
dark = ColorScheme.fromSeed(
seedColor: dark.primary,
brightness: Brightness.dark,
surface: Colors.black,
); );
} }
return MaterialApp( return MaterialApp(
home: home, home: home,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: ThemeData( theme: ThemeData(
colorScheme: light.copyWith( colorScheme: light,
surface: Colors.white,
),
fontFamily: App.isWindows ? "Microsoft YaHei" : null, fontFamily: App.isWindows ? "Microsoft YaHei" : null,
), ),
navigatorKey: App.rootNavigatorKey, navigatorKey: App.rootNavigatorKey,
darkTheme: ThemeData( darkTheme: ThemeData(
colorScheme: dark.copyWith( colorScheme: dark,
surface: Colors.black,
),
fontFamily: App.isWindows ? "Microsoft YaHei" : null, fontFamily: App.isWindows ? "Microsoft YaHei" : null,
), ),
themeMode: switch (appdata.settings['theme_mode']) { themeMode: switch (appdata.settings['theme_mode']) {
@@ -211,8 +221,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
], ],
builder: (context, widget) { builder: (context, widget) {
ErrorWidget.builder = (details) { ErrorWidget.builder = (details) {
Log.error( Log.error("Unhandled Exception",
"Unhandled Exception", "${details.exception}\n${details.stack}"); "${details.exception}\n${details.stack}");
return Material( return Material(
child: Center( child: Center(
child: Text(details.exception.toString()), child: Text(details.exception.toString()),