getMaxChildIndexForScrollOffset method

  1. @override
int getMaxChildIndexForScrollOffset (double scrollOffset, double itemExtent)

The maximum 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.


int getMaxChildIndexForScrollOffset(double scrollOffset, double itemExtent) {
  return super.getMaxChildIndexForScrollOffset(math.max(scrollOffset - _padding, 0.0), itemExtent);