@@ -5,6 +5,7 @@ import 'package:taskwarrior/model/storage/storage_widget.dart';
55import 'package:taskwarrior/routes/pageroute.dart' ;
66import 'package:taskwarrior/views/about/about.dart' ;
77import 'package:taskwarrior/views/reports/reports_home.dart' ;
8+ import 'package:taskwarrior/config/theme_switcher_clipper.dart' ;
89
910class NavDrawer extends StatefulWidget {
1011 final InheritedStorage storageWidget;
@@ -28,29 +29,56 @@ class _NavDrawerState extends State<NavDrawer> {
2829 backgroundColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
2930 child: ListView (
3031 padding: EdgeInsets .zero,
31- children: [
32- ListTile (
33- tileColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
34- textColor: AppSettings .isDarkMode ? Colors .white : Colors .black,
35- contentPadding: const EdgeInsets .only (top: 40 , left: 10 ),
36- title: const Text (
37- 'Menu' ,
38- style: TextStyle (
39- fontSize: 25 ,
40- fontWeight: FontWeight .bold,
41- ),
42- ),
43- onTap: () => Navigator .pop (context),
32+ children: [
33+ ListTile (
34+ tileColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
35+ textColor: AppSettings .isDarkMode ? Colors .white : Colors .black,
36+ contentPadding: const EdgeInsets .only (top: 40 , left: 10 ),
37+ title: Row (
38+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
39+ children: [
40+ Text (
41+ 'Menu' ,
42+ style: TextStyle (
43+ fontSize: 25 ,
44+ fontWeight: FontWeight .bold,
45+ ),
46+ ),
47+ Padding (
48+ padding: EdgeInsets .only (right: 10 ), // Adjust the right padding as needed
49+ child: ThemeSwitcherClipper (
50+ isDarkMode: AppSettings .isDarkMode,
51+ onTap: (bool newMode) async {
52+ AppSettings .isDarkMode = newMode;
53+ setState (() {});
54+ await SelectedTheme .saveMode (AppSettings .isDarkMode);
55+ widget.notifyParent ();
56+ },
57+ child: Icon (
58+ AppSettings .isDarkMode ? Icons .dark_mode : Icons .light_mode,
59+ color: AppSettings .isDarkMode ? Colors .white : Colors .black,
60+ size: 15 ,
4461 ),
45- ListTile (
46- tileColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
47- textColor: AppSettings .isDarkMode ? Colors .white : Colors .black,
48- leading: Icon (
49- Icons .person_rounded,
50- color: AppSettings .isDarkMode ? Colors .white : Colors .black,
51- ),
52- title: const Text ('Profile' ),
53- onTap: () {
62+ ),
63+ ),
64+ ],
65+ ),
66+ onTap: () async {
67+ AppSettings .isDarkMode = ! AppSettings .isDarkMode;
68+ setState (() {});
69+ await SelectedTheme .saveMode (AppSettings .isDarkMode);
70+ widget.notifyParent ();
71+ },
72+ ),
73+ ListTile (
74+ tileColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
75+ textColor: AppSettings .isDarkMode ? Colors .white : Colors .black,
76+ leading: Icon (
77+ Icons .person_rounded,
78+ color: AppSettings .isDarkMode ? Colors .white : Colors .black,
79+ ),
80+ title: const Text ('Profile' ),
81+ onTap: () {
5482 // Update the state of the app
5583 // ...
5684 Navigator .pushNamed (context, PageRoutes .profile);
@@ -84,28 +112,6 @@ class _NavDrawerState extends State<NavDrawer> {
84112 },
85113 title: const Text ("Reports" ),
86114 ),
87- ListTile (
88- tileColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
89- textColor: AppSettings .isDarkMode ? Colors .white : Colors .black,
90- leading: AppSettings .isDarkMode
91- ? const Icon (
92- Icons .light_mode,
93- color: Color .fromARGB (255 , 216 , 196 , 15 ),
94- size: 25 ,
95- )
96- : const Icon (
97- Icons .dark_mode,
98- color: Colors .black,
99- size: 25 ,
100- ),
101- title: const Text ("Switch Theme" ),
102- onTap: () async {
103- AppSettings .isDarkMode = ! AppSettings .isDarkMode;
104- setState (() {});
105- await SelectedTheme .saveMode (AppSettings .isDarkMode);
106- widget.notifyParent ();
107- },
108- ),
109115 ListTile (
110116 tileColor: AppSettings .isDarkMode ? Colors .black : Colors .white,
111117 textColor: AppSettings .isDarkMode ? Colors .white : Colors .black,
0 commit comments