Skip to content

Commit 373a522

Browse files
added a drawer menu on Hompage
1 parent 24cfcda commit 373a522

File tree

1 file changed

+92
-44
lines changed

1 file changed

+92
-44
lines changed

lib/views/home/home.dart

Lines changed: 92 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:taskwarrior/widgets/addTask.dart';
99
import 'package:taskwarrior/widgets/buildTasks.dart';
1010
import 'package:taskwarrior/widgets/pallete.dart';
1111
import 'package:taskwarrior/widgets/tag_filter.dart';
12-
import 'package:taskwarrior/widgets/taskw.dart';
1312

1413
class Filters {
1514
const Filters({
@@ -36,12 +35,12 @@ class HomePage extends StatefulWidget {
3635
}
3736

3837
class _HomePageState extends State<HomePage> {
39-
static bool _darkmode = SchedulerBinding.instance.window.platformBrightness == Brightness.dark;
38+
static bool _darkmode =
39+
SchedulerBinding.instance.window.platformBrightness == Brightness.dark;
4040
@override
4141
Widget build(BuildContext context) {
4242
var storageWidget = StorageWidget.of(context);
4343
var taskData = storageWidget.tasks;
44-
4544

4645
var pendingFilter = storageWidget.pendingFilter;
4746
var pendingTags = storageWidget.pendingTags;
@@ -79,58 +78,107 @@ class _HomePageState extends State<HomePage> {
7978
return Scaffold(
8079
appBar: AppBar(
8180
backgroundColor: Palette.kToDark.shade200,
82-
leading: Builder(
83-
builder: (context) => IconButton(
84-
icon: Icon(Icons.person_rounded, color: Colors.white),
85-
onPressed: () {
86-
Navigator.pushNamed(context, PageRoutes.profile);
87-
},
88-
),
89-
),
9081
title: Text('Home Page', style: TextStyle(color: Colors.white)),
9182
actions: [
92-
GestureDetector(
93-
child: _darkmode?const Icon(
94-
Icons.light_mode,
95-
color: Color.fromARGB(255, 216, 196, 15),
96-
size: 25,
97-
): const Icon(
98-
Icons.dark_mode,
99-
color: Colors.white,
100-
size: 25,
101-
),
102-
onTap: (){
103-
if(_darkmode){
104-
_darkmode = false;
105-
}
106-
else{
107-
_darkmode = true;
108-
}
109-
setState(() {});
110-
},),
111-
112-
IconButton(
113-
icon: (storageWidget.searchVisible)
114-
? const Icon(Icons.cancel, color: Colors.white)
115-
: const Icon(Icons.search, color: Colors.white),
116-
onPressed: storageWidget.toggleSearch,
117-
),
118-
Builder(
119-
builder: (context) => IconButton(
120-
icon: const Icon(Icons.refresh, color: Colors.white),
121-
onPressed: () => storageWidget.synchronize(context),
122-
),
123-
),
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+
//),
89+
// Builder(
90+
// builder: (context) => IconButton(
91+
// icon: const Icon(Icons.refresh, color: Colors.white),
92+
// onPressed: () => storageWidget.synchronize(context),
93+
// ),
94+
// ),
12495
Builder(
12596
builder: (context) => IconButton(
12697
icon: const Icon(Icons.filter_list, color: Colors.white),
12798
onPressed: () => Scaffold.of(context).openEndDrawer(),
12899
),
129100
),
130101
],
102+
leading: Builder(
103+
builder: (context) => IconButton(
104+
icon: const Icon(Icons.menu, color: Colors.white),
105+
onPressed: () => Scaffold.of(context).openDrawer(),
106+
),
107+
),
131108
),
109+
drawer: Drawer(
110+
child: ListView(
111+
padding: EdgeInsets.zero,
112+
children: [
113+
ListTile(
114+
tileColor: Colors.black,
115+
textColor: Colors.white,
116+
contentPadding: EdgeInsets.only(top: 20, left: 10),
117+
title: const Text(
118+
'Menu',
119+
style: TextStyle(
120+
fontSize: 25,
121+
fontWeight: FontWeight.bold,
122+
),
123+
),
124+
onTap: () => Navigator.pop(context),
125+
),
126+
ListTile(
127+
leading: Icon(Icons.person_rounded, color: Colors.black),
128+
title: const Text('Profile'),
129+
onTap: () {
130+
// Update the state of the app
131+
// ...
132+
Navigator.pushNamed(context, PageRoutes.profile);
133+
// Then close the drawer
134+
// Navigator.pop(context);
135+
},
136+
),
137+
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),
149+
onTap: () {
150+
storageWidget.synchronize(context);
151+
Navigator.pop(context);
152+
},
153+
title: Text("Refresh"),
154+
),
155+
ListTile(
156+
leading: _darkmode
157+
? const Icon(
158+
Icons.light_mode,
159+
color: Color.fromARGB(255, 216, 196, 15),
160+
size: 25,
161+
)
162+
: const Icon(
163+
Icons.dark_mode,
164+
color: Colors.black,
165+
size: 25,
166+
),
167+
title: Text("Theme"),
168+
onTap: () {
169+
if (_darkmode) {
170+
_darkmode = false;
171+
} else {
172+
_darkmode = true;
173+
}
174+
setState(() {});
175+
Navigator.pop(context);
176+
},
177+
)
178+
],
179+
)),
132180
body: Container(
133-
color: _darkmode?Palette.kToDark.shade200:Colors.white,
181+
color: _darkmode ? Palette.kToDark.shade200 : Colors.white,
134182
child: Column(
135183
children: <Widget>[
136184
if (storageWidget.searchVisible)

0 commit comments

Comments
 (0)