A widget that detects gestures.

Attempts to recognize gestures that correspond to its non-null callbacks.

If this widget has a child, it defers to that child for its sizing behavior. If it does not have a child, it grows to fit the parent instead.

GestureDetector also listens for accessibility events and maps them to the callbacks. To ignore accessibility events, set excludeFromSemantics to true.

See http://flutter.io/gestures/ for additional information.

Inheritance

Constructors

GestureDetector({Key key, Widget child, GestureTapDownCallback onTapDown, GestureTapUpCallback onTapUp, GestureTapCallback onTap, GestureTapCancelCallback onTapCancel, GestureTapCallback onDoubleTap, GestureLongPressCallback onLongPress, GestureDragDownCallback onVerticalDragDown, GestureDragStartCallback onVerticalDragStart, GestureDragUpdateCallback onVerticalDragUpdate, GestureDragEndCallback onVerticalDragEnd, GestureDragCancelCallback onVerticalDragCancel, GestureDragDownCallback onHorizontalDragDown, GestureDragStartCallback onHorizontalDragStart, GestureDragUpdateCallback onHorizontalDragUpdate, GestureDragEndCallback onHorizontalDragEnd, GestureDragCancelCallback onHorizontalDragCancel, GestureDragDownCallback onPanDown, GestureDragStartCallback onPanStart, GestureDragUpdateCallback onPanUpdate, GestureDragEndCallback onPanEnd, GestureDragCancelCallback onPanCancel, GestureScaleStartCallback onScaleStart, GestureScaleUpdateCallback onScaleUpdate, GestureScaleEndCallback onScaleEnd, HitTestBehavior behavior, bool excludeFromSemantics: false })

Creates a widget that detects gestures.

Properties

behavior HitTestBehavior

How this gesture detector should behave during hit testing.

read-only
child Widget

The widget below this widget in the tree.

read-only
excludeFromSemantics bool

Whether to exclude these gestures from the semantics tree. For example, the long-press gesture for showing a tooltip is excluded because the tooltip itself is included in the semantics tree directly and so having a gesture to show it would result in duplication of information.

read-only
onDoubleTap GestureTapCallback

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

read-only
onHorizontalDragCancel GestureDragCancelCallback

The pointer that previously triggered onHorizontalDragDown did not complete.

read-only
onHorizontalDragDown GestureDragDownCallback

A pointer has contacted the screen and might begin to move horizontally.

read-only
onHorizontalDragEnd GestureDragEndCallback

A pointer that was previously in contact with the screen and moving horizontally is no longer in contact with the screen and was moving at a specific velocity when it stopped contacting the screen.

read-only
onHorizontalDragStart GestureDragStartCallback

A pointer has contacted the screen and has begun to move horizontally.

read-only
onHorizontalDragUpdate GestureDragUpdateCallback

A pointer that is in contact with the screen and moving horizontally has moved in the horizontal direction.

read-only
onLongPress GestureLongPressCallback

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

read-only
onPanCancel GestureDragCancelCallback

The pointer that previously triggered onPanDown did not complete.

read-only
onPanDown GestureDragDownCallback

A pointer has contacted the screen and might begin to move.

read-only
onPanEnd GestureDragEndCallback

A pointer that was previously in contact with the screen and moving is no longer in contact with the screen and was moving at a specific velocity when it stopped contacting the screen.

read-only
onPanStart GestureDragStartCallback

A pointer has contacted the screen and has begun to move.

read-only
onPanUpdate GestureDragUpdateCallback

A pointer that is in contact with the screen and moving has moved again.

read-only
onScaleEnd GestureScaleEndCallback

The pointers are no longer in contact with the screen.

read-only
onScaleStart GestureScaleStartCallback

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

read-only
onScaleUpdate GestureScaleUpdateCallback

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

read-only
onTap GestureTapCallback

A tap has occurred.

read-only
onTapCancel GestureTapCancelCallback

The pointer that previously triggered onTapDown will not end up causing a tap.

read-only
onTapDown GestureTapDownCallback

A pointer that might cause a tap has contacted the screen at a particular location.

read-only
onTapUp GestureTapUpCallback

A pointer that will trigger a tap has stopped contacting the screen at a particular location.

read-only
onVerticalDragCancel GestureDragCancelCallback

The pointer that previously triggered onVerticalDragDown did not complete.

read-only
onVerticalDragDown GestureDragDownCallback

A pointer has contacted the screen and might begin to move vertically.

read-only
onVerticalDragEnd GestureDragEndCallback

A pointer that was previously in contact with the screen and moving vertically is no longer in contact with the screen and was moving at a specific velocity when it stopped contacting the screen.

read-only
onVerticalDragStart GestureDragStartCallback

A pointer has contacted the screen and has begun to move vertically.

read-only
onVerticalDragUpdate GestureDragUpdateCallback

A pointer that is in contact with the screen and moving vertically has moved in the vertical direction.

read-only
hashCode int

Get a hash code for this object.

read-only, inherited
key Key

Controls how one widget replaces another widget in the tree.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

build(BuildContext context) Widget

Describes the part of the user interface represented by this widget.

createElement() StatelessElement

Creates a StatelessElement to manage this widget's location in the tree.

inherited
debugFillDescription(List<String> description) → void

Add additional information to the given description for use by toString.

inherited
noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() String

Returns a string representation of this object.

inherited
toStringShort() String

A short, textual description of this widget.

inherited