BouncingScrollPhysics should propagate decelerationRate. (#115797)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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", () {
|
||||
|
||||
Reference in New Issue
Block a user