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> {
}
Simulation _createFlingSimulation(double velocity) {
final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity);
final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance);
return scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity)
..tolerance = new Tolerance(velocity: endVelocity.abs(), distance: endDistance);
final Simulation simulation = scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity);
if (simulation != null) {
final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity);
final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance);
simulation.tolerance = new Tolerance(velocity: endVelocity.abs(), distance: endDistance);
}
return simulation;
}
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