settings: get theme settings from adaptive_theme

master
EmaMaker 2021-09-21 12:12:28 +02:00
parent efc9603f8f
commit c8b17b6784
1 changed files with 12 additions and 2 deletions

View File

@ -25,9 +25,19 @@ class _SettingsState extends State<Settings> {
String _sortBy = "";
void getTheme() async {
final prefs = await SharedPreferences.getInstance();
final savedThemeMode = await AdaptiveTheme.getThemeMode();
setState(() {
_theme = prefs.getString("theme") ?? "Follow System";
switch (savedThemeMode) {
case AdaptiveThemeMode.dark:
_theme = "Dark";
break;
case AdaptiveThemeMode.light:
_theme = "Light";
break;
default:
_theme = "Follow System";
break;
}
});
}