jushutch / swiping_card_deck

A widget for swiping through a deck of cards with gestures or buttons.
https://pub.dev/packages/swiping_card_deck
BSD 3-Clause "New" or "Revised" License
13 stars 10 forks source link

Text/Asset Rendering During Swipe #32

Open Teomayo opened 2 years ago

Teomayo commented 2 years ago

Before posting your question :heavy_check_mark:

Question: Is there a simple way to have text display while swiping on top of the card being swiped?

Hey, I was wondering if there is a simple way to have text display while swiping on top of the card being swiped? I am newer to flutter and it seems like this could be possible using the onLeftSwipe/onRightSwipe functions and using callbacks but I am wondering if this would only display on swipe completion and wouldn't allow for rendering of text or image during the swipe action. If you have any thoughts on this it would be greatly appreciated. Love the package compared to some of the other swiping stack options!

Teomayo commented 2 years ago

Maybe this could be exposed as an additional option in the SwipingGestureDetector class specifically within the GestureDetector. My workaround would probably require using the gesture detector class wrapped around my image, which unfortunately conflicts with the detection within the SwipingDeck class.

jushutch commented 2 years ago

Hi @Teomayo, thank you for opening this issue, apologies for the delayed response! I've actually been thinking about solutions to this since you asked. My first suggestion is to try using a Stack widget with your text overlayed on top of the SwipingCardDeck widget, although I'm going to look into this myself to make sure the gesture detector still works in a Stack. Your idea is also worth investigating and something I've considered before, so I'll do some research and revisit the idea. In the meantime, feel free to open a pull request with any changes that make this work for you (there's some pull request tips and guidance in CONTRIBUTING.md). Thanks again for contributing, I'll try to get this issue resolved as soon as possible!

wtoalabi commented 1 year ago

@jushutch I would suggest you expose a listener when the card starts moving, with threshold markers.

We can then note when the card reaches a certain threshold and display our content (text, icon, etc)

I think this is what Bumble are doing.

When user moves the card, before it is released, an icon displays as an overlay, on the stack.

Thanks and awesome job!!!