private val LazyListState.atLeastHalfVisibleItems get() = layoutInfo .visibleItemsInfo .filter { val startEdge = maxOf(0, layoutInfo.viewportStartOffset - it.offset) val endEdge = maxOf(0, it.offset + it.size - layoutInfo.viewportEndOffset) return@filter startEdge + endEdge < it.size / 2 }.map { it.index }
Get the indexes in list of all items which have more than half showing.