Skip to content

feat(designer): dismissable barrier warnings#803

Open
johannesvedder wants to merge 3 commits into
devfrom
feat/dismissable-barrier-warnings
Open

feat(designer): dismissable barrier warnings#803
johannesvedder wants to merge 3 commits into
devfrom
feat/dismissable-barrier-warnings

Conversation

@johannesvedder
Copy link
Copy Markdown
Contributor

@johannesvedder johannesvedder commented Mar 23, 2026

This pull request introduces several improvements to the form handling and sidesheet modal logic, especially around unsaved changes and form dirty state detection. The changes enhance user experience by providing better prompts for unsaved changes, improving form state management, and making the modal sidesheet more flexible.

Form Dirty State Handling and Modal Dismissal:

  • Improved dirty state detection in FormViewModel by introducing a more reliable way to compare the initial and current form state, using a new _getFullFormValue() method and a dedicated finalizeInitializationBaseline() function. This ensures that programmatic changes to the form do not incorrectly mark it as dirty. [1] [2] [3] [4]
  • Added a new _FormSidesheetPopEntry widget and integrated it into the form sidesheet flow. This widget intercepts the modal pop action and, if the form is dirty, prompts the user with an UnsavedChangesDialog. If the user confirms, the form cancels and the modal is dismissed; otherwise, the modal remains open. [1] [2] [3]
  • Changed the default for barrierDismissible in showFormSideSheet to true, allowing users to dismiss the modal by clicking outside it, but with proper handling of unsaved changes.

Sidesheet Modal Enhancements:

  • Updated showModalSideSheet to accept a new wrapRoute parameter, allowing the modal content to be wrapped with custom widgets (such as _FormSidesheetPopEntry for pop interception). [1] [2] [3]

Minor Improvements:

  • Simplified the DismissButton in form_buttons.dart to directly pop the navigation stack, removing unnecessary async logic.
  • Updated the Supabase public anon key in the development environment configuration.
  • Ensured prevFormValue is initialized in InviteCodeFormViewModel for correct dirty state tracking.

@github-actions
Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 35141f1):

(expires Mon, 30 Mar 2026 15:40:35 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2149dad49ed83535217e50d5c18c0c8c90da629b

Copy link
Copy Markdown
Collaborator

@mohiuddinshahrukh mohiuddinshahrukh left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

AFter running it locally, I think this needs changes before merge because the main unsaved-changes protection can be bypassed in a common path.

{8B171832-CD21-4116-89A7-30F47A251E70}

Change

When editing a survey question sidesheet, I changed the question title and clicked the sidesheet Cancel button while the text field was still focused. The sidesheet closed immediately without showing the unsaved-changes dialog, and the edit was discarded.

The console showed:

[PopEntry] _handleDismiss isDirty=false```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants