diff --git a/packages/flutter/lib/src/widgets/scroll_physics.dart b/packages/flutter/lib/src/widgets/scroll_physics.dart index 05da9cba00c7..0d7db82e1d86 100644 --- a/packages/flutter/lib/src/widgets/scroll_physics.dart +++ b/packages/flutter/lib/src/widgets/scroll_physics.dart @@ -629,7 +629,10 @@ class BouncingScrollPhysics extends ScrollPhysics { @override BouncingScrollPhysics applyTo(ScrollPhysics? ancestor) { - return BouncingScrollPhysics(parent: buildParent(ancestor)); + return BouncingScrollPhysics( + parent: buildParent(ancestor), + decelerationRate: decelerationRate + ); } /// The multiple applied to overscroll to make it appear that scrolling past diff --git a/packages/flutter/test/widgets/scroll_physics_test.dart b/packages/flutter/test/widgets/scroll_physics_test.dart index 832c779da3fc..91c42aa937e6 100644 --- a/packages/flutter/test/widgets/scroll_physics_test.dart +++ b/packages/flutter/test/widgets/scroll_physics_test.dart @@ -65,6 +65,7 @@ void main() { const ScrollPhysics never = NeverScrollableScrollPhysics(); const ScrollPhysics always = AlwaysScrollableScrollPhysics(); const ScrollPhysics page = PageScrollPhysics(); + const ScrollPhysics bounceDesktop = BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast); String types(ScrollPhysics? value) => value!.parent == null ? '${value.runtimeType}' : '${value.runtimeType} ${types(value.parent)}'; @@ -92,6 +93,11 @@ void main() { types(page.applyTo(bounce.applyTo(clamp.applyTo(never.applyTo(always))))), 'PageScrollPhysics BouncingScrollPhysics ClampingScrollPhysics NeverScrollableScrollPhysics AlwaysScrollableScrollPhysics', ); + + expect( + bounceDesktop.applyTo(always), + (BouncingScrollPhysics x) => x.decelerationRate == ScrollDecelerationRate.fast + ); }); test("ScrollPhysics scrolling subclasses - Creating the simulation doesn't alter the velocity for time 0", () {