getMaxChildIndexForScrollOffset method

  1. @protected
int getMaxChildIndexForScrollOffset(
  1. double scrollOffset,
  2. double itemExtent
)

Implementation

@protected
int getMaxChildIndexForScrollOffset(double scrollOffset, double itemExtent) {
  if (itemExtent > 0.0) {
    final double actual = scrollOffset / itemExtent - 1;
    final int round = actual.round();
    if (_isWithinPrecisionErrorTolerance(actual, round)) {
      return math.max(0, round);
    }
    return math.max(0, actual.ceil());
  }
  return 0;
}