https://kotlinlang.org logo
Title
m

myanmarking

05/27/2022, 3:00 PM
is there a way to change LazyListState scroll behavior to work as a pager? I have a LazyColumn of cards (2/3 cards per screen), and i want each drag gesture to just scroll one card
I’m not using a pager because the card height is dynamic
l

Lucas Mo

05/27/2022, 3:10 PM
Is it not possible to make the pager height dynamic, too?
c

Colton Idle

05/27/2022, 3:29 PM
m

myanmarking

05/27/2022, 3:30 PM
snapping is different i think. It works on fling. I want to scroll the scroll when past each item a a time
c

Colton Idle

05/27/2022, 4:18 PM
do you mean the internal content of the card should be scrollable? I feel like maybe i have a misunderstanding of what you're trying to do
m

myanmarking

05/27/2022, 5:04 PM
Imagine a lazycolumn with 3 cards per screen height. When you do a quick scroll, the scroll stops at firstVisibleIndex +1 or -1 depending on direction
a

Afzal Najam

05/27/2022, 5:22 PM
Are you looking for VerticalPager in accompanist?
m

myanmarking

05/27/2022, 5:27 PM
Pagers have fixed height. Im not sure it would work but i can try
a

Afzal Najam

05/27/2022, 5:33 PM
Pager itself works with page/item indexes so maybe that code can be reused? I wonder what happens if this line is removed. Might or might not work 😄