Justin Xu
02/23/2023, 12:49 AMLazyColumn
displaying my UI elements, and sometimes the contents don't fill one entire screen. How would I detect if there is empty space and the size of that space between the last item
and the bottom of the screenephemient
02/23/2023, 4:04 AMval listState = rememberLazyListState()
LazyColumn(state = listState) {
// ...
}
val startEndSpace by snapshotFlow {
with(listState.layoutInfo) {
visibleItemsInfo.firstOrNull()?.takeIf { it.index == 0 }?.let { it.offset - viewportStartOffset } to
visibleItemsInfo.lastOrNull()?.takeIf { it.index == totalItemsCount - 1 }?.let {
viewportEndOffset - (it.offset + it.size)
}
}
}.collectAsState(initial = null to null)