Added two parameters to the onLeftSwipe and onRightSwipe callback functions: cardDeck and cardsSwiped. The purpose of the first parameter is to allow users of the package to modify the deck during the callback. One potential use case is described in issue #23, where a user wants to add new cards to the end of the deck dynamically. The second parameter allows users to access the number of cards swiped so far in this deck. This can be useful for determining the current index in the deck, as requested in issue #20. Here is a basic example of using both parameters:
onLeftSwipe: (Card card, List<Card> cardDeck, int cardsSwiped) {
// insert a new card into the back of the deck
cardDeck.insert(0, const Card(
color: Colors.black, child: SizedBox(height: 300, width: 200)),
);
// print the number of cards that have been swiped
debugPrint("Number of cards swiped: $cardsSwiped");
}
Since this is a breaking change, it will first be part of pre-release v2.0.0-dev.0.
Added two parameters to the
onLeftSwipe
andonRightSwipe
callback functions:cardDeck
andcardsSwiped
. The purpose of the first parameter is to allow users of the package to modify the deck during the callback. One potential use case is described in issue #23, where a user wants to add new cards to the end of the deck dynamically. The second parameter allows users to access the number of cards swiped so far in this deck. This can be useful for determining the current index in the deck, as requested in issue #20. Here is a basic example of using both parameters:Since this is a breaking change, it will first be part of pre-release v2.0.0-dev.0.
Resolves #20 Resolves #23