Repository navigation
Add "navigator" option to "showDialog" and "showGeneralDialog" - #42842
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
navigator option to showDialog and showGeneralDialog
goderbauer
left a comment
There was a problem hiding this comment.
Approach seems OK. This will need a test, though.
jimmy-robert
left a comment
There was a problem hiding this comment.
What about other showXXX() functions that also use Navigator or showDialog?
showAboutDialogshowCupertinoDialogshowCupertinoModalPopupshowLicensePageshowMenushowModalBottomSheetshowSearchshowTimePicker
|
@brianegan Are you planning on revisiting this? |
|
@Piinks Yep! Sorry, had another bit of work to wrap up the past week or so. After seeing @JimmyRobz comment, I realized this is actually a pretty decent sized change to quite a few methods. Since the assets-for-api-docs project is quite unique in how it works and is kind of "non-standard", I wanted to take a bit more time to see if I could get around the issue without changing so many methods in Flutter itself. After spending a few more hours on that, I think I feel pretty confident in saying the only way to fix the issue there is to make this change! |
|
@JimmyRobz @goderbauer Thanks for your feedback! I have a question I'd love to ask: Is a There were two ideas for this change -- allow this function to accept a useRootNavigatorPros:
Cons:
NavigatorStatePros:
Cons:
|
|
Since we already have useRootNavigator on one of them and we don't really have a user case for anything else I'd be fine with just adding useRootNavigator. |
ab6fbeb to
7e9de1e
Compare
|
Thanks @goderbauer -- I've now changed everything to |
goderbauer
left a comment
There was a problem hiding this comment.
Looks good. Just some nits.
There was a problem hiding this comment.
This should mention what the default is (here and elsewhere).
There was a problem hiding this comment.
You may want to use a {@macro ...} for this.
There was a problem hiding this comment.
Mentioned the default for every function.
I decided against a macro for now since there isn't much duplication and I find macro docs quite inconvenient as a user (since it forces you to leave your editor and head to the api docs website in order to view the information).
Let me know if you feel strongly about using @macro, though -- can be easily changed.
- Tests for each function - Mention `useRootNavigator` default in every function's docs - Assert root navigator is not null in every function - Ensure correct default values for every function
7e9de1e to
9a43dd0
Compare
|
Thanks again, @goderbauer. I've added tests to each function and addressed all feedback. - Mention |
|
Thanks, @goderbauer! Should I hold off on merging this change since flutter-build is currently broken on this branch? Is there anything I can do to fix it or is the problem unrelated to my changes? |
|
Yeah, you'll have to wait until all checks are green. The current redness is unrelated to your change. |
Description
The problem: We need to use
showDialogto push a dialog to sub Navigator, not the root Navigator. At the moment,showDialogusesshowGenericDialogwhich always uses the root navigator.The solution: This Pull Request adds the ability to specify the
NavigatorStatewhich should be used to push dialog routes.Alternative solution: Accept an optional
bool useRootNavigator = trueparameter instead of aNavigatorState.Related Issues
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?