Skip to content

Commit d6bb0a2

Browse files
authored
Merge pull request #198 from Pavel401/fix-linting-errors
Fix Linting Errors, Add Exit Button, and Cleanup
2 parents 8ea50a8 + 1ebfc1a commit d6bb0a2

38 files changed

+42
-1226
lines changed

lib/drawer/nav_drawer.dart

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// ignore_for_file: library_private_types_in_public_api
22

33
import 'package:flutter/material.dart';
4+
import 'package:flutter/services.dart';
45
import 'package:sizer/sizer.dart';
56
import 'package:taskwarrior/config/app_settings.dart';
67
import 'package:taskwarrior/model/storage/storage_widget.dart';
@@ -122,6 +123,13 @@ class _NavDrawerState extends State<NavDrawer> {
122123
);
123124
},
124125
),
126+
buildMenuItem(
127+
icon: Icons.exit_to_app,
128+
text: 'Exit',
129+
onTap: () {
130+
_showExitConfirmationDialog(context);
131+
},
132+
),
125133
],
126134
),
127135
),
@@ -136,7 +144,7 @@ class _NavDrawerState extends State<NavDrawer> {
136144
onTap: onTap,
137145
child: Container(
138146
color: AppSettings.isDarkMode ? Colors.black : Colors.white,
139-
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 10),
147+
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 10),
140148
child: Row(
141149
children: [
142150
Icon(
@@ -157,3 +165,31 @@ class _NavDrawerState extends State<NavDrawer> {
157165
);
158166
}
159167
}
168+
169+
Future<void> _showExitConfirmationDialog(BuildContext context) async {
170+
return showDialog<void>(
171+
context: context,
172+
barrierDismissible: false, // Prevents closing the dialog by tapping outside
173+
builder: (BuildContext context) {
174+
return AlertDialog(
175+
title: const Text('Exit App'),
176+
content: const Text('Are you sure you want to exit the app?'),
177+
actions: <Widget>[
178+
TextButton(
179+
child: const Text('Cancel'),
180+
onPressed: () {
181+
Navigator.of(context).pop(); // Close the dialog
182+
},
183+
),
184+
TextButton(
185+
child: const Text('Exit'),
186+
onPressed: () {
187+
Navigator.of(context).pop(); // Close the dialog
188+
SystemNavigator.pop(); // Exit the app
189+
},
190+
),
191+
],
192+
);
193+
},
194+
);
195+
}

lib/taskserver/ntaskserver.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:get/get.dart';
23
import 'package:loggy/loggy.dart';
34
import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart';
45
// ignore_for_file: use_build_context_synchronously
@@ -418,6 +419,7 @@ class _ManageTaskServerState extends State<ManageTaskServer> {
418419
key: 'TASKRC',
419420
);
420421
setState(() {});
422+
Get.back();
421423
},
422424
child: const Text(
423425
'Select TASKRC file'),

lib/views/home/home.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ class _HomePageState extends State<HomePage> {
175175
context,
176176
MaterialPageRoute(
177177
builder: (_) => const ManageTaskServer(),
178-
));
178+
)).then((value) {
179+
setState(() {});
180+
});
179181
},
180182
textColor: Colors.purple,
181183
),

web/favicon.png

-917 Bytes
Binary file not shown.

web/icons/Icon-192.png

-5.17 KB
Binary file not shown.

web/icons/Icon-512.png

-8.06 KB
Binary file not shown.

web/icons/Icon-maskable-192.png

-5.46 KB
Binary file not shown.

web/icons/Icon-maskable-512.png

-20.5 KB
Binary file not shown.

web/index.html

Lines changed: 0 additions & 111 deletions
This file was deleted.

web/manifest.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)