You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to show the previous Card on SwipeDown or Swipe left. The example application is always showing the next Card on whatever direction you swipe. The undo button works as expected but I can not do it on swipe.
I tried this way
bool _onSwipe(
int previousIndex,
int? currentIndex,
CardSwiperDirection direction,
) {
if (direction.name == 'left') {
debugPrint(
'The card $previousIndex was swiped to the ${direction.name}. Now the card $currentIndex is on top');
} else if (direction.name == 'right') {
debugPrint(
'The card $previousIndex was swiped to the ${direction.name}. Now the card $currentIndex is on top');
} else if (direction.name == 'top') {
debugPrint(
'The card $previousIndex was swiped to the ${direction.name}. Now the card $currentIndex is on top');
} else if (direction.name == 'bottom') {
controller.undo();
bool h = _onUndo(previousIndex - 1, currentIndex!, direction);
debugPrint(
'$h The card $previousIndex was swiped to the ${direction.name}. Now the card $currentIndex is on top');
} else {
debugPrint(
'The card $previousIndex was swiped to the ${direction.name}. Now the card $currentIndex is on top');
}
return true;
}
The text was updated successfully, but these errors were encountered:
You can have a custom list of cards, which is updated when _onSwipe and onSwipeDirectionChange occur, even updating its 'direction' by sorting the next card the way you want it. Simply maintain the original collection of your cards and utilize a separate collection for selected elements in your builder, then update that collection after events occur.
You dont need 'Undo' because you can simulate backward swiping by changing next element on the fly.
Is it possible to show the previous Card on SwipeDown or Swipe left. The example application is always showing the next Card on whatever direction you swipe. The undo button works as expected but I can not do it on swipe.
I tried this way
The text was updated successfully, but these errors were encountered: