LazyColumn(state = lazyListState,) {
item {}
item {}
stickyHeader{
stickState.value = lazyListState.firstVisibleItemIndex >= stickyItemIndex
//Some item in here
}
}
When using stickyHeader {}, how can I access the isSticky property? I tried firstVisibleItemIndex. Sometimes it's working. Sometimes not.I will use this state to make the divider in the header disappear. And I will use it to change the background of the stickyItem
I'm looking for guidance on how to determine if a particular item is sticky and use this information to customize its appearance based on whether it's sticky or not. If anyone has experience with this or can provide an example, I would greatly appreciate it.
UPDATE: We've realised I'm going to have to go about this in a different way. I'll share the solution if I can figure it out.
UPDATE 2: I show some items according to some conditions, so I was increasing the stickyHeaderIndex within these conditions. Because of recomposition, sometimes this index increases when it should not increase. When I gave a specific index, my problem was solved and it was as I wanted with stickyHeader.You can only find out if the stickyHeader is sticky by giving a specific index to stickyItemIndex in the following example
stickState.value = lazyListState.firstVisibleItemIndex >= stickyItemIndex