setPixels method
Sets the scroll position to newPixels, clamped within valid bounds
And, returns the difference between the old and new scroll position.
Implementation
double setPixels(double newPixels) {
if (pixels != newPixels) {
final oldPixels = pixels;
final available = (extent - viewHeight).clamp(0.0, double.infinity);
pixels = newPixels.clamp(0, available);
return oldPixels - pixels;
}
return 0.0;
}