-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
Use case
By default, the on screen keyboard is dismissed by non-mobile touch events, such as a click.
It is quite common to want similar behavior on mobile. That can be done by calling unfocus on the text fields FocusNode inside the onTapCallback. That does however mean that both taps and scrolls are handled the same, since TapRegion uses PointerDownEvent as a trigger for onTapOutside. (Contradictory to what the name might suggest. Compare with onTap and onTapDown in GestureDetector)
Having the ability to differentiate between scroll and tap would give developers the ability to close the text field on a tap, but keep it open when scrolling.
Attached below is a video of the Google Home app on Android, showing the behavior that I'm looking for.
untitled.mp4
Proposal
TapRegion, should have more parameters to differentiate between different gestures, similar to GestureDetector. This would be a breaking change, but onTapOutside should behave like onTap of GestureDetector, and a new parameter with the name onTapDownOutside should be added that has the current behaviour. Other gestures should be handled by other parameters.