Skip to content

GestureDetector

Reports taps (and right-clicks) on its child. A tap is a press and release within the same region — the terminal analogue of a button press. Moving to a different cell while held cancels the tap, even inside the region. The innermost tap/drag target owns the tap, so wrapping an interactive child does not observe the child’s taps or add secondary handling: onTap and onSecondaryTap fire only on the innermost target. A drag goes to the nearest drag target from the pressed child outward, and that target also receives onTapDown. Pair with a Focus if the target should also take keyboard focus (click-to-focus handles that automatically for focusables).

Learn more: Input & gestures

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

GestureDetector(
onTap: _select,
onTapDown: (details) => _placeAt(details.localPosition),
child: child,
)
ParameterTypeDefaultDescription
onTap:PointerTapCallback?—Called after a left-button press and release complete in this region.
onTapDown:PointerCallback?—Begins a primary-button press. Paired with onTapUp or onTapCancel.
onPointerDown:PointerCallback?—Reports any button press. Use onTapDown for primary-button gestures.
onTapUp:PointerCallback?—Completes a primary press released inside the original region.
onTapCancel:PointerTapCallback?—The press was interrupted, dragged, or released outside its region.
onSecondaryTap:PointerTapCallback?—Called after a right-button press and release complete in this region.
onDragStart:PointerDragCallback?—Drag: a left press, then motion (with the button held), then release. The first changed cell calls both onDragStart and onDragUpdate with the same delta; apply movement in onDragUpdate. The region keeps receiving onDragUpdate even when the pointer leaves it (pointer capture), so sliders and splitters track smoothly. A drag suppresses onTap.
onDragUpdate:PointerDragCallback?—Called for every changed cell during capture, including the first movement.
onDragEnd:PointerDragCallback?—Called when the captured drag ends on button release.
onDragCancel:PointerTapCallback?—The captured drag was interrupted before release.
child:WidgetrequiredSubtree whose painted bounds form the interactive region.

GestureDetector is defined in packages/fleury/lib/src/widgets/pointer.dart.

Category: Input handling & focus · All widgets