diff --git a/packages/flutter/lib/src/widgets/pageable_list.dart b/packages/flutter/lib/src/widgets/pageable_list.dart index aa8f38b860..7a27da4d2f 100644 --- a/packages/flutter/lib/src/widgets/pageable_list.dart +++ b/packages/flutter/lib/src/widgets/pageable_list.dart @@ -131,11 +131,19 @@ class PageableListState> extends ScrollableSta ); } - ScrollBehavior createScrollBehavior() { - return config.itemsWrap ? new UnboundedBehavior() : new OverscrollBehavior(); + UnboundedBehavior _unboundedBehavior; + OverscrollBehavior _overscrollBehavior; + + ExtentScrollBehavior get scrollBehavior { + if (config.itemsWrap) { + _unboundedBehavior ??= new UnboundedBehavior(); + return _unboundedBehavior; + } + _overscrollBehavior ??= new OverscrollBehavior(); + return _overscrollBehavior; } - ExtentScrollBehavior get scrollBehavior => super.scrollBehavior; + ScrollBehavior createScrollBehavior() => scrollBehavior; bool get snapScrollOffsetChanges => config.itemsSnapAlignment == ItemsSnapAlignment.item; diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index bc2d960ba9..51251a768e 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -197,18 +197,6 @@ abstract class ScrollableState extends State { } Simulation _createFlingSimulation(double velocity) { - /* - // Assume that we're rendering at atleast 15 FPS. Stop when we're - // scrolling less than one logical pixel per frame. We're essentially - // normalizing by the devicePixelRatio so that the threshold has the - // same effect independent of the device's pixel density. - double endVelocity = pixelToScrollOffset(15.0 * ui.window.devicePixelRatio); - - // Similar to endVelocity. Stop scrolling when we're this close to - // destiniation scroll offset. - double endDistance = pixelToScrollOffset(0.5 * ui.window.devicePixelRatio); - */ - final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity); final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance); return scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity)