getPageFromPixels method

double getPageFromPixels(
  1. double pixels,
  2. double viewportDimension
)

Implementation

double getPageFromPixels(double pixels, double viewportDimension) {
  final double actual = math.max(0.0, pixels - _initialPageOffset) /
      math.max(1.0, viewportDimension * viewportFraction);
  final double round = actual.roundToDouble();
  if ((actual - round).abs() < precisionErrorTolerance) {
    return round;
  }
  return actual;
}