flutter_slidable icon indicating copy to clipboard operation
flutter_slidable copied to clipboard

How do I add a remove animation?

Open lushan1314 opened this issue 1 year ago • 0 comments

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,
                                            ),
                                          ))
                                    ],
                                  )

lushan1314 avatar Dec 13 '23 09:12 lushan1314