Given a ListView, which is scrolled by some offset, how do I know the index number of the first and last items currently in view?
I have tried this:
class MySliverChildBuilderDelegate extends SliverChildBuilderDelegate {
MySliverChildBuilderDelegate(IndexedWidgetBuilder builder, {int childCount})
: super(builder, childCount: childCount);
@override
void didFinishLayout(int firstIndex, int lastIndex) {
print("firstIndex = $firstIndex / lastIndex = $lastIndex");
}
}
And then:
SliverChildBuilderDelegate childrenDelegate =
MySliverChildBuilderDelegate(itemBuilder, childCount: childCount);
ListView.custom(
controller: _controller,
childrenDelegate: childrenDelegate));
But those firstIndex and lastIndex are not actually what I though they were...