GestureDetector
TheGestureDetector
widget in Stac allows you to detect various gestures and user interactions within your application. It wraps Flutter’s native GestureDetector widget, providing a JSON-based interface to handle touch events, taps, drags, and more.
Usage
To use a GestureDetector in your Stac JSON, specify the widget type as “gestureDetector” and provide a child widget along with any gesture callbacks you want to handle.Properties
Child Widget
Property | Type | Description |
---|---|---|
child | Widget | The widget that will respond to gestures |
Tap Gestures
Property | Type | Description |
---|---|---|
onTapDown | Action | Called when a pointer contacts the screen |
onTapUp | Action | Called when a pointer stops contacting the screen |
onTap | Action | Called when a tap occurs |
onTapCancel | Action | Called when the tap is canceled |
onDoubleTapDown | Action | Called when a pointer contacts the screen in a potential double tap |
onDoubleTap | Action | Called when a double tap occurs |
onDoubleTapCancel | Action | Called when the double tap is canceled |
Secondary and Tertiary Tap Gestures
Property | Type | Description |
---|---|---|
onSecondaryTap | Action | Called when a secondary tap occurs (e.g., right-click) |
onSecondaryTapDown | Action | Called when a secondary pointer contacts the screen |
onSecondaryTapUp | Action | Called when a secondary pointer stops contacting the screen |
onSecondaryTapCancel | Action | Called when the secondary tap is canceled |
onTertiaryTapDown | Action | Called when a tertiary pointer contacts the screen |
onTertiaryTapUp | Action | Called when a tertiary pointer stops contacting the screen |
onTertiaryTapCancel | Action | Called when the tertiary tap is canceled |
Long Press Gestures
Property | Type | Description |
---|---|---|
onLongPressDown | Action | Called when a pointer contacts the screen in a potential long press |
onLongPressCancel | Action | Called when the long press is canceled |
onLongPress | Action | Called when a long press occurs |
onLongPressStart | Action | Called when a long press starts |
onLongPressMoveUpdate | Action | Called when a long press move update occurs |
onLongPressUp | Action | Called when a long press up occurs |
onLongPressEnd | Action | Called when a long press ends |
Secondary and Tertiary Long Press Gestures
Property | Type | Description |
---|---|---|
onSecondaryLongPressDown | Action | Called when a secondary pointer contacts the screen in a potential long press |
onSecondaryLongPressCancel | Action | Called when the secondary long press is canceled |
onSecondaryLongPress | Action | Called when a secondary long press occurs |
onSecondaryLongPressStart | Action | Called when a secondary long press starts |
onSecondaryLongPressMoveUpdate | Action | Called when a secondary long press move update occurs |
onSecondaryLongPressUp | Action | Called when a secondary long press up occurs |
onSecondaryLongPressEnd | Action | Called when a secondary long press ends |
onTertiaryLongPressDown | Action | Called when a tertiary pointer contacts the screen in a potential long press |
onTertiaryLongPressCancel | Action | Called when the tertiary long press is canceled |
onTertiaryLongPress | Action | Called when a tertiary long press occurs |
onTertiaryLongPressStart | Action | Called when a tertiary long press starts |
onTertiaryLongPressMoveUpdate | Action | Called when a tertiary long press move update occurs |
onTertiaryLongPressUp | Action | Called when a tertiary long press up occurs |
onTertiaryLongPressEnd | Action | Called when a tertiary long press ends |
Drag Gestures
Property | Type | Description |
---|---|---|
onVerticalDragDown | Action | Called when a pointer contacts the screen and might begin a vertical drag |
onVerticalDragStart | Action | Called when a pointer starts a vertical drag |
onVerticalDragUpdate | Action | Called when a pointer updates a vertical drag |
onVerticalDragEnd | Action | Called when a pointer ends a vertical drag |
onVerticalDragCancel | Action | Called when the vertical drag is canceled |
onHorizontalDragDown | Action | Called when a pointer contacts the screen and might begin a horizontal drag |
onHorizontalDragStart | Action | Called when a pointer starts a horizontal drag |
onHorizontalDragUpdate | Action | Called when a pointer updates a horizontal drag |
onHorizontalDragEnd | Action | Called when a pointer ends a horizontal drag |
onHorizontalDragCancel | Action | Called when the horizontal drag is canceled |
Force Press Gestures
Property | Type | Description |
---|---|---|
onForcePressStart | Action | Called when a force press starts |
onForcePressPeak | Action | Called when a force press reaches its peak force |
onForcePressUpdate | Action | Called when a force press updates |
onForcePressEnd | Action | Called when a force press ends |
Other Properties
Property | Type | Default | Description |
---|---|---|---|
excludeFromSemantics | boolean | false | Whether to exclude the gestures from the semantics tree |
dragStartBehavior | string | ”start” | Determines when a drag formally starts (“start” or “down”) |