@Daniel Okanin then you probably want to create your own derived state which checks if there’s room to scroll backward (ie. the scroll state value is >0)
so something like:
val scrollState = rememberScrollState()
val canScrollBackward by remember {
derivedStateOf {
scrollState.value > 0
}
}
then in your back handler code you can simply check
if (canScrollBackward) { your scroll-to-top code } else { your dismiss code }
once you get that working you might even want to take it a little further and introduce some threshold, because if the user has scrolled a tiny bit (eg. only a few pixels) then they’re effectively still at the “top” already, but
canScrollBackward
will be true because the scroll state is >0, and so the behaviour might feel a bit strange to the user.. but I’ll leave that one up to you 😄