Repository navigation
Revise Android and iOS gestures on Material TextField - #24457
Conversation
|
Gentle ping |
0132c82 to
a4fdbcb
Compare
HansMuller
left a comment
There was a problem hiding this comment.
This seems like a good overall approach. The semantics of the new gesture detector need to be better defined and tested.
There was a problem hiding this comment.
I'm not sure that "concurrent" is the best way to describe the events this widget recognizes. The next paragraph calls them event chains, maybe: A gesture detector that recognizes all of the individual tap up/down and double tap down events in a chain of events.
There was a problem hiding this comment.
This widget is unlike a plain [GestureDetector] which only recognizes one tap or double tap in a chain of events.
There was a problem hiding this comment.
Key key, and pass the key along via a super call
There was a problem hiding this comment.
Ah thanks, I always forget it
There was a problem hiding this comment.
Not sure what the difference between "tap was held momentarily" and "a short tap" is.
There was a problem hiding this comment.
I think it would be better to explain when this is called. I assume it's called because a tap down occurred - and onTapDown was called, and the pointer only moved a little and was held down long enough to qualify as a "long tap down".
Also: there's no shame in mentioning kDoubleTapTimeout and kDoubleTapSlop
There was a problem hiding this comment.
Added some more details. It's not really related to those 2 constants.
There was a problem hiding this comment.
This makes the semantics of this widget rather complicated. Where do we define the semantics of a GestureDetector that's a TextSelectionGestureDetector descendant? Or a TextSelectionGestureDetector that's a TextSelectionGestureDetector descendant? It wasn't necessary to explain this kind of thing when the translucent gesture detector was a TextField implementation detail, but now...
There was a problem hiding this comment.
Can you elaborate? I'm not sure I understand. The widget structure should be more or less the same as before.
There was a problem hiding this comment.
That's right, it is the same as before. But now this is a public class and so it's necessary to explain its semantics.
What happens when a TextSelectionGestureDetector has a GestureDetector descendant? Similarly what does it mean to have a TextSelectionGestureDetector with a TextSelectionGestureDetector descendant?
There was a problem hiding this comment.
Did what you suggested last week. Thanks for the tip!
There was a problem hiding this comment.
I think this means: not called if it follows a "tap up" within kDoubleTapTimeout?
There was a problem hiding this comment.
We don't necessarily need to be too specific and redefine a double click in word. There's other little things like not being too far from the previous tap etc.
There was a problem hiding this comment.
If the double tap timer is running, then upon seeing the second tap down, I think it should always be reset. Otherwise we could recognize an arbitrarily long sequence of taps as a double tap, so long as the intermediate ones were outside kDoubleTapSlop.
if (_doubleTapTimer != null) {
if (widget.onDoubleTapDown != null && _isWithinDoubleTapTolerance(details.globalPosition)) {
widget.onDoubleTapDown(details);
}
...
}
Also: this logic seems like it would map a sequence of 4 quick taps to a 3 double taps? Doesn't seem right.
There was a problem hiding this comment.
We talked about this offline. Also added test
a4fdbcb to
3a78318
Compare
|
Added more tests to the gesture detector |
cee298b to
bb32c8b
Compare
|
Rebased again |
HansMuller
left a comment
There was a problem hiding this comment.
This all looks good, mostly just some doc wordsmithing and small potatoes. We do need to sort out what it means to nest a GestureDetector or a TextSelectionGestureDetector within a TextSelectionGestureDetector
There was a problem hiding this comment.
This isn't wrong but we usually just look up the Theme as needed. InheritedWidget lookups are very cheap. Binding the theme to a final var at the top of a build method is probably the closest conventional way to do this.
There was a problem hiding this comment.
An ordinary [GestureDetector] configured to handle events like tap and double tap will only recognize one or the other. This widget detects both: first the tap and then, if another tap down occurs within a time limit, the double tap.
There was a problem hiding this comment.
can be called for one sequence input gestures.
There was a problem hiding this comment.
but except touches that are quickly => except touches that include enough movement to not qualify as taps (e.g. ...)
There was a problem hiding this comment.
Called for each distinct tap except for the second tap down of a double tap. For example, if the detector was configured [onSingleTapDown] and [onDoubleTapDown], three quick taps would be recognized as a single tap down, followed by a double tap down, followed by a single tap down.
[I hope I've gotten that right!]
There was a problem hiding this comment.
Mostly took your wording. Tweaked the first sentence.
There was a problem hiding this comment.
That's right, it is the same as before. But now this is a public class and so it's necessary to explain its semantics.
What happens when a TextSelectionGestureDetector has a GestureDetector descendant? Similarly what does it mean to have a TextSelectionGestureDetector with a TextSelectionGestureDetector descendant?
There was a problem hiding this comment.
I think what you mean is that slow double tap doesn't trigger a word selection.
There was a problem hiding this comment.
Not clear what this tap is for? Aren't we just checking a double tap?
There was a problem hiding this comment.
Unfortunately the rebase broke the github comment. I can't figure out which line you commented on anymore
There was a problem hiding this comment.
What's the tapAt on line 3695 for? It doesn't seem to be needed for the test.
There was a problem hiding this comment.
As before, what's this tap for?
There was a problem hiding this comment.
This functions look like one liners that return an int. Maybe:
void _handleTapDown(TapDownDetails details) { tapCount += 1; }
f91466d to
9b92ceb
Compare
|
Rebased again |
HansMuller
left a comment
There was a problem hiding this comment.
LGTM. There are still two open questions about what looked to me like unnecessary test taps.
There was a problem hiding this comment.
It seems odd to say a "gesture detector to detect". Maybe: "A gesture detector that matches non-exclusive ...".
There was a problem hiding this comment.
Changed to respond which is a fairly standard word
There was a problem hiding this comment.
Need to update this because child is required to be non-null.
There was a problem hiding this comment.
A comment that explained the significance of 300ms would be helpful (I assume 300ms > double tap interval).
There was a problem hiding this comment.
two slow taps do not ...
There was a problem hiding this comment.
What's the tapAt on line 3695 for? It doesn't seem to be needed for the test.
9b92ceb to
486f232
Compare
|
@xster This pull request destroys the material search functionality. Steps to reproduce:
Would be great if this would be fixed. |
|
After further analysis it seems like not only the material search is broken. This affects all textfields. Steps to reproduce:
|
|
Sorry for the breakage. For posterity, this PR is unrelated. Please follow along in #26563. |
Fixes #23972