scrollProgressX property

double get scrollProgressX

Horizontal scroll progress as a value between 0.0 and 1.0.

Returns 0.0 if there's no horizontal overflow.

Implementation

double get scrollProgressX {
  final scrollMax = max(0.0, contentSize.width - viewportSize.width);
  if (scrollMax == 0.0) {
    return 0.0;
  }
  return horizontal.pixels / scrollMax;
}
set scrollProgressX (double value)

Sets the horizontal scroll progress (0.0 to 1.0) instantly.

Implementation

set scrollProgressX(double value) {
  final scrollMax = max(0.0, contentSize.width - viewportSize.width);
  horizontal.jumpTo(value * scrollMax);
}