Robert Malmling
03/15/2023, 2:19 PMLazyColumn
.
This is kind of the code I’m trying to achieve it with. Problem though is that snapshotFlow
is dropping emits when flinging the list fast.
LaunchedEffect(Unit) {
snapshotFlow { listState.layoutInfo.visibleItemsInfo }
.mapNotNull { it.firstOrNull { it.key == KEY_BIG_TITLE } }
.onEach { showTopBar = it.offset < 0}
.collect()
}
Dropped emits with this solution makes it a deal breaker in my case.
Does someone have any advice on an alternative way of doing it?Chris Sinco [G]
03/15/2023, 3:14 PMRobert Malmling
03/15/2023, 3:38 PMAlex Vanyo
03/15/2023, 5:22 PMfirstVisibleItemIndex
and firstVisibleItemScrollOffset
?
That will probably be a more robust solution in general, since right now you’re assuming that at some point you’ll see the KEY_BIG_TITLE
item.
Maybe you’re super far past that item, then your device rotates and your Activity is recreated, and your list scroll position is restored far past the title.Robert Malmling
03/16/2023, 8:14 AMMaybe you’re super far past that item, then your device rotatesyes that feels like an issue. Your suggestion sounds good! I’ll give that a go! :thank-you:
shikasd
03/18/2023, 2:28 AM