goBallistic method
Start a physics-driven simulation that settles the pixels position, starting at a particular velocity.
This method defers to ScrollPhysics.createBallisticSimulation, which typically provides a bounce simulation when the current position is out of bounds and a friction simulation when the position is in bounds but has a non-zero velocity.
The velocity should be in logical pixels per second.
Implementation
@override
void goBallistic(double velocity) {
if (sheetPosition.preventingDrag) {
goIdle();
return;
}
if (sheetPosition.hasContentDimensions) {
sheetPosition.goBallistic(velocity);
}
if (velocity > 0.0 &&
sheetPosition.pixels >= sheetPosition.maxScrollExtent ||
(velocity < 0.0 && pixels > 0)) {
super.goBallistic(velocity);
return;
} else if (outOfRange) {
beginActivity(
BallisticScrollActivity(
this,
ScrollSpringSimulation(
SpringDescription.withDampingRatio(
mass: 0.5,
stiffness: 100.0,
ratio: 1.1,
),
pixels,
0,
velocity,
),
context.vsync,
true,
),
);
return;
} else {
goIdle();
return;
}
}