clean up theme init

This commit is contained in:
julian 2022-11-28 16:11:02 -06:00
parent 18da658a65
commit c9a91e10ac

View file

@ -318,17 +318,17 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
final colorScheme = DB.instance final colorScheme = DB.instance
.get<dynamic>(boxName: DB.boxNameTheme, key: "colorScheme") as String?; .get<dynamic>(boxName: DB.boxNameTheme, key: "colorScheme") as String?;
ThemeType themeType; StackColorTheme colorTheme;
switch (colorScheme) { switch (colorScheme) {
case "dark": case "dark":
themeType = ThemeType.dark; colorTheme = DarkColors();
break; break;
case "oceanBreeze": case "oceanBreeze":
themeType = ThemeType.oceanBreeze; colorTheme = OceanBreezeColors();
break; break;
case "light": case "light":
default: default:
themeType = ThemeType.light; colorTheme = LightColors();
} }
loadingCompleter = Completer(); loadingCompleter = Completer();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
@ -339,11 +339,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
ref.read(colorThemeProvider.state).state = ref.read(colorThemeProvider.state).state =
StackColors.fromStackColorTheme(themeType == ThemeType.dark StackColors.fromStackColorTheme(colorTheme);
? DarkColors()
: (themeType == ThemeType.light
? LightColors()
: OceanBreezeColors()));
if (Platform.isAndroid) { if (Platform.isAndroid) {
// fetch open file if it exists // fetch open file if it exists