Commit 81ab91a6 authored by Hans Muller's avatar Hans Muller

Merge pull request #914 from HansMuller/null_fling_simulation

Only set tolerance if simulation is non-null

Fixes #898
parents 2da6b175 7ebb6412
...@@ -197,10 +197,13 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -197,10 +197,13 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
} }
Simulation _createFlingSimulation(double velocity) { Simulation _createFlingSimulation(double velocity) {
final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity); final Simulation simulation = scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity);
final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance); if (simulation != null) {
return scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity) final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity);
..tolerance = new Tolerance(velocity: endVelocity.abs(), distance: endDistance); final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance);
simulation.tolerance = new Tolerance(velocity: endVelocity.abs(), distance: endDistance);
}
return simulation;
} }
double snapScrollOffset(double value) { double snapScrollOffset(double value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment