Simplify theme management, integrate ToggleButtons for theme selection, and enhance settings view structure.
This commit is contained in:
@@ -25,10 +25,10 @@ class ThemeController extends ChangeNotifier {
|
||||
}
|
||||
|
||||
/// Sets theme and persists it in Preferences.
|
||||
Future<void> setTheme(ThemeMode mode) async {
|
||||
void setTheme(ThemeMode mode) {
|
||||
_themeMode = mode;
|
||||
notifyListeners();
|
||||
await _prefs.setString('theme', _toString(mode));
|
||||
_prefs.setString('theme', mode.name);
|
||||
}
|
||||
|
||||
ThemeMode _fromString(String value) {
|
||||
@@ -43,16 +43,5 @@ class ThemeController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
String _toString(ThemeMode mode) {
|
||||
switch (mode) {
|
||||
case ThemeMode.light:
|
||||
return 'light';
|
||||
case ThemeMode.dark:
|
||||
return 'dark';
|
||||
case ThemeMode.system:
|
||||
return 'system';
|
||||
}
|
||||
}
|
||||
|
||||
ThemeMode get themeMode => _themeMode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user