From c9a91e10ac3d260a14714394c154bca7f7df591e Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 28 Nov 2022 16:11:02 -0600 Subject: [PATCH] clean up theme init --- lib/main.dart | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index a49bcab82..8136965db 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -318,17 +318,17 @@ class _MaterialAppWithThemeState extends ConsumerState final colorScheme = DB.instance .get(boxName: DB.boxNameTheme, key: "colorScheme") as String?; - ThemeType themeType; + StackColorTheme colorTheme; switch (colorScheme) { case "dark": - themeType = ThemeType.dark; + colorTheme = DarkColors(); break; case "oceanBreeze": - themeType = ThemeType.oceanBreeze; + colorTheme = OceanBreezeColors(); break; case "light": default: - themeType = ThemeType.light; + colorTheme = LightColors(); } loadingCompleter = Completer(); WidgetsBinding.instance.addObserver(this); @@ -339,11 +339,7 @@ class _MaterialAppWithThemeState extends ConsumerState WidgetsBinding.instance.addPostFrameCallback((_) async { ref.read(colorThemeProvider.state).state = - StackColors.fromStackColorTheme(themeType == ThemeType.dark - ? DarkColors() - : (themeType == ThemeType.light - ? LightColors() - : OceanBreezeColors())); + StackColors.fromStackColorTheme(colorTheme); if (Platform.isAndroid) { // fetch open file if it exists