getMinChildIndexForScrollOffset method

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

Implementation

@protected
int getMinChildIndexForScrollOffset(double scrollOffset, double itemExtent) {
  if (itemExtent > 0.0) {
    final double actual = scrollOffset / itemExtent;
    final int round = actual.round();
    if ((actual - round).abs() < precisionErrorTolerance) {
      return round;
    }
    return actual.floor();
  }
  return 0;
}