I have a `LazyColumn` displaying my UI elements, a...
# compose
j
I have a
LazyColumn
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 screen
e
something like
Copy code
val 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)