diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 4597687387..77e8beb2bc 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -374,7 +374,7 @@ class _TabsScrollBehavior extends BoundedBehavior { bool isScrollable = true; - Simulation createFlingScrollSimulation(double position, double velocity) { + Simulation createScrollSimulation(double position, double velocity) { if (!isScrollable) return null; diff --git a/packages/flutter/lib/src/widgets/scroll_behavior.dart b/packages/flutter/lib/src/widgets/scroll_behavior.dart index 1d108a2e55..01228d2931 100644 --- a/packages/flutter/lib/src/widgets/scroll_behavior.dart +++ b/packages/flutter/lib/src/widgets/scroll_behavior.dart @@ -19,7 +19,7 @@ abstract class ScrollBehavior { /// This function is called when a drag gesture ends. /// /// Returns null if the behavior is to do nothing. - Simulation createFlingScrollSimulation(T position, U velocity) => null; + Simulation createScrollSimulation(T position, U velocity) => null; /// Returns an animation that ends at the snap offset. /// @@ -129,7 +129,7 @@ class BoundedBehavior extends ExtentScrollBehavior { } } -Simulation _createFlingScrollSimulation(double position, double velocity, double minScrollOffset, double maxScrollOffset) { +Simulation _createScrollSimulation(double position, double velocity, double minScrollOffset, double maxScrollOffset) { final double startVelocity = velocity * _kSecondsPerMillisecond; final SpringDescription spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1); return new ScrollSimulation(position, startVelocity, minScrollOffset, maxScrollOffset, spring, _kScrollDrag); @@ -145,7 +145,7 @@ class UnboundedBehavior extends ExtentScrollBehavior { UnboundedBehavior({ double contentExtent: 0.0, double containerExtent: 0.0 }) : super(contentExtent: contentExtent, containerExtent: containerExtent); - Simulation createFlingScrollSimulation(double position, double velocity) { + Simulation createScrollSimulation(double position, double velocity) { double velocityPerSecond = velocity * 1000.0; return new BoundedFrictionSimulation( _kScrollDrag, position, velocityPerSecond, double.NEGATIVE_INFINITY, double.INFINITY @@ -169,8 +169,8 @@ class OverscrollBehavior extends BoundedBehavior { OverscrollBehavior({ double contentExtent: 0.0, double containerExtent: 0.0, double minScrollOffset: 0.0 }) : super(contentExtent: contentExtent, containerExtent: containerExtent, minScrollOffset: minScrollOffset); - Simulation createFlingScrollSimulation(double position, double velocity) { - return _createFlingScrollSimulation(position, velocity, minScrollOffset, maxScrollOffset); + Simulation createScrollSimulation(double position, double velocity) { + return _createScrollSimulation(position, velocity, minScrollOffset, maxScrollOffset); } Simulation createSnapScrollSimulation(double startOffset, double endOffset, double startVelocity, double endVelocity) { @@ -201,9 +201,9 @@ class OverscrollWhenScrollableBehavior extends OverscrollBehavior { bool get isScrollable => contentExtent > containerExtent; - Simulation createFlingScrollSimulation(double position, double velocity) { + Simulation createScrollSimulation(double position, double velocity) { if (isScrollable || position < minScrollOffset || position > maxScrollOffset) - return super.createFlingScrollSimulation(position, velocity); + return super.createScrollSimulation(position, velocity); return null; } diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index 0c2925bc00..d4b3575dea 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -439,7 +439,7 @@ abstract class ScrollableState extends State { } Simulation _createFlingSimulation(double scrollVelocity) { - final Simulation simulation = scrollBehavior.createFlingScrollSimulation(scrollOffset, scrollVelocity); + final Simulation simulation = scrollBehavior.createScrollSimulation(scrollOffset, scrollVelocity); if (simulation != null) { final double endVelocity = pixelOffsetToScrollOffset(kPixelScrollTolerance.velocity).abs() * (scrollVelocity < 0.0 ? -1.0 : 1.0); final double endDistance = pixelOffsetToScrollOffset(kPixelScrollTolerance.distance).abs();