Currently I'm showing a
CustomScrollView
inside a bottomSheet.
CustomScrollView(
controller: scrollController,
slivers: [
SliverPersistentHeader(
pinned: true,
delegate: MonthViewHeader(widget.weekDays),
),
SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
return MonthView(
index == 0 ? widget._today : Jalali(widget._today.year, widget._today.month, 1).addMonths(index),
index != 0,
selectedDate,
(DateTime date) => {
setSheetState(() {
selectedDate = date;
widget.onDateChange(date);
})
});
}),
)
],
)
SliverPersistentHeader
stays on top of the list on scroll and SliverList
scrolls beneath it.
I want to check which item index is being entered/exited view on scroll. I want to know that so I can change my SliverPersistentHeader
text.
One approach would be to calculate scrollOffset and give each item static height.
But that's not very optimal since item 0 of SilverList
might have a smaller height so I can give it fixed height.
Is there any way to detect item entering/exiting view inside SilverList
?