The Flutter gesture recognizers.

To use, import package:flutter/gestures.dart.

Constants

kBackMouseButton int

The bit of PointerEvent.buttons that corresponds to the back mouse button.

0x08
kDoubleTapMinTime Duration

The minimum time from the end of the first tap to the start of the second tap in a double-tap gesture. (Currently not honored by the DoubleTapGestureRecognizer.)

const Duration(milliseconds: 40)
kDoubleTapSlop double

Distance between the initial position of the first touch and the start position of a potential second touch for the second touch to be considered the second touch of a double-tap gesture.

100.0
kDoubleTapTimeout Duration

The maximum time from the start of the first tap to the start of the second tap in a double-tap gesture.

const Duration(milliseconds: 300)
kDoubleTapTouchSlop double

The maximum distance that the first touch in a double-tap gesture can travel before deciding that it is not part of a double-tap gesture. DoubleTapGestureRecognizer also restricts the second touch to this distance.

kTouchSlop
kForwardMouseButton int

The bit of PointerEvent.buttons that corresponds to the forward mouse button.

0x10
kHoverTapSlop double

Maximum distance between the down and up pointers for a tap. (Currently not honored by the TapGestureRecognizer; PrimaryPointerGestureRecognizer, which TapGestureRecognizer inherits from, uses kTouchSlop.)

20.0
kHoverTapTimeout Duration

Maximum length of time between a tap down and a tap up for the gesture to be considered a tap. (Currently not honored by the TapGestureRecognizer.)

const Duration(milliseconds: 150)
kJumpTapTimeout Duration

The maximum time from the start of the first tap to the start of the second tap in a jump-tap gesture.

const Duration(milliseconds: 500)
kLongPressTimeout Duration

The time before a long press gesture attempts to win.

const Duration(milliseconds: 500)
kMaxFlingVelocity double

Drag gesture fling velocities are clipped to this value.

8000.0
kMiddleMouseButton int

The bit of PointerEvent.buttons that corresponds to the middle mouse button.

0x04
kMinFlingVelocity double

The minimum velocity for a touch to consider that touch to trigger a fling gesture.

50.0
kPagingTouchSlop double

The distance a touch has to travel for us to be confident that the gesture is a paging gesture. (Currently not used, because paging uses a regular drag gesture, which uses kTouchSlop.)

kTouchSlop * 2.0
kPanSlop double

The distance a touch has to travel for us to be confident that the gesture is a panning gesture.

kTouchSlop * 2.0
kPressTimeout Duration

The time that must elapse before a tap gesture sends onTapDown, if there's any doubt that the gesture is a tap.

const Duration(milliseconds: 100)
kPrimaryMouseButton int

The bit of PointerEvent.buttons that corresponds to the primary mouse button.

0x01
kPrimaryStylusButton int

The bit of PointerEvent.buttons that corresponds to the primary stylus button.

0x02
kScaleSlop double

The distance a touch has to travel for us to be confident that the gesture is a scale gesture.

kTouchSlop
kSecondaryMouseButton int

The bit of PointerEvent.buttons that corresponds to the secondary mouse button.

0x02
kSecondaryStylusButton int

The bit of PointerEvent.buttons that corresponds to the secondary stylus button.

0x04
kTouchSlop double

The distance a touch has to travel for us to be confident that the gesture is a scroll gesture.

8.0
kWindowTouchSlop double

The margin around a dialog, popup menu, or other window-like widget inside which we do not consider a tap to dismiss the widget. (Not currently used.)

16.0
kZoomControlsTimeout Duration

The time for which zoom controls (e.g. in a map interface) are to be displayed on the screen, from the moment they were last requested.

const Duration(milliseconds: 3000)

Typedefs

GestureDoubleTapCallback() → void

Signature for callback when the user has tapped the screen at the same location twice in quick succession.

GestureDragCancelCallback() → void

Signature for when the pointer that previously triggered a GestureDragDownCallback did not complete.

GestureDragDownCallback(DragDownDetails details) → void

Signature for when a pointer has contacted the screen and might begin to move.

GestureDragEndCallback(DragEndDetails details) → void

Signature for when a pointer that was previously in contact with the screen and moving is no longer in contact with the screen.

GestureDragStartCallback(DragStartDetails details) → void

Signature for when a pointer has contacted the screen and has begun to move.

GestureDragUpdateCallback(DragUpdateDetails details) → void

Signature for when a pointer that is in contact with the screen and moving has moved again.

GestureLongPressCallback() → void

Signature for when a pointer has remained in contact with the screen at the same location for a long period of time.

GestureMultiDragStartCallback(Point position) Drag

Signature for when MultiDragGestureRecognizer recognizes the start of a drag gesture.

GestureMultiTapCallback(int pointer) → void

Signature used by MultiTapGestureRecognizer for when a tap has occurred.

GestureMultiTapCancelCallback(int pointer) → void

Signature for when the pointer that previously triggered a GestureMultiTapDownCallback will not end up causing a tap.

GestureMultiTapDownCallback(int pointer, TapDownDetails details) → void

Signature used by MultiTapGestureRecognizer for when a pointer that might cause a tap has contacted the screen at a particular location.

GestureMultiTapUpCallback(int pointer, TapUpDetails details) → void

Signature used by MultiTapGestureRecognizer for when a pointer that will trigger a tap has stopped contacting the screen at a particular location.

GestureScaleEndCallback(ScaleEndDetails details) → void

Signature for when the pointers are no longer in contact with the screen.

GestureScaleStartCallback(ScaleStartDetails details) → void

