commitExternalDragEnd method

void commitExternalDragEnd(
  1. double velocity
)

End an external drag with velocity (px/s). Evaluates dismiss-vs-snap-back identically to the carrier's own release.

Implementation

void commitExternalDragEnd(double velocity) {
  if (!_dragging) return;
  _dragging = false;
  final viewport = MediaQuery.sizeOf(context);
  final distanceThreshold = viewport.height / 4;
  final shouldDismiss =
      velocity.abs() > kGalleryDismissVelocity ||
      _drag.value.abs() > distanceThreshold;
  if (shouldDismiss) {
    _commitDismiss();
  } else {
    _animateSnapBack(velocity);
  }
}