HeavenOSK / flutter_swipable_stack

A widget for stacking cards, which users can swipe horizontally and vertically with beautiful animations like Tinder UI.

Home Page:https://pub.dev/packages/swipable_stack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an updateCallback for SwipeableStack

therealjohnsummer opened this issue · comments

I have a suggestion but first - Thanks for a great component.

Can we add an onSwipeUpdate callback that is passed SwipeDirection and SwipeProgress or else add them to the SwipableStackController ?

These values should be part of the controller so that the controller can be used in other Widgets (I need to provide additionally animation when a card is moved).

Currently the only way to get access to these values is via the OverlayBuilder which causes rebuild issues if animation is triggered from that callback.

Ideally we should have either the SwipableStackController enriched with these values or else provide an onSwipeUpdate(properties) callback.

Hello @therealjohnsummer ,

Not sure if these will help, but maybe you can use onWillMoveNext: (index, swipeDirection) param which will be called right before the swipe starts. You should return true or false to allow or prevent the swipe, but you can do anything before that, and you have access to the swipeDirection.

Also, you can use onSwipeCompleted: (index, direction) which will be called once the swipe is fully completed.