Is there a way by which I can log an event when scrolling in a Column? I made it scrollable, saved the scroll state, but I can't find where to call a lambda function given as param to composable onScroll: () -> Unit
You can observe the scrollState:
val scrollState = rememberScrollState()
Column(
modifier = Modifier
.verticalScroll(scrollState)
)
You can check the value of this scrollState:
if (scrollState.isScrollInProgress){
println("scrolling")
}
In case you need to wait for the scroll is completed, you can use if + DisposableEffect:
if (scrollState.isScrollInProgress) {
DisposableEffect(Unit) {
onDispose {
println("scroll completed")
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With