Hristijan
08/23/2023, 11:22 AMTobias Suchalla
08/23/2023, 1:41 PMval scrollState = rememberScrollState()
val showScrollbar by scrollState.scrollingNeeded
Column(Modifier.verticalScroll(scrollState)) {
...
}
if (showScrollbar) {
VerticalScrollBar(...)
}
val ScrollState.scrollingNeeded get() = derivedStateOf {
maxValue > 0 && maxValue < Int.MAX_VALUE
}
ScrollState.maxValue
seems to represent the missing space to show all content, i.e. it is greater than 0 when the viewport is too small (and Int.MAX_VALUE when still unkown).Hristijan
08/23/2023, 2:07 PMval scrollState = rememberScrollState()
val canScroll= (scrollState.canScrollForward || scrollState.canScrollBackward)