-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Dismiss modal with any button press #32770
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
Merged
dkwingsmt
merged 87 commits into
flutter:master
from
dkwingsmt:modal-dismissed-by-any-button
Jul 18, 2019
Merged
Dismiss modal with any button press #32770
dkwingsmt
merged 87 commits into
flutter:master
from
dkwingsmt:modal-dismissed-by-any-button
Jul 18, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
Reopen PR since the blocker has been merged |
goderbauer
approved these changes
Jul 10, 2019
Member
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Contributor
|
Github lies, this is green - @dkwingsmt are you ready to merge this? |
Contributor
Author
|
@dnfield Let me sync with master just in case... |
dkwingsmt
added a commit
that referenced
this pull request
Jul 24, 2019
This reverts commit 1aa4628.
dkwingsmt
added a commit
that referenced
this pull request
Jul 24, 2019
9 tasks
johnsonmh
pushed a commit
to johnsonmh/flutter
that referenced
this pull request
Jul 30, 2019
This PR makes ModalBarrier dismiss modal with any button press instead of primary button up, by making it use a private recognizer _AnyTapGestureRecognizer that claims victor and calls onAnyTapDown immediately after it receives any PointerDownEvent.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently a modal route is dismissed by callback
onTap. This has 2 problems:onTap*will only respond to primary buttons, which means secondary (and other) buttons will no longer able to dismiss modals.To fix this, we need a tap gesture recognizer that responds to any buttons. However, adding
onAnyTap*as a public API toTapGRmight not be a good idead for 2 reasons:onAnyTap*needed for now. Might not worth the cost of adding a full set of public API, especially considering...onAnyTap*is easy to misuse (because it competes in all events)Instead
ModalBarrierwill use a private recognizer_AnyTapGestureRecognizerthat claims victor and callsonAnyTapDownimmediately after it receives anyPointerDownEvent.Changes
tap,press, and related ones inWidgetControllersupport customizing buttons._AnyTapGestureRecognizerand_ModalBarrierGestureDetector.ModalBarrieruses_ModalBarrierGestureDetector.onAnyTapDownto dismiss.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?