wrapForLongPress static method

GestureLongPressCallback? wrapForLongPress(
  1. GestureLongPressCallback? callback,
  2. BuildContext context
)

Wraps a GestureLongPressCallback to provide platform specific feedback for a long press before the provided callback is executed.

On Android the platform-typical vibration is triggered. On iOS this is a no-op as that platform usually doesn't provide feedback for a long press.

See also:

Implementation

static GestureLongPressCallback? wrapForLongPress(GestureLongPressCallback? callback, BuildContext context) {
  if (callback == null) {
    return null;
  }
  return () {
    Feedback.forLongPress(context);
    callback();
  };
}