Skip to content

Scrollable press-drag-release gestures unconditionally fling #5870

@HansMuller

Description

@HansMuller

ScrollableState currently handles drag release events by starting a scroll offset animation, even when the corresponding fling gesture's velocity is below the threshold:

 void _handleDragEnd(DragEndDetails details) {
    final double scrollVelocity = pixelDeltaToScrollOffset(details.velocity.pixelsPerSecond);
    fling(scrollVelocity).then((Null _) {
      _endScroll(details: details);
    });
  }

  Future<Null> fling(double scrollVelocity) {
    if (scrollVelocity.abs() > kPixelScrollTolerance.velocity || !_controller.isAnimating)
      return _startToEndAnimation(scrollVelocity);
    return new Future<Null>.value();
  }

The || !_controller.isAnimating expression causes the fling animation to be started even when the velocity is below threshold (unless there's scroll animation underway already).

Metadata

Metadata

Assignees

Labels

customer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.frameworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions