Commit 7ebb6412 authored by Hans Muller's avatar Hans Muller

Only set tolerance if simulation is non-null

parent 640c609f
......@@ -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