Fix nested listeners so that ancestor listeners can also receive enter/exit/move events.#32350
Merged
gspencergoog merged 4 commits intoflutter:masterfrom May 9, 2019
Merged
Conversation
82f1acd to
434f912
Compare
434f912 to
0e765eb
Compare
jonahwilliams
approved these changes
May 8, 2019
| } | ||
|
|
||
| @override | ||
| Iterable<S> findAll<S>(Offset regionOffset) sync* { |
Contributor
There was a problem hiding this comment.
TBH I really dislike sync*, it has very poor performance characteristics. On the other hand, it is a clear win getting to implement findAll in terms of find in a lazy manner
Contributor
Author
There was a problem hiding this comment.
Yeah, this was a tradeoff. It's an implementation detail, though, so we can change it to use lists or something if it turns out to hurt performance.
8 tasks
gspencergoog
added a commit
to gspencergoog/flutter
that referenced
this pull request
May 9, 2019
…ive enter/exit/move events. (flutter#32350)" This reverts commit aeccd6a due to a performance regression.
This was referenced May 9, 2019
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
This changes
Listenerto trigger enter/move/exit in allListeners below the pointer, not just the leaf region (the first region hit). This is because we need to allow listeners to be nested so that, say, a widget that handles changing color on hover, but also is wrapped in aTooltip(that handles hover) can trigger both actions, not just one.To that end, I added a
findAlltoLayer, similar to the existingfindmethod that was previously used. It returns an iterator over annotated layers which match the given data type.Since the
findAllis implemented as returning an Iterable (and issync*), I re-implemented thefindroutines as just returning the first result fromfindAll, since that should be just as efficient, and would then prevent duplication in the implementation.Tests
I added the following tests:
findAllsimilar tofind, as well as extra tests having to do with returned order of results (which is leaf first, then ancestors).Listenerthat assure that nested listeners do the right thing.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?