Add functional Theme selection, with Provider for state management
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:frontend_splatournament_manager/widgets/theme_selector_widget.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
const SettingsPage({super.key});
|
||||
|
||||
static const List<String> themes = ['System', 'Dark', 'Light'];
|
||||
|
||||
@override
|
||||
State<SettingsPage> createState() => _SettingsPageState();
|
||||
}
|
||||
|
||||
class _SettingsPageState extends State<SettingsPage> {
|
||||
var dropDownValue = SettingsPage.themes[0];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -19,23 +16,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("Settings"),
|
||||
DropdownButton(
|
||||
value: dropDownValue,
|
||||
icon: Icon(Icons.color_lens),
|
||||
items: SettingsPage.themes
|
||||
.map((e) => DropdownMenuItem(value: e, child: Text(e)))
|
||||
.toList(),
|
||||
onChanged: (value){
|
||||
if(value == null) return;
|
||||
print(value);
|
||||
setState(() {
|
||||
dropDownValue = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
children: [ThemeSelectorWidget()],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user