Skip to content

Commit 8bfe8f7

Browse files
committed
Add dark mode in drawer and minor fixes
1 parent 842261a commit 8bfe8f7

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

lib/views/home/home.dart

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ class _HomePageState extends State<HomePage> {
8080
backgroundColor: Palette.kToDark.shade200,
8181
title: Text('Home Page', style: TextStyle(color: Colors.white)),
8282
actions: [
83-
//IconButton(
84-
// icon: (storageWidget.searchVisible)
85-
// ? const Icon(Icons.cancel, color: Colors.white)
86-
// : const Icon(Icons.search, color: Colors.white),
87-
// onPressed: storageWidget.toggleSearch,
88-
//),
83+
IconButton(
84+
icon: (storageWidget.searchVisible)
85+
? const Icon(Icons.cancel, color: Colors.white)
86+
: const Icon(Icons.search, color: Colors.white),
87+
onPressed: storageWidget.toggleSearch,
88+
),
8989
// Builder(
9090
// builder: (context) => IconButton(
9191
// icon: const Icon(Icons.refresh, color: Colors.white),
@@ -107,13 +107,14 @@ class _HomePageState extends State<HomePage> {
107107
),
108108
),
109109
drawer: Drawer(
110+
backgroundColor: _darkmode?Colors.black:Colors.white,
110111
child: ListView(
111112
padding: EdgeInsets.zero,
112113
children: [
113114
ListTile(
114-
tileColor: Colors.black,
115-
textColor: Colors.white,
116-
contentPadding: EdgeInsets.only(top: 20, left: 10),
115+
tileColor: _darkmode?Colors.black:Colors.white,
116+
textColor: _darkmode?Colors.white:Colors.black,
117+
contentPadding: EdgeInsets.only(top: 40, left: 10),
117118
title: const Text(
118119
'Menu',
119120
style: TextStyle(
@@ -124,7 +125,9 @@ class _HomePageState extends State<HomePage> {
124125
onTap: () => Navigator.pop(context),
125126
),
126127
ListTile(
127-
leading: Icon(Icons.person_rounded, color: Colors.black),
128+
tileColor: _darkmode?Colors.black:Colors.white,
129+
textColor: _darkmode?Colors.white:Colors.black,
130+
leading: Icon(Icons.person_rounded, color: _darkmode?Colors.white:Colors.black,),
128131
title: const Text('Profile'),
129132
onTap: () {
130133
// Update the state of the app
@@ -135,24 +138,18 @@ class _HomePageState extends State<HomePage> {
135138
},
136139
),
137140
ListTile(
138-
title: const Text('Search'),
139-
leading: (storageWidget.searchVisible)
140-
? const Icon(Icons.cancel, color: Colors.black)
141-
: const Icon(Icons.search, color: Colors.black),
142-
onTap: () {
143-
Navigator.pop(context);
144-
storageWidget.toggleSearch();
145-
},
146-
),
147-
ListTile(
148-
leading: const Icon(Icons.refresh, color: Colors.black),
141+
tileColor: _darkmode?Colors.black:Colors.white,
142+
textColor: _darkmode?Colors.white:Colors.black,
143+
leading: Icon(Icons.refresh, color: _darkmode?Colors.white:Colors.black,),
149144
onTap: () {
150145
storageWidget.synchronize(context);
151146
Navigator.pop(context);
152147
},
153148
title: Text("Refresh"),
154149
),
155150
ListTile(
151+
tileColor: _darkmode?Colors.black:Colors.white,
152+
textColor: _darkmode?Colors.white:Colors.black,
156153
leading: _darkmode
157154
? const Icon(
158155
Icons.light_mode,
@@ -164,7 +161,7 @@ class _HomePageState extends State<HomePage> {
164161
color: Colors.black,
165162
size: 25,
166163
),
167-
title: Text("Theme"),
164+
title: Text("Switch Theme"),
168165
onTap: () {
169166
if (_darkmode) {
170167
_darkmode = false;

lib/widgets/buildTasks.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TasksBuilder extends StatelessWidget {
2727
Card(
2828
color: darkmode?Palette.kToDark:Colors.white,
2929
child: InkWell(
30-
splashColor: Colors.black,
30+
splashColor: darkmode?Colors.black:Colors.grey.shade200,
3131
onTap: () => Navigator.push(
3232
context,
3333
MaterialPageRoute(

0 commit comments

Comments
 (0)