ForcePressGestureRecognizer constructor

ForcePressGestureRecognizer(
  1. {double startPressure = 0.4,
  2. double peakPressure = 0.85,
  3. GestureForceInterpolation interpolation = _inverseLerp,
  4. Object? debugOwner,
  5. Set<PointerDeviceKind>? supportedDevices,
  6. AllowedButtonsFilter? allowedButtonsFilter}
)

Creates a force press gesture recognizer.

The startPressure defaults to 0.4, and peakPressure defaults to 0.85 where a value of 0.0 is no pressure and a value of 1.0 is maximum pressure.

The startPressure, peakPressure and interpolation arguments must not be null. The peakPressure argument must be greater than startPressure. The interpolation callback must always return a value in the range 0.0 to 1.0 for values of pressure that are between pressureMin and pressureMax.

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

ForcePressGestureRecognizer({
  this.startPressure = 0.4,
  this.peakPressure = 0.85,
  this.interpolation = _inverseLerp,
  super.debugOwner,
  super.supportedDevices,
  super.allowedButtonsFilter,
}) : assert(peakPressure > startPressure);