Alex
05/17/2021, 9:15 AMnestedScroll(...)
to create a collapsing toolbar (code in thread). However implementing it this way is disabling any flinging on the list. I am not sure why, because I am not consuming the Flings in my nested scroll, or do I? Will I have to reimplement flinging animations when using nested scrolling?Alex
05/17/2021, 9:15 AMmodifier = Modifier
.nestedScroll(
connection = object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
val scrollInDp = available.y / density
if (scrollInDp > 0 && state.value != 0)
return Offset.Zero
val newHeight = (headerHeight + scrollInDp)
.coerceIn(0f..maxHeaderHeight)
val consumed = newHeight - headerHeight
headerHeight = newHeight
return Offset(0f, consumed * density)
}
},
)
Alex Gabor
05/17/2021, 9:23 AMAlex
05/17/2021, 10:30 AMAlex
05/17/2021, 10:42 AMAlex Gabor
05/17/2021, 10:47 AMAlbert Chang
05/17/2021, 1:02 PMLeshan
01/19/2022, 3:42 PMAlbert Chang
01/19/2022, 6:12 PM