onTap property

GestureTapCallback onTap

Called when the user taps on this text field.

The text field builds a GestureDetector to handle input events like tap, to trigger focus requests, to move the caret, adjust the selection, etc. Handling some of those events by wrapping the text field with a competing GestureDetector is problematic.

To unconditionally handle taps, without interfering with the text field's internal gesture detector, provide this callback.

If the text field is created with enabled false, taps will not be recognized.

To be notified when the text field gains or loses the focus, provide a focusNode and add a listener to that.

To listen to arbitrary pointer events without competing with the text field's internal gesture detector, use a Listener.


final GestureTapCallback onTap