update theme & settingsview to enums

This commit is contained in:
2025-07-30 20:33:34 +02:00
parent 20537c88c1
commit fc062b2135
2 changed files with 70 additions and 48 deletions

View File

@@ -8,8 +8,17 @@ class ThemeView extends StatefulWidget {
State<ThemeView> createState() => _ThemeViewState();
}
enum themeOptions {
systemDefault('Systemstandard'),
dark('Dunkel'),
light('Hell');
final String label;
const themeOptions(this.label);
}
class _ThemeViewState extends State<ThemeView> {
String _selectedTheme = "Systemstandard";
themeOptions? _selectedTheme = themeOptions.systemDefault;
@override
Widget build(BuildContext context) {
@@ -19,47 +28,49 @@ class _ThemeViewState extends State<ThemeView> {
body: Column(
children: [
ListTile(
title: Text("Systemstandard"),
title: Text(themeOptions.systemDefault.label),
onTap: () {
setState(() {
_selectedTheme = "Systemstandard";
_selectedTheme = themeOptions.systemDefault;
});
},
leading: Radio(
value: "Systemstandard",
value: themeOptions.systemDefault,
groupValue: _selectedTheme,
onChanged: (value) {
setState(() {
_selectedTheme = themeOptions.systemDefault;
});
},
),
),
ListTile(
title: Text(themeOptions.dark.label),
onTap: () {
setState(() {
_selectedTheme = themeOptions.dark;
});
},
leading: Radio(
value: themeOptions.dark,
groupValue: _selectedTheme,
onChanged: (value) {setState(() {
_selectedTheme = value.toString();
_selectedTheme = themeOptions.dark;
});},
),
),
ListTile(
title: Text("Dunkel"),
title: Text(themeOptions.light.label),
onTap: () {
setState(() {
_selectedTheme = "Dunkel";
_selectedTheme = themeOptions.light;
});
},
leading: Radio(
value: "Dunkel",
groupValue: _selectedTheme,
onChanged: (value) {setState(() {
_selectedTheme = value.toString();
});},
),
),
ListTile(
title: Text("Hell"),
onTap: () {
setState(() {
_selectedTheme = "Hell";
});
},
leading: Radio(
value: "Hell",
value: themeOptions.light,
groupValue: _selectedTheme,
onChanged: (value) {setState(() {
_selectedTheme = value.toString();
_selectedTheme = themeOptions.light;
});},
),
)