gestures method

Widget gestures({
  1. Key? key,
  2. GestureOnTapChangeCallback? onTapChange,
  3. GestureTapDownCallback? onTapDown,
  4. GestureTapUpCallback? onTapUp,
  5. GestureTapCallback? onTap,
  6. GestureTapCancelCallback? onTapCancel,
  7. GestureTapDownCallback? onSecondaryTapDown,
  8. GestureTapUpCallback? onSecondaryTapUp,
  9. GestureTapCancelCallback? onSecondaryTapCancel,
  10. GestureTapCallback? onDoubleTap,
  11. GestureLongPressCallback? onLongPress,
  12. GestureLongPressStartCallback? onLongPressStart,
  13. GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate,
  14. GestureLongPressUpCallback? onLongPressUp,
  15. GestureLongPressEndCallback? onLongPressEnd,
  16. GestureDragDownCallback? onVerticalDragDown,
  17. GestureDragStartCallback? onVerticalDragStart,
  18. GestureDragUpdateCallback? onVerticalDragUpdate,
  19. GestureDragEndCallback? onVerticalDragEnd,
  20. GestureDragCancelCallback? onVerticalDragCancel,
  21. GestureDragDownCallback? onHorizontalDragDown,
  22. GestureDragStartCallback? onHorizontalDragStart,
  23. GestureDragUpdateCallback? onHorizontalDragUpdate,
  24. GestureDragEndCallback? onHorizontalDragEnd,
  25. GestureDragCancelCallback? onHorizontalDragCancel,
  26. GestureDragDownCallback? onPanDown,
  27. GestureDragStartCallback? onPanStart,
  28. GestureDragUpdateCallback? onPanUpdate,
  29. GestureDragEndCallback? onPanEnd,
  30. GestureDragCancelCallback? onPanCancel,
  31. GestureScaleStartCallback? onScaleStart,
  32. GestureScaleUpdateCallback? onScaleUpdate,
  33. GestureScaleEndCallback? onScaleEnd,
  34. GestureForcePressStartCallback? onForcePressStart,
  35. GestureForcePressPeakCallback? onForcePressPeak,
  36. GestureForcePressUpdateCallback? onForcePressUpdate,
  37. GestureForcePressEndCallback? onForcePressEnd,
  38. HitTestBehavior? behavior,
  39. bool excludeFromSemantics = false,
  40. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
})

手势

Implementation

Widget gestures({
  Key? key,
  GestureOnTapChangeCallback? onTapChange,
  GestureTapDownCallback? onTapDown,
  GestureTapUpCallback? onTapUp,
  GestureTapCallback? onTap,
  GestureTapCancelCallback? onTapCancel,
  GestureTapDownCallback? onSecondaryTapDown,
  GestureTapUpCallback? onSecondaryTapUp,
  GestureTapCancelCallback? onSecondaryTapCancel,
  GestureTapCallback? onDoubleTap,
  GestureLongPressCallback? onLongPress,
  GestureLongPressStartCallback? onLongPressStart,
  GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate,
  GestureLongPressUpCallback? onLongPressUp,
  GestureLongPressEndCallback? onLongPressEnd,
  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,
  GestureForcePressStartCallback? onForcePressStart,
  GestureForcePressPeakCallback? onForcePressPeak,
  GestureForcePressUpdateCallback? onForcePressUpdate,
  GestureForcePressEndCallback? onForcePressEnd,
  HitTestBehavior? behavior,
  bool excludeFromSemantics = false,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) =>
    GestureDetector(
      key: key,
      onTapDown: (TapDownDetails tapDownDetails) {
        if (onTapDown != null) onTapDown(tapDownDetails);
        if (onTapChange != null) onTapChange(true);
      },
      onTapCancel: () {
        if (onTapCancel != null) onTapCancel();
        if (onTapChange != null) onTapChange(false);
      },
      onTap: () {
        if (onTap != null) onTap();
        if (onTapChange != null) onTapChange(false);
      },
      onTapUp: onTapUp,
      onDoubleTap: onDoubleTap,
      onLongPress: onLongPress,
      onLongPressStart: onLongPressStart,
      onLongPressEnd: onLongPressEnd,
      onLongPressMoveUpdate: onLongPressMoveUpdate,
      onLongPressUp: onLongPressUp,
      onVerticalDragStart: onVerticalDragStart,
      onVerticalDragEnd: onVerticalDragEnd,
      onVerticalDragDown: onVerticalDragDown,
      onVerticalDragCancel: onVerticalDragCancel,
      onVerticalDragUpdate: onVerticalDragUpdate,
      onHorizontalDragStart: onHorizontalDragStart,
      onHorizontalDragEnd: onHorizontalDragEnd,
      onHorizontalDragCancel: onHorizontalDragCancel,
      onHorizontalDragUpdate: onHorizontalDragUpdate,
      onHorizontalDragDown: onHorizontalDragDown,
      onForcePressStart: onForcePressStart,
      onForcePressEnd: onForcePressEnd,
      onForcePressPeak: onForcePressPeak,
      onForcePressUpdate: onForcePressUpdate,
      onPanStart: onPanStart,
      onPanEnd: onPanEnd,
      onPanCancel: onPanCancel,
      onPanDown: onPanDown,
      onPanUpdate: onPanUpdate,
      onScaleStart: onScaleStart,
      onScaleEnd: onScaleEnd,
      onScaleUpdate: onScaleUpdate,
      behavior: behavior ?? HitTestBehavior.opaque,
      excludeFromSemantics: excludeFromSemantics,
      dragStartBehavior: dragStartBehavior,
      child: this,
    );