end method

  1. @override
void end (DragEndDetails details)
override

The pointer is no longer in contact with the screen.

The velocity at which the pointer was moving when it stopped contacting the screen is available in the details.

Implementation

@override
void end(DragEndDetails details) {
  assert(details.primaryVelocity != null);
  // We negate the velocity here because if the touch is moving downwards,
  // the scroll has to move upwards. It's the same reason that update()
  // above negates the delta before applying it to the scroll offset.
  double velocity = -details.primaryVelocity;
  if (_reversed) // e.g. an AxisDirection.up scrollable
    velocity = -velocity;
  _lastDetails = details;

  // Build momentum only if dragging in the same direction.
  if (_retainMomentum && velocity.sign == carriedVelocity.sign)
    velocity += carriedVelocity;
  delegate.goBallistic(velocity);
}