Simplify theme management, integrate ToggleButtons for theme selection, and enhance settings view structure.

This commit is contained in:
2025-09-26 20:11:10 +02:00
parent 4a4f10d533
commit ece3c333eb
6 changed files with 204 additions and 141 deletions

View File

@@ -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;
}