flutter_slidable
flutter_slidable copied to clipboard
How do I add a remove animation?
How do I add a remove animation when I delete an item inside the onPress method?
endActionPane: ActionPane(
motion: const ScrollMotion(),
dragDismissible: true,
dismissible:
DismissiblePane(onDismissed: () {
controller.items.removeAt(index);// with deleted animation
}),
children: [
CustomSlidableAction(
autoClose: false,
backgroundColor: Color(0xFF7368F2),
foregroundColor: Color(0xFFEBEAF5),
onPressed: (BuildContext context) {
// do something
},
child: const Center(
child: Text(
'share',
style: TextStyle(fontSize: 15),
textAlign: TextAlign
.center,
),
)),
CustomSlidableAction(
autoClose: false,
backgroundColor: Color(0xFFF44444),
foregroundColor: Color(0xFFEBEAF5),
onPressed: (BuildContext context) {
controller.items.removeAt(index);// without deleted animation
},
child: const Center(
child: Text(
'delete',
style: TextStyle(fontSize: 15),
textAlign: TextAlign
.center,
),
))
],
)