Fix: black screen on startup

When user preferences did not exist, there was a chance to get a black screen on startup.
This commit is contained in:
Yannick Mauray 2021-12-16 21:46:18 +01:00
parent b95d928135
commit 75cfc5c13b
No known key found for this signature in database
GPG Key ID: 67C4AAC5E99CB909
1 changed files with 4 additions and 2 deletions

View File

@ -32,8 +32,10 @@ class _AppState extends State<App> with PreferencesMixin {
appSettings.setActiveLocaleSilently( appSettings.setActiveLocaleSilently(
snapshot.data?.getString(prefCurrentLocale) ?? snapshot.data?.getString(prefCurrentLocale) ??
Platform.localeName); Platform.localeName);
appSettings.useDarkModeSilently = var pref = snapshot.data!.getBool(prefThemeMode);
snapshot.data!.getBool(prefThemeMode) as bool; if (pref != null) {
appSettings.useDarkModeSilently = pref;
}
return Consumer<AppSettings>( return Consumer<AppSettings>(
builder: (context, appSettings, _) => MaterialApp( builder: (context, appSettings, _) => MaterialApp(
theme: ThemeData(primarySwatch: Colors.pink), theme: ThemeData(primarySwatch: Colors.pink),