didStopTrackingLastPointer method

  1. @override
void didStopTrackingLastPointer(
  1. int pointer
)
override

Called when the number of pointers this recognizer is tracking changes from one to zero.

The given pointer ID is the ID of the last pointer this recognizer was tracking.

Implementation

@override
void didStopTrackingLastPointer(int pointer) {
  final bool wasAccepted = _state == _ForceState.started || _state == _ForceState.peaked;
  if (_state == _ForceState.possible) {
    resolve(GestureDisposition.rejected);
    return;
  }
  if (wasAccepted && onEnd != null) {
    if (onEnd != null) {
      invokeCallback<void>('onEnd', () => onEnd!(ForcePressDetails(
        pressure: 0.0,
        globalPosition: _lastPosition.global,
        localPosition: _lastPosition.local,
      )));
    }
  }
  _state = _ForceState.ready;
}