computeHitSlop function Null safety
- PointerDeviceKind kind,
- DeviceGestureSettings? settings
Determine the appropriate hit slop pixels based on the kind
of pointer.
Implementation
double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) {
switch (kind) {
case PointerDeviceKind.mouse:
return kPrecisePointerHitSlop;
case PointerDeviceKind.stylus:
case PointerDeviceKind.invertedStylus:
case PointerDeviceKind.unknown:
case PointerDeviceKind.touch:
default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind]
// TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604
return settings?.touchSlop ?? kTouchSlop;
}
}