Andrei Kovalev
11/16/2021, 5:52 PMobject : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
totalScrolled -= available.y
}
if the list reaches the top and I keep scrolling up available.y
will still be positive therefore scrolling back to the initial position will not make totalScrolled
as 0Albert Chang
11/16/2021, 11:53 PMonPostScroll()
and accumulate `consumed.y`:
override fun onPostScroll(consumed: Offset, available: Offset, source: NestedScrollSource): Offset {
totalScrolled -= consumed.y
return Offset.Zero
}