Reputation: 309
I'm looking to implement a custom scroll physics for an infinite PageView
. My goal is to adjust the scrolling sensitivity dynamically based on the distance from the initial page. The behaviour I’m trying to achieve is:
class FastScrollPhysics extends PageScrollPhysics {
const FastScrollPhysics({super.parent});
@override
FastScrollPhysics applyTo(ScrollPhysics? ancestor) {
return FastScrollPhysics(parent: buildParent(ancestor));
}
@override
double applyPhysicsToUserOffset(ScrollMetrics position, double offset) {
final double scrollMultiplier = someCalculation; // Need help here
return offset *
scrollMultiplier;
}
}
Question:
Upvotes: 0
Views: 26