Skip to content

Conversation

@mulikruchi07
Copy link
Contributor

Description

Fixes the behavior of the unsaved-changes dialog shown when leaving the Task Edit screen.
Previously the No button closed the dialog without returning a value, which caused the onWillPop handler to treat it like a cancel and prevented navigation back. This change makes the No button return false from the dialog and updates onWillPop so that:

  • Yes → saves then allows the route to pop,
  • No → discards changes and allows the route to pop,
  • Cancel → stays on the page (no pop).

Fixes #511

Screenshots

Before (issue):
(see issue #511 for the before video)

After (this PR):

after.mp4

Tapping "No" now discards changes and navigates back to the previous screen

Checklist

  • Tests have been added or updated to cover the changes
  • Documentation has been updated to reflect the changes
  • Code follows the established coding style guidelines
  • All tests are passing

Copilot AI review requested due to automatic review settings December 7, 2025 03:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the "No" button in the unsaved changes dialog on the Task Edit screen did not navigate back to the previous screen. The fix updates the dialog's return values and the onWillPop handler logic to properly distinguish between the three user actions: saving changes (Yes), discarding changes (No), and canceling the navigation (Cancel).

Key Changes

  • Updated the "No" button to return false from the dialog instead of void
  • Updated the "Cancel" button to return null instead of false
  • Modified the onWillPop handler to allow navigation for both true (save) and false (discard) cases, while blocking navigation only for null (cancel)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +114 to +119
if (save == null) {
// Cancel → stay
return false;
}
// Yes (true) or No (false) → both allow popping the screen
return true;
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.
@SGI-CAPP-AT2 SGI-CAPP-AT2 self-requested a review December 7, 2025 05:42
@SGI-CAPP-AT2 SGI-CAPP-AT2 merged commit ea66fb0 into CCExtractor:main Dec 7, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

‘No’ button in the unsaved changes dialog does not navigate back

2 participants