getMaxChildIndexForScrollOffset method

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

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

This function uses the returned value of itemExtentBuilder or the itemExtent to avoid recomputing item size repeatedly during layout.

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

Implementation

@override
int getMaxChildIndexForScrollOffset(double scrollOffset, double itemExtent) {
  // itemExtent is deprecated in the super class, we ignore it because we use
  // the builder anyways.
  return _getChildIndexForScrollOffset(scrollOffset);
}