Unverified Commit 3fe77942 authored by Callum Moffat's avatar Callum Moffat Committed by GitHub

BouncingScrollPhysics should propagate decelerationRate. (#115797)

parent 0d7a3b7f
...@@ -629,7 +629,10 @@ class BouncingScrollPhysics extends ScrollPhysics { ...@@ -629,7 +629,10 @@ class BouncingScrollPhysics extends ScrollPhysics {
@override @override
BouncingScrollPhysics applyTo(ScrollPhysics? ancestor) { 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 /// The multiple applied to overscroll to make it appear that scrolling past
......
...@@ -65,6 +65,7 @@ void main() { ...@@ -65,6 +65,7 @@ void main() {
const ScrollPhysics never = NeverScrollableScrollPhysics(); const ScrollPhysics never = NeverScrollableScrollPhysics();
const ScrollPhysics always = AlwaysScrollableScrollPhysics(); const ScrollPhysics always = AlwaysScrollableScrollPhysics();
const ScrollPhysics page = PageScrollPhysics(); 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)}'; String types(ScrollPhysics? value) => value!.parent == null ? '${value.runtimeType}' : '${value.runtimeType} ${types(value.parent)}';
...@@ -92,6 +93,11 @@ void main() { ...@@ -92,6 +93,11 @@ void main() {
types(page.applyTo(bounce.applyTo(clamp.applyTo(never.applyTo(always))))), types(page.applyTo(bounce.applyTo(clamp.applyTo(never.applyTo(always))))),
'PageScrollPhysics BouncingScrollPhysics ClampingScrollPhysics NeverScrollableScrollPhysics AlwaysScrollableScrollPhysics', '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", () { test("ScrollPhysics scrolling subclasses - Creating the simulation doesn't alter the velocity for time 0", () {
......
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