getMaxChildIndexForScrollOffset method

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

The maximum child index that intersects with (or is before) this scroll offset.

Implementation

@override
int getMaxChildIndexForScrollOffset(double scrollOffset) {
  if (mainAxisStride > 0.0) {
    final int mainAxisCount = (scrollOffset / mainAxisStride).ceil();
    return math.max(0, crossAxisCount * mainAxisCount - 1);
  }
  return 0;
}