letsar / flutter_slidable

A Flutter implementation of slidable list item with directional slide actions.
MIT License
2.72k stars 589 forks source link

New dismiss() with confirmDismiss. #325

Open ghost opened 2 years ago

ghost commented 2 years ago

I just recently updated from version 0.6.0 and I wasn't successful in implementing the behavior I had before. I used to have a slidable that would dismiss when the user chose a "Remove" slidable action, with dragDismissible disabled, the onTap of that action would trigger the SlidableState.dismiss() method, which would then play the dismiss animation, run onWillDismiss and, if successful, trigger the onDismissed function.

Now, after changing the action's new onPressed to be Slidable.of(context).dismiss, it asks for a ResizeRequest that has an onDismissed parameter itself, and even if I move the onDismissed from the DismissiblePane to it, it doesn't run the confirmDismiss (and also requires me to have an empty onDismissed in the DismissiblePane).

Is there any way to make the action simply trigger the dismiss action like it used before? Using the actual parameters already informed in the DismissiblePane and also using the confirmDismiss?

Thanks!

letsar commented 2 years ago

Yeah the API to dismiss programmatically is not ideal, I should work on something.

vincentliu98 commented 2 years ago

Same here, after migrating, the previously working solution seems difficult to implement. Would love to have an easier way to dismiss tiles through the onPress function of SlidableAction.

This issue seems to be related to #326 and #368