fix: 跟随系统主题模式失效
This commit is contained in:
@ -130,27 +130,10 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SnackBarThemeData snackBarThemeData = SnackBarThemeData(
|
|
||||||
actionTextColor: darkColorScheme.primary,
|
|
||||||
backgroundColor: darkColorScheme.secondaryContainer,
|
|
||||||
closeIconColor: darkColorScheme.secondary,
|
|
||||||
contentTextStyle: TextStyle(color: darkColorScheme.secondary),
|
|
||||||
elevation: 20,
|
|
||||||
);
|
|
||||||
|
|
||||||
ThemeData themeData = ThemeData(
|
ThemeData themeData = ThemeData(
|
||||||
// fontFamily: 'HarmonyOS',
|
|
||||||
colorScheme: currentThemeValue == ThemeType.dark
|
colorScheme: currentThemeValue == ThemeType.dark
|
||||||
? darkColorScheme
|
? darkColorScheme
|
||||||
: lightColorScheme,
|
: lightColorScheme,
|
||||||
snackBarTheme: snackBarThemeData,
|
|
||||||
pageTransitionsTheme: const PageTransitionsTheme(
|
|
||||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
|
||||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
|
||||||
allowEnterRouteSnapshotting: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// 小白条、导航栏沉浸
|
// 小白条、导航栏沉浸
|
||||||
@ -171,9 +154,38 @@ class MyApp extends StatelessWidget {
|
|||||||
// 图片缓存
|
// 图片缓存
|
||||||
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
||||||
return GetMaterialApp(
|
return GetMaterialApp(
|
||||||
title: 'PiLiPaLa',
|
title: 'PiliPala',
|
||||||
theme: themeData,
|
theme: ThemeData(
|
||||||
darkTheme: themeData,
|
colorScheme: currentThemeValue == ThemeType.dark
|
||||||
|
? darkColorScheme
|
||||||
|
: lightColorScheme,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: lightColorScheme.primary,
|
||||||
|
backgroundColor: lightColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: lightColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: lightColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
|
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||||
|
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||||
|
allowEnterRouteSnapshotting: false,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
darkTheme: ThemeData(
|
||||||
|
colorScheme: currentThemeValue == ThemeType.light
|
||||||
|
? lightColorScheme
|
||||||
|
: darkColorScheme,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: darkColorScheme.primary,
|
||||||
|
backgroundColor: darkColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: darkColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: darkColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
Reference in New Issue
Block a user