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

SwipingDeck controller #29

Closed nanox77 closed 2 years ago

nanox77 commented 2 years ago

Hi, I'm wondering if there is a chance of add a swiping deck controller to manage SwipingDeck from outside. I mean, I have a stack of cards, so far so good but I can't swipe current card using a button. Thank you!

jushutch commented 2 years ago

Hi @nanox77, thank you for opening this issue and apologies for the delayed response! Have you tried using the exposed SwipingCardDeck.swipeLeft() and SwipingCardDeck.swipeRight() functions with buttons? Here's an example:

IconButton(
  icon: const Icon(Icons.clear),
  iconSize: 30,
  color: Colors.red,
  onPressed: deck.swipeLeft(),
)

Calling these functions should allow you to swipe cards right or left with buttons. Let me know if that works for you or if you need something more complex for your use case, I'm happy to help!

Teomayo commented 2 years ago

I used these functions with buttons and can successfully swipe right / left. If you give an example chunk of code I can possibly help @nanox77

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because there has not been a response in 14 days. It will be closed if no further activity occurs in the next 7 days. If the previous discussion resolved your issue, please close the issue. Thank you again for contributing! :smile:

stale[bot] commented 2 years ago

This issue has been awaiting a response for 21 days and will now be automatically closed. If this is an error, leave a comment explaining why this is an error. Thank you for your patience and understanding! :raised_hands: