Add browser theme detection

This commit is contained in:
shilangyu 2021-04-28 14:39:31 +02:00
parent efb773676c
commit 79d77f60df
1 changed files with 9 additions and 3 deletions

View File

@ -95,9 +95,15 @@ class ConfigStore extends ChangeNotifier {
};
_showAvatars = localUserSettings.showAvatars;
_theme = darkModeLemmyUiThemes.contains(localUserSettings.theme)
? ThemeMode.dark
: ThemeMode.light;
_theme = () {
if (localUserSettings.theme == 'browser') return ThemeMode.system;
if (darkModeLemmyUiThemes.contains(localUserSettings.theme)) {
return ThemeMode.dark;
}
return ThemeMode.light;
}();
_locale = L10n.supportedLocales.contains(Locale(localUserSettings.lang))
? Locale(localUserSettings.lang)
: _locale;