Fix text selection in SearchAnchor/SearchBar#137636
Fix text selection in SearchAnchor/SearchBar#137636auto-submit[bot] merged 16 commits intoflutter:masterfrom
SearchAnchor/SearchBar#137636Conversation
16b47c0 to
d54ad44
Compare
SearchAnchorSearchAnchor/SearchBar
QuncCccccc
left a comment
There was a problem hiding this comment.
This looks good to me! Just left some questions:)
There was a problem hiding this comment.
Can we just do onTap: widget.onTap?
There was a problem hiding this comment.
Should we just remove _focusNode and the dispose part because I think it's unused?
There was a problem hiding this comment.
Seems _state.widget.onTap?.call(); is removed from onSingleTapUp. Just wonder if this is intended?
There was a problem hiding this comment.
This is intended, it has been moved to onUserTap so there can be some differentiation between the framework onTap callback and a user provided onTap callback. This is a non-breaking change because onUserTap will still be called with onSingleTapUp in TextSelectionGestureDetector as it was before this change. Extenders of TextSelectionGestureDetectorBuilder will be okay because TextSelectionGestureDetector retains its previous behavior as the default (A user can still choose to put _state.widget.onTap?.call() in onSingleTapUp and it will work as expected).
QuncCccccc
left a comment
There was a problem hiding this comment.
LGTM! Thanks so much for this fix and all the unit tests😲!
…g the focus change as an internal change instead of a focus change as a result of a tab
a235b09 to
399ccfb
Compare
This changes fixes text selection gestures on the search field when using
SearchAnchor.Before this change text selection gestures did not work due to an
IgnorePointerin the widget tree.This change:
IgnorePointerso the underlyingTextFieldcan receive pointer events.TextField.onTapAlwaysCalledandTextSelectionGestureDetector.onUserTapAlwaysCalled, so a user provided on tap callback can be called on consecutive taps. This is so that the user provided on tap callback forSearchAnchor/SearchBarthat was previously only handled byInkWellwill still work if a tap occurs in theTextFields hit box. TheTextFields default behavior is maintained outside of the context ofSearchAnchor/SearchBar.Fixes #128332 and #134965
Pre-launch Checklist
///).