Theme Changer (Primitive?)
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:witl/theme_manager.dart';
|
||||
import 'package:witl/main.dart';
|
||||
|
||||
class Settings extends StatelessWidget {
|
||||
class Settings extends StatefulWidget {
|
||||
const Settings({super.key});
|
||||
|
||||
@override
|
||||
State<Settings> createState() => _Settings();
|
||||
}
|
||||
|
||||
class _Settings extends State<Settings> {
|
||||
late String selectedTheme = 'Dark';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -12,8 +19,26 @@ class Settings extends StatelessWidget {
|
||||
),
|
||||
|
||||
body: ListView(
|
||||
children: [
|
||||
|
||||
children:[
|
||||
ListTile(
|
||||
title: const Text("App Theme"),
|
||||
subtitle: const Text("Sets the theme of the app between: Dark, Light, System Default."),
|
||||
trailing: DropdownButton<String> (
|
||||
value: selectedTheme,
|
||||
items: <String>["Light", "Dark", "System Default"].map((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? updatedTheme) {
|
||||
setState(() {
|
||||
selectedTheme = updatedTheme ?? selectedTheme;
|
||||
MyApp.of(context).changeTheme(selectedTheme);
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user