Skip to content

Commit 06a71e7

Browse files
feat: delete all tasks from DB
1 parent d6a0a26 commit 06a71e7

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

lib/app/modules/home/views/nav_drawer.dart

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,66 @@ class NavDrawer extends StatelessWidget {
101101
},
102102
),
103103
),
104+
Visibility(
105+
visible: homeController.taskchampion.value,
106+
child: NavDrawerMenuItem(
107+
icon: Icons.delete,
108+
text: 'Delete tasks',
109+
onTap: () {
110+
showDialog<void>(
111+
context: context,
112+
builder: (BuildContext context) {
113+
return Utils.showAlertDialog(
114+
title: Text(
115+
'Delete All Tasks?',
116+
style: TextStyle(
117+
color: AppSettings.isDarkMode
118+
? TaskWarriorColors.white
119+
: TaskWarriorColors.black,
120+
),
121+
),
122+
content: Text(
123+
'The action is irreversible and will delete all the tasks that are stored locally.',
124+
style: TextStyle(
125+
color: AppSettings.isDarkMode
126+
? TaskWarriorColors.white
127+
: TaskWarriorColors.black,
128+
),
129+
),
130+
actions: <Widget>[
131+
TextButton(
132+
child: Text(
133+
'Cancel',
134+
style: TextStyle(
135+
color: AppSettings.isDarkMode
136+
? TaskWarriorColors.white
137+
: TaskWarriorColors.black,
138+
),
139+
),
140+
onPressed: () {
141+
Navigator.of(context).pop(); // Close the dialog
142+
},
143+
),
144+
TextButton(
145+
child: Text(
146+
'Confirm',
147+
style: TextStyle(
148+
color: AppSettings.isDarkMode
149+
? TaskWarriorColors.white
150+
: TaskWarriorColors.black,
151+
),
152+
),
153+
onPressed: () {
154+
homeController.deleteAllTasksInDB();
155+
Navigator.of(context).pop(); // Close the dialog
156+
},
157+
),
158+
],
159+
);
160+
},
161+
);
162+
}),
163+
),
104164
Visibility(
105165
visible: !homeController.taskchampion.value,
106166
child: Obx(

0 commit comments

Comments
 (0)