bnorm
05/09/2025, 9:06 PM@Composable
fun <T> Transition<T>.animateScroll(
scrollState: ScrollState,
transitionSpec: @Composable Transition.Segment<T>.() -> FiniteAnimationSpec<Int> = { spring() },
label: String = "ScrollAnimation",
targetValueByState: @Composable (state: T) -> Int,
) {
val scrollPosition by animateInt(transitionSpec, label, targetValueByState)
scrollState.dispatchRawDelta((scrollPosition - scrollState.value).toFloat())
}