getMinChildIndexForScrollOffset method

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

The minimum child index that is visible at the given scroll offset.

This function is given the itemExtent as an argument to avoid recomputing itemExtent repeatedly during layout.

By default, returns a value consistent with the children being placed in order, without gaps, starting from layout offset zero.

Implementation

@protected
int getMinChildIndexForScrollOffset(double scrollOffset, double itemExtent) {
  return itemExtent > 0.0 ? math.max(0, scrollOffset ~/ itemExtent) : 0;
}