Hukumister / LazyCardStack

Tinder like card stack for compose
84 stars 7 forks source link

Cannot swipe last item #5

Closed lnbs97 closed 3 months ago

lnbs97 commented 9 months ago

When trying to swipe the last item it always snaps back to center. Is this intended behaviour?

charlee-dev commented 9 months ago

What do you expect to happen? To see an empty screen after swiping?

I use sort of paging to fetch more items if my stack is nearly empty, and if i manage to get to the end, i show a different card with a message that you ran out and a button to set different filters.

lnbs97 commented 9 months ago

Yes thats what I would expect. I wanted to display some non-swipeable elements behind the CardStack.

But now I found out about Modifier.dragEnabled(false) which lets me achieve that with your approach.

Maybe being able to swipe the last element would be more straightforward though.

Hukumister commented 7 months ago

I'm not sure adding the ability to swipe to the last item is a good idea. For example, if you have a list with one element, you cannot scroll it any further. A stack of cards is a similar list, but it’s like you’re not scrolling down, but in the z plane. So if you want to swipe the last element you should set a non-swipable placeholder at the end with loading or some other information for the user.