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
.get<dynamic>(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<MaterialAppWithTheme>
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