Made Settings persistent with autosave
This commit is contained in:
1 parent
e26a1e9598
commit
3f05f68ac1
9 files changed
+253
-156
No files matched your search
@@ -1,36 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppTheme extends ChangeNotifier {
|
||||
ThemeMode _mode = ThemeMode.system;
|
||||
ThemeMode get getMode => _mode;
|
||||
|
||||
void setTheme(ThemeMode newMode) {
|
||||
_mode = newMode;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
static ThemeModeDisplay getDisplayOptions(ThemeMode theme) {
|
||||
switch(theme) {
|
||||
case ThemeMode.system:
|
||||
return ThemeModeDisplay(icon: Icons.auto_fix_high_outlined, displayName: "Systemvorgabe");
|
||||
|
||||
case ThemeMode.light:
|
||||
return ThemeModeDisplay(icon: Icons.dark_mode_outlined, displayName: "Hell");
|
||||
|
||||
case ThemeMode.dark:
|
||||
return ThemeModeDisplay(icon: Icons.dark_mode, displayName: "Dunkel");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static bool isDarkMode(BuildContext context) {
|
||||
return Theme.of(context).brightness == Brightness.dark;
|
||||
}
|
||||
}
|
||||
|
||||
class ThemeModeDisplay {
|
||||
final IconData icon;
|
||||
final String displayName;
|
||||
|
||||
ThemeModeDisplay({required this.icon, required this.displayName});
|
||||
}
|
||||
Reference in new issue
Block a user