Skip to content

Commit 1ea088c

Browse files
authored
Settings Page back navigation error and snackbar show error fix (#581)
* fix: fixed settings page back navigation issue Signed-off-by: rohansen856 <rohansen856@gmail.com> * fix: fixed success snackbar initialization error Signed-off-by: rohansen856 <rohansen856@gmail.com> --------- Signed-off-by: rohansen856 <rohansen856@gmail.com>
1 parent e789701 commit 1ea088c

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

lib/app/modules/settings/controllers/settings_controller.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class SettingsController extends GetxController {
4949
void pickDirectory(BuildContext context) {
5050
TaskwarriorColorTheme tColors =
5151
Theme.of(context).extension<TaskwarriorColorTheme>()!;
52+
final scaffoldMessenger = ScaffoldMessenger.of(context);
5253
FilePicker.platform.getDirectoryPath().then((value) async {
5354
if (value != null) {
5455
isMovingDirectory.value = true;
@@ -67,11 +68,15 @@ class SettingsController extends GetxController {
6768
SharedPreferences prefs = await SharedPreferences.getInstance();
6869
prefs.setString('baseDirectory', destination.path);
6970
baseDirectory.value = destination.path;
70-
Get.snackbar(
71-
'Success',
72-
'Base directory moved successfully',
73-
snackPosition: SnackPosition.BOTTOM,
74-
duration: const Duration(seconds: 2),
71+
scaffoldMessenger.showSnackBar(
72+
SnackBar(
73+
content: Text(
74+
'Base directory moved successfully',
75+
style: TextStyle(color: tColors.primaryTextColor),
76+
),
77+
backgroundColor: tColors.secondaryBackgroundColor,
78+
duration: const Duration(seconds: 2),
79+
),
7580
);
7681
} else {
7782
Get.dialog(

lib/app/modules/settings/views/settings_page_app_bar.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ class SettingsPageAppBar extends StatelessWidget
5858
onTap: () {
5959
// Get.toNamed(Routes.b)
6060
// ;
61-
Get.back();
61+
if (Get.isSnackbarOpen == true) {
62+
Get.closeCurrentSnackbar();
63+
}
64+
Navigator.of(context).pop();
6265
},
6366
child: Icon(
6467
Icons.chevron_left,

0 commit comments

Comments
 (0)