getGestureCallbackMap static method

Map<GestureType, Function> getGestureCallbackMap({
  1. required GestureTapDownCallback? onTapDown,
  2. required GestureTapUpCallback? onTapUp,
  3. required GestureLongPressStartCallback? onLongPressStart,
  4. required GestureLongPressEndCallback? onLongPressEnd,
  5. required GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate,
  6. required GestureForcePressStartCallback? onForcePressStart,
  7. required GestureForcePressEndCallback? onForcePressEnd,
  8. required GestureForcePressPeakCallback? onForcePressPeak,
  9. required GestureForcePressUpdateCallback? onForcePressUpdate,
  10. required GestureDragStartCallback? onPanStart,
  11. required GestureDragUpdateCallback? onPanUpdate,
  12. required GestureDragDownCallback? onPanDown,
  13. required GestureTapDownCallback? onSecondaryTapDown,
  14. required GestureTapUpCallback? onSecondaryTapUp,
})

Implementation

static Map<GestureType, Function> getGestureCallbackMap({
  required GestureTapDownCallback? onTapDown,
  required GestureTapUpCallback? onTapUp,
  required GestureLongPressStartCallback? onLongPressStart,
  required GestureLongPressEndCallback? onLongPressEnd,
  required GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate,
  required GestureForcePressStartCallback? onForcePressStart,
  required GestureForcePressEndCallback? onForcePressEnd,
  required GestureForcePressPeakCallback? onForcePressPeak,
  required GestureForcePressUpdateCallback? onForcePressUpdate,
  required GestureDragStartCallback? onPanStart,
  required GestureDragUpdateCallback? onPanUpdate,
  required GestureDragDownCallback? onPanDown,
  required GestureTapDownCallback? onSecondaryTapDown,
  required GestureTapUpCallback? onSecondaryTapUp,
}) {
  var map = <GestureType, Function>{};

  if (onTapDown != null) {
    map.putIfAbsent(GestureType.onTapDown, () => onTapDown);
  }
  if (onTapUp != null) map.putIfAbsent(GestureType.onTapUp, () => onTapUp);

  if (onLongPressStart != null) {
    map.putIfAbsent(GestureType.onLongPressStart, () => onLongPressStart);
  }
  if (onLongPressMoveUpdate != null) {
    map.putIfAbsent(
        GestureType.onLongPressMoveUpdate, () => onLongPressMoveUpdate);
  }
  if (onLongPressEnd != null) {
    map.putIfAbsent(GestureType.onLongPressEnd, () => onLongPressEnd);
  }

  if (onForcePressStart != null) {
    map.putIfAbsent(GestureType.onForcePressStart, () => onForcePressStart);
  }
  if (onForcePressEnd != null) {
    map.putIfAbsent(GestureType.onForcePressEnd, () => onForcePressEnd);
  }
  if (onForcePressUpdate != null) {
    map.putIfAbsent(GestureType.onForcePressUpdate, () => onForcePressUpdate);
  }
  if (onForcePressPeak != null) {
    map.putIfAbsent(GestureType.onForcePressPeak, () => onForcePressPeak);
  }

  if (onPanStart != null) {
    map.putIfAbsent(GestureType.onPanStart, () => onPanStart);
  }
  if (onPanUpdate != null) {
    map.putIfAbsent(GestureType.onPanUpdate, () => onPanUpdate);
  }
  if (onPanDown != null) {
    map.putIfAbsent(GestureType.onPanDown, () => onPanDown);
  }

  if (onSecondaryTapDown != null) {
    map.putIfAbsent(GestureType.onSecondaryTapDown, () => onSecondaryTapDown);
  }
  if (onSecondaryTapUp != null) {
    map.putIfAbsent(GestureType.onSecondaryTapUp, () => onSecondaryTapUp);
  }

  return map;
}