Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/app/modules/detailRoute/views/detail_route_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class DetailRouteView extends GetView<DetailRouteController> {
),
),
actions: [
// YES → save and pop
TextButton(
onPressed: () {
// Get.back(); // Close the dialog first
Expand All @@ -73,11 +74,12 @@ class DetailRouteView extends GetView<DetailRouteController> {
),
),
),

// NO → discard and pop
TextButton(
onPressed: () {
// Get.offAll(() => const HomeView());

Navigator.of(context).pop();
Navigator.of(context).pop(false);
},
child: Text(
SentenceManager(
Expand All @@ -89,9 +91,11 @@ class DetailRouteView extends GetView<DetailRouteController> {
),
),
),

// CANCEL → stay on page
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
Navigator.of(context).pop(null);
},
child: Text(
SentenceManager(
Expand All @@ -107,7 +111,12 @@ class DetailRouteView extends GetView<DetailRouteController> {
);
},
);
return save == true;
if (save == null) {
// Cancel → stay
return false;
}
// Yes (true) or No (false) → both allow popping the screen
return true;
Comment on lines +114 to +119
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using an enum-based approach similar to taskc_details_controller.dart for better type safety and maintainability. That module defines UnsavedChangesAction { save, discard, cancel } and uses it in the dialog and handleWillPop method. This would make the intent clearer than using bool? values, especially since you now have three distinct actions (Yes/No/Cancel) rather than true/false/null.

Copilot uses AI. Check for mistakes.
},
child: Scaffold(
backgroundColor: tColors.primaryBackgroundColor,
Expand Down