TextSelectionGestureDetector class Null safety

A gesture detector to respond to non-exclusive event chains for a text field.

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.

See also:

  • TextField, a Material text field which uses this gesture detector.
  • CupertinoTextField, a Cupertino text field which uses this gesture detector.


TextSelectionGestureDetector({Key? key, GestureTapDownCallback? onTapDown, GestureForcePressStartCallback? onForcePressStart, GestureForcePressEndCallback? onForcePressEnd, GestureTapCallback? onSecondaryTap, GestureTapDownCallback? onSecondaryTapDown, GestureTapUpCallback? onSingleTapUp, GestureTapCancelCallback? onSingleTapCancel, GestureLongPressStartCallback? onSingleLongTapStart, GestureLongPressMoveUpdateCallback? onSingleLongTapMoveUpdate, GestureLongPressEndCallback? onSingleLongTapEnd, GestureTapDownCallback? onDoubleTapDown, GestureDragStartCallback? onDragSelectionStart, DragSelectionUpdateCallback? onDragSelectionUpdate, GestureDragEndCallback? onDragSelectionEnd, HitTestBehavior? behavior, required Widget child})
Create a TextSelectionGestureDetector. [...]


behavior HitTestBehavior?
How this gesture detector should behave during hit testing. [...]
child Widget
Child below this widget.
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
onDoubleTapDown GestureTapDownCallback?
Called after a momentary hold or a short tap that is close in space and time (within kDoubleTapTimeout) to a previous short tap.
onDragSelectionEnd GestureDragEndCallback?
Called when a mouse that was previously dragging is released.
onDragSelectionStart GestureDragStartCallback?
Called when a mouse starts dragging to select text.
onDragSelectionUpdate DragSelectionUpdateCallback?
Called repeatedly as a mouse moves while dragging. [...]
onForcePressEnd GestureForcePressEndCallback?
Called when a pointer that had previously triggered onForcePressStart is lifted off the screen.
onForcePressStart GestureForcePressStartCallback?
Called when a pointer has tapped down and the force of the pointer has just become greater than ForcePressGestureRecognizer.startPressure.
onSecondaryTap GestureTapCallback?
Called for a tap event with the secondary mouse button.
onSecondaryTapDown GestureTapDownCallback?
Called for a tap down event with the secondary mouse button.
onSingleLongTapEnd GestureLongPressEndCallback?
Called after onSingleLongTapStart when the pointer is lifted.
onSingleLongTapMoveUpdate GestureLongPressMoveUpdateCallback?
Called after onSingleLongTapStart when the pointer is dragged.
onSingleLongTapStart GestureLongPressStartCallback?
Called for a single long tap that's sustained for longer than kLongPressTimeout but not necessarily lifted. Not called for a double-tap-hold, which calls onDoubleTapDown instead.
onSingleTapCancel GestureTapCancelCallback?
Called for each touch that becomes recognized as a gesture that is not a short tap, such as a long tap or drag. It is called at the moment when another gesture from the touch is recognized.
onSingleTapUp GestureTapUpCallback?
Called for each distinct tap except for every second tap of a double tap. For example, if the detector was configured with onTapDown 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.
onTapDown GestureTapDownCallback?
Called for every tap down including every tap down that's part of a double click or a long press, except touches that include enough movement to not qualify as taps (e.g. pans and flings).
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited