https://kotlinlang.org logo
p

Patrick Steiger

07/09/2023, 5:17 AM
Question on nestedScroll (
NestedScrollConnection
):
onPreFling
and
onPostFling
are suspend funs, I assume that's for calling suspending animation or scrolling API. Does that mean I should be cancelling the animation somehow when e.g. user scrolls during animation (`onPreScroll`\`onPostScroll`)? I'm having issues with material3 collapsing
TopBar
where quickly flinging in the opposite direction while previous fling is still running makes the toolbar quickly oscillate it's height, and I suspect that's because it is not cancelling the previous animation, so both run at the same time. I tested a naive impl of cancelling the animation on the scroll callbacks and it worked. I'm just not sure if it's a fundamental issue in its impl or in the
HorizontalPager
child impl.
7 Views