I’m having trouble adding pagination to my SearchableDropdown. I tried implementing it in a similar way to my LazyColumn:
LaunchedEffect(listState, items.size, isLoadingMore) { snapshotFlow { listState.layoutInfo.visibleItemsInfo .lastOrNull { it.index < items.size } ?.index } .filterNotNull() .collect { lastVisibleItem -> Timber.tag("MyLazyColumn") .d("lastVisibleItem: $lastVisibleItem") val isNearEnd = items.size - lastVisibleItem <= loadMoreThresholdItemIndex if (!disablePaging && items.size > loadMoreThresholdItemIndex && isNearEnd && !isLoadingMore) { onLoadMore() } } }
Unfortunately, ExposedDropdownMenu only provides a regular ScrollState.
I tried using scrollState.value, but it only gives me the scroll offset in pixels.
Is there an equivalent of listState.layoutInfo.visibleItemsInfo for ScrollState that would let me determine the index of the last visible menu item?
If there is no equivalent, what would be a clean way to implement this using pixel-based scroll offsets?