dispatchEndGesture method

void dispatchEndGesture(
  1. double? velocity,
  2. GestureDirection direction
)

Dispatches a new EndGesture determined by the given velocity and direction.

Implementation

void dispatchEndGesture(double? velocity, GestureDirection direction) {
  final isScrollingIntoDisabledEndActionPane = enableStartActionPane &&
      !enableEndActionPane &&
      this.direction.value == 0 &&
      direction == GestureDirection.closing;
  final isScrollingIntoDisabledStartActionPane = !enableStartActionPane &&
      enableEndActionPane &&
      this.direction.value == 0 &&
      direction == GestureDirection.opening;
  final isScrollingIntoDisabledPane = isScrollingIntoDisabledEndActionPane ||
      isScrollingIntoDisabledStartActionPane;

  if (isScrollingIntoDisabledPane) {
    return;
  }

  if (velocity == 0 || velocity == null) {
    endGesture.value = StillGesture(direction);
  } else if (velocity.sign == this.direction.value) {
    endGesture.value = OpeningGesture(velocity);
  } else {
    endGesture.value = ClosingGesture(velocity.abs());
  }

  // If the movement is too fast, the actionPaneConfigurator may still be
  // null. So we have to replay the end gesture when it will not be null.
  if (actionPaneConfigurator == null) {
    _replayEndGesture = true;
  }
}