Signature for when the pointers in contact with the screen have established a focal point and initial scale of 1.0.

GestureScaleUpdateCallback(ScaleUpdateDetails details) → void

Signature for when the pointers in contact with the screen have indicated a new focal point and/or scale.

GestureTapCallback() → void

Signature for when a tap has occurred.

GestureTapCancelCallback() → void

Signature for when the pointer that previously triggered a GestureTapDownCallback will not end up causing a tap.

GestureTapDownCallback(TapDownDetails details) → void

Signature for when a pointer that might cause a tap has contacted the screen.

GestureTapUpCallback(TapUpDetails details) → void

Signature for when a pointer that will trigger a tap has stopped contacting the screen.

PointerRoute(PointerEvent event) → void

A callback that receives a PointerEvent

RecognizerCallback() → T

Functions

nthMouseButton(int number) int

The bit of PointerEvent.buttons that corresponds to the nth mouse button.

nthStylusButton(int number) int

The bit of PointerEvent.buttons that corresponds to the nth stylus button.

Enums

GestureDisposition

Whether the gesture was accepted or rejected.

GestureRecognizerState

The possible states of a PrimaryPointerGestureRecognizer.

PointerDeviceKind

The kind of pointer device.

ScaleState

The possible states of a ScaleGestureRecognizer.

Classes

DelayedMultiDragGestureRecognizer

Recognizes movement both horizontally and vertically on a per-pointer basis after a delay.

DoubleTapGestureRecognizer

Recognizes when the user has tapped the screen at the same location twice in quick succession.

Drag

Interface for receiving updates about drags from a MultiDragGestureRecognizer.

DragDownDetails

Details for GestureDragDownCallback.

DragEndDetails

Details for GestureDragEndCallback.

DragGestureRecognizer

Recognizes movement.

DragStartDetails

Details for GestureDragStartCallback.

DragUpdateDetails

Details for GestureDragUpdateCallback.

FlutterErrorDetailsForPointerEventDispatcher

Variant of FlutterErrorDetails with extra fields for the gesture library's binding's pointer event dispatcher (GestureBinding.dispatchEvent).

FlutterErrorDetailsForPointerRouter

Variant of FlutterErrorDetails with extra fields for the gestures library's pointer router (PointerRouter).

GestureArenaEntry

An interface to information to an arena.

GestureArenaManager

The first member to accept or the last member to not to reject wins.

GestureArenaMember

Represents an object participating in an arena.

GestureBinding

A binding for the gesture subsystem.

GestureRecognizer

The base class that all GestureRecognizers should inherit from.

HitTestable

An object that can hit-test pointers.

HitTestDispatcher

An object that can dispatch events.

HitTestEntry

Data collected during a hit test about a specific HitTestTarget.

HitTestResult

The result of performing a hit test.

HitTestTarget

An object that can handle events.

HorizontalDragGestureRecognizer

Recognizes movement in the horizontal direction.

HorizontalMultiDragGestureRecognizer

Recognizes movement in the horizontal direction on a per-pointer basis.

ImmediateMultiDragGestureRecognizer

Recognizes movement both horizontally and vertically on a per-pointer basis.

LeastSquaresSolver

Uses the least-squares algorithm to fit a polynomial to a set of data.

LongPressGestureRecognizer

Recognizes when the user has pressed down at the same location for a long period of time.

MultiDragGestureRecognizer

Recognizes movement on a per-pointer basis.

MultiDragPointerState

Per-pointer state for a MultiDragGestureRecognizer.

MultiTapGestureRecognizer

Recognizes taps on a per-pointer basis.

Offset

An immutable 2D floating-point offset.

OneSequenceGestureRecognizer

Base class for gesture recognizers that can only recognize one gesture at a time. For example, a single TapGestureRecognizer can never recognize two taps happening simultaneously, even if multiple pointers are placed on the same widget.

PanGestureRecognizer

Recognizes movement both horizontally and vertically.

Point

An immutable 2D floating-point x,y coordinate pair.

PointerAddedEvent

The device has started tracking the pointer.

PointerCancelEvent

The input from the pointer is no longer directed towards this receiver.

PointerDownEvent

The pointer has made contact with the device.

PointerEvent

Base class for touch, stylus, or mouse events.

PointerEventConverter

Converts from engine pointer data to framework pointer events.

PointerHoverEvent

The pointer has moved with respect to the device while the pointer is not in contact with the device.

PointerMoveEvent

The pointer has moved with respect to the device while the pointer is in contact with the device.

PointerRemovedEvent

The device is no longer tracking the pointer.

PointerRouter

A routing table for PointerEvent events.

PointerUpEvent

The pointer has stopped making contact with the device.

PolynomialFit

An nth degree polynomial fit to a dataset.

PrimaryPointerGestureRecognizer

A base class for gesture recognizers that track a single primary pointer.

ScaleEndDetails

Details for GestureScaleEndCallback.

ScaleGestureRecognizer

Recognizes a scale gesture.

ScaleStartDetails

Details for GestureScaleStartCallback.

ScaleUpdateDetails

Details for GestureScaleUpdateCallback.

TapDownDetails

Details for GestureTapDownCallback, such as position.

TapGestureRecognizer

Recognizes taps.

TapUpDetails

Details for GestureTapUpCallback, such as position.

Velocity

A velocity in two dimensions.

VelocityTracker

Computes a pointer velocity based on data from PointerMove events.

VerticalDragGestureRecognizer

Recognizes movement in the vertical direction.

VerticalMultiDragGestureRecognizer

Recognizes movement in the vertical direction on a per-pointer basis.