-
-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend slidable to perform action but not dismiss #318
Comments
For your use case, you can return false from ActionPane(
dragDismissible: true,
dismissible: DismissiblePane(
closeOnCancel: true,
dismissThreshold: 0.9,
confirmDismiss: () async {
// always returning false so it doesn't get dismissed
return false;
},
onDismissed: (){
// perform your action here
},
),
) |
Thank you kind sir!!!! |
I do have one question though, the animation is broken though when we dismiss it and return false, it should close the drawer smoothly no? |
I opened a new issue, thanks. |
Currently (at the time of writing this v2.0.0), when Here the docs: /// Gives the app an opportunity to confirm or veto a pending dismissal.
///
/// If the returned Future<bool> completes true, then this widget will be
/// dismissed, otherwise it will be moved back to its original location.
///
/// If the returned Future<bool> completes to false or null the [onDismissed]
/// callback will not run.
final ConfirmDismissCallback? confirmDismiss; So to get the desired behavior the action to be performed should be right before returning false in the ActionPane(
dragDismissible: true,
dismissible: DismissiblePane(
closeOnCancel: true,
dismissThreshold: 0.9,
confirmDismiss: () async {
//TODO: perform your action here
// always returning false so it doesn't get dismissed
return false;
},
onDismissed: (){
// Never gets called back
},
),
) |
Any new update on this? |
I didn't find any solution! how to archive this in the latest version of flutter_slidable(3.0.0) |
Hi, It doesn't work for you even if you put the action before "return false"? If it works, you don't need onDismissed to be called.
|
For some reason i got this working already, not sure when it happened lol. Here is my code: Thanks for your input @victor-kotov
|
First off, THANK YOU. You did some AMAZING improvements to the package and on behalf of the entire community thank you!
I wanted to ask if it is possible to have a slidable element extend as if it was dismissable but not get rid of the item in question just trigger the action like we do on whatsapp to archive or mark a conversation as unread by swiping left or right to the edge of the tile?
Basically like a dismissable but no dismiss. I hope i was clear in my remarks.
Cheers.
The text was updated successfully, but these errors were encountered: