HeavenOSK / flutter_swipable_stack

A widget for stacking cards, which users can swipe horizontally and vertically with beautiful animations like Tinder UI.
https://pub.dev/packages/swipable_stack
MIT License
117 stars 48 forks source link

Empty placeholder #67

Open radikris opened 2 years ago

radikris commented 2 years ago

Hi! Great package, thanks. would be great, if there would be a property for customization of the empty state, when the stack is empty:

image

Currently by default it shows empty container, a placeholder "Sorry, no more profile for you", or something like that,

Or any workaround?

mghali1 commented 1 year ago

Hello @radikris ,

Surely there are workarounds. One that I can think of is to have the cards in a stateful widget. You should also have a boolean field in the state. in the build widget, do something like this: if (_noMoreCards) { // show whatever you want } else { // show the cards }

Then, in the cards, pass a function to the onSwipeCompleted. Something like this: onSwipeCompleted: (index, direction) { if( index == yourList.length) { setState((){ _noMoreCards: true; }) } }