XGestureDetector class

A widget that detects gestures.

  • Supports Tap, DoubleTap, Move(start, update, end), Scale(start, update, end) and Long Press
  • All callbacks be used simultaneously

For handle rotate event, please use rotateAngle on onScaleUpdate.

Inheritance

Constructors

XGestureDetector({required Widget child, TapEventListener? onTap, MoveEventListener? onMoveUpdate, MoveEventListener? onMoveEnd, MoveEventListener? onMoveStart, void onScaleStart(Offset initialFocusPoint)?, ScaleEventListener? onScaleUpdate, void onScaleEnd()?, TapEventListener? onDoubleTap, dynamic onScrollEvent(ScrollEvent event)?, bool bypassMoveEventAfterLongPress = true, bool bypassTapEventOnDoubleTap = false, int doubleTapTimeConsider = 250, int longPressTimeConsider = 350, TapEventListener? onLongPress, MoveEventListener? onLongPressMove, dynamic onLongPressEnd()?, HitTestBehavior behavior = HitTestBehavior.deferToChild, int longPressMaximumRangeAllowed = 25})
Creates a widget that detects gestures.

Properties

behavior HitTestBehavior
How to behave during hit testing.
final
bypassMoveEventAfterLongPress bool
by default it is true, means after receive long press event without release pointer (finger still touch on screen) the move event will be ignore.
final
bypassTapEventOnDoubleTap bool
a flag to enable/disable tap event when double tap event occurs.
final
child Widget
The widget below this widget in the tree.
final
doubleTapTimeConsider int
A specific duration to detect double tap
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
longPressMaximumRangeAllowed int
The maxium distance between the first touching position and the position when the long press event occurs. default: distanceSquared = 25
final
longPressTimeConsider int
A specific duration to detect long press
final
onDoubleTap TapEventListener?
The user has tapped the screen at the same location twice in quick succession.
final
onLongPress TapEventListener?
A pointer has remained in contact with the screen at the same location for a long period of time
final
onLongPressEnd → (dynamic Function()?)
The pointer are no longer in contact with the screen after onLongPress event.
final
onLongPressMove MoveEventListener?
The pointer in the long press state and then made a move
final
onMoveEnd MoveEventListener?
A pointer that was previously in contact with the screen with a primary button and moving is no longer in contact with the screen and was moving at a specific velocity when it stopped contacting the screen.
final
onMoveStart MoveEventListener?
A pointer has contacted the screen with a primary button and has begun to move.
final
onMoveUpdate MoveEventListener?
A pointer that is in contact with the screen with a primary button and made a move
final
onScaleEnd → (void Function()?)
The pointers are no longer in contact with the screen.
final
onScaleStart → (void Function(Offset initialFocusPoint)?)
The pointers in contact with the screen have established a focal point and initial scale of 1.0.
final
onScaleUpdate ScaleEventListener?
The pointers in contact with the screen have indicated a new focal point and/or scale.
final
onScrollEvent → (dynamic Function(ScrollEvent event)?)
The callback for scroll event
final
onTap TapEventListener?
The pointer that previously triggered the onTapDown has also triggered onTapUp which ends up causing a tap.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Operators

operator ==(Object other) bool
The equality operator.
inherited