-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: broken pop dialog #293
Conversation
In `feedback-widget`, replaced the wrap around the `theme` with an Overlay widget instead of the `navigation`. The Navigation widget intercept the back action in general app navigation and prevent dialogs from popping
@ueman have you been able to review this PR? |
Unfortunately, it's not this easy to fix the issue. If you try running the example, click on the 'toggle feedback mode' button, and then when you use the drop down in the feedback view, it's broken, since there's no navigator anymore. |
Okey thanks, let me review it and see if I can figure out anything else to fix it |
Wrap the feedback-builder with a Navigation ancestor to avoid error
Hi @ueman , I just submit another commit with the fix for the 'dropdown need navigator ancestor' Solution: I wrap the feedback-builder with a navigation and it worked. Description: From one side, if fixes the error when something in this builder need a Navigation as ancestor, BTW, the other solution I found was to do the same thing from the 'developer' side, and wrap the feedback-builder with the navigation, and work as same, the difference is that it give the responsibility to the developer and should be an explicit explanation in this package docs to avoid future errors |
Can you open a dialog from the custom feedback builder?
That's awesome. Can you also extend the example or test with a dialog, so that this behavior doesn't regress in the future?
I don't like this solution. The developer shouldn't have to figure this out on his own, it should just work. It's the expected behavior from a consumer's point of view, so not enabling that seems like a bad design. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #293 +/- ##
==========================================
- Coverage 83.77% 83.43% -0.35%
==========================================
Files 20 20
Lines 635 640 +5
==========================================
+ Hits 532 534 +2
- Misses 103 106 +3 ☔ View full report in Codecov by Sentry. |
Add two buttons to open a test alert-dialog. - The first one in the base screen to handle the `normal` flow of navigation and test the open/close option with back action - The second one in the custom-feedback to test the behavior of open a dialog with a custom navigator
Updated the example. You can successfully open a dialog from the custom-feedback, the I attached images of how it would look: Basic Image with nothing open: Image with both dialogs open, one from base scaffold and one from custom-feedback: |
With the current code, the dialog would be shown properly, and not just in the bottom sheet. It's a very tricky problem :/ |
Maybe @caseycrogers has some ideas on how to fix the navigator issue? |
At this point I consider that maybe we must put the options on the table and sacrifice something, the options I see are: 1 - Leave the plugin as is with the impossibility of using the dialogs if you use this package (because they dont pop) |
I'm happy to dig into this this weekend and see if I can come up with a fix. Flutter's navigation handling for the Android back button is a dumpster fire, but it's a dumpster fire I've dove into a couple times before so there's a good chance to make everyone happy here. All that said, showing a dialogue within a feedback flow and then having it properly respond to the back gesture is such a niche within a niche as you said it may also be reasonable to just pick one compromise or the other. |
@ueman @caseycrogers any update guys? |
I'll plan to merge this, but I'm currently busy 😅 Thank you very much for this tho! |
Thanks to you, for me it is a pleasure be able to contribute to a package as awesome as this one |
Thanks @ueman for the approvement |
📜 Description
When a dialog is showed, and the back button in Android is pressed, the dialog don't pop, instead the
back
action is executen in the background screenThe error was given because the use of an
navigation
widget in the widget tree prevent the back action from actually poping the dialog (btw, I'm not 100% sure why this bug is reproduced, but I know that with this change it get solved)Before:
After:
💡 Motivation and Context
This PR solve the
Dialog not popping
issueThis issue is reported in:
💚 How did you test it?
To tested, run the next code in the latest version of the plugin:
📝 Checklist
🔮 Next steps