julioromano
03/24/2021, 2:18 PMLazyListState
type whilst composables that scroll using modifiers hold scroll state in the ScrollState
type.
Even though both types implement ScrollableState
the way they expose the current scroll position differs:
LazyListState
exposes firstVisibleItemIndex
and firstVisibleItemScrollOffset
for this purpose, while ScrollState
exposes value
instead.
This is making it more difficult to implement a generic solution that works with both e.g. a LazyColumn
and a Column
which uses the verticalScroll
modifier.
In case you’re wondering what I’d like to accomplish you’ll find more info in the thread.julioromano
03/24/2021, 2:18 PMScaffold
depending on whether its main content
has been scrolled all the way to the top or not.
I managed to do that by hoisting the `LazyColumn`'s LazyListState
up into the Scaffold
but I'd like a generic solution that works for any scrollable composable that could be hosted in the Scaffold's content. Do you think it's possible?julioromano
03/24/2021, 2:20 PMAlbert Chang
03/24/2021, 2:31 PMonPostScroll
when there's offset available in a downwards scroll, and decrease it in onPreScroll
when it's a upwards scroll.julioromano
03/24/2021, 3:03 PMTimo Drick
03/24/2021, 4:58 PMjulioromano
03/24/2021, 5:01 PM