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

Excellent widget, but how to refresh deck? #28

Closed josephmaklc closed 2 years ago

josephmaklc commented 2 years ago

This is an excellent widget, swipe left and right to go to the next card... but at the bottom, there seems to be no way to reset. Is there an option to swipe left (or right) to put in bottom of deck again so it can be in a endless loop? (Great for something like children's flash cards app)

jushutch commented 2 years ago

Hi @josephmaklc, thank you for opening this issue and apologies for the delayed response! This functionality is possible using the prerelease v2.0.0-dev.0, which adds support for adding cards to a deck on left or right swipes. For an example, check out this comment that explains how to add a new card to the back of the deck: https://github.com/jushutch/swiping_card_deck/issues/23#issuecomment-1037829607. You'll want to do something similar, except you'll be adding the card that was just swiped to the back of the deck, which would look something like this:

onLeftSwipe: (Card card, List<Card> cardDeck, int cardsSwiped) {
  cardDeck.insert(0, card);
}

Check out the linked comment to learn more about the prerelease and how to use it. Let me know if I answered your question or if there's anything else I can do to help, thank you!

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: