LongPressGestureRecognizer constructor Null safety

LongPressGestureRecognizer(
  1. {Duration? duration,
  2. double? postAcceptSlopTolerance,
  3. @Deprecated('Migrate to supportedDevices. ' 'This feature was deprecated after v2.3.0-1.0.pre.') PointerDeviceKind? kind,
  4. Set<PointerDeviceKind>? supportedDevices,
  5. Object? debugOwner}
)

Creates a long-press gesture recognizer.

Consider assigning the onLongPressStart callback after creating this object.

The postAcceptSlopTolerance argument can be used to specify a maximum allowed distance for the gesture to deviate from the starting point once the long press has triggered. If the gesture deviates past that point, subsequent callbacks (onLongPressMoveUpdate, onLongPressUp, onLongPressEnd) will stop. Defaults to null, which means the gesture can be moved without limit once the long press is accepted.

The duration argument can be used to overwrite the default duration after which the long press will be recognized.

It's possible to limit this recognizer to a specific set of PointerDeviceKinds by providing the optional supportedDevices argument. If supportedDevices is null, the recognizer will accept pointer events from all device kinds.

Implementation

LongPressGestureRecognizer({
  Duration? duration,
  double? postAcceptSlopTolerance,
  @Deprecated(
    'Migrate to supportedDevices. '
    'This feature was deprecated after v2.3.0-1.0.pre.',
  )
  PointerDeviceKind? kind,
  Set<PointerDeviceKind>? supportedDevices,
  Object? debugOwner,
}) : super(
       deadline: duration ?? kLongPressTimeout,
       postAcceptSlopTolerance: postAcceptSlopTolerance,
       kind: kind,
       supportedDevices: supportedDevices,
       debugOwner: debugOwner,
     );