Skip to content

The Scrollable snapOffset() callback could allow snapping "back" #6427

@HansMuller

Description

@HansMuller

Currently, if a Scrollable's snapOffsetCallback() returns a value that effectively reverses the fling's direction, the fling simulation asserts. For applications using the snapOffsetCallback() to scroll to page boundaries, it would be useful to allow the callback's value to reverse the fling's direction.

I/flutter : ══╡ EXCEPTION CAUGHT BY GESTURE LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter : The following assertion was thrown while routing a pointer event:
I/flutter : 'package:flutter/src/physics/friction_simulation.dart': Failed assertion: line 39 pos 12:
I/flutter : 'startVelocity == 0.0 || endVelocity == 0.0 || startVelocity.sign == endVelocity.sign' is not true.
I/flutter : When the exception was thrown, this was the stack:
I/flutter : #2      FrictionSimulation.FrictionSimulation.through (package:flutter/src/physics/friction_simulation.dart:39:12)
I/flutter : #3      _createSnapScrollSimulation (package:flutter/src/widgets/scroll_behavior.dart:16:14)
I/flutter : #4      OverscrollBehavior.createSnapScrollSimulation (package:flutter/src/widgets/scroll_behavior.dart:257:12)
I/flutter : #5      ScrollableState._createSnapSimulation (package:flutter/src/widgets/scrollable.dart:622:50)
I/flutter : #6      ScrollableState._startToEndAnimation (package:flutter/src/widgets/scrollable.dart:587:19)
I/flutter : #7      ScrollableState.fling (package:flutter/src/widgets/scrollable.dart:564:14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityf: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions