letsar / flutter_slidable

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

Flutter slidable onDismissed error when delete middle item #500

Open johny444 opened 2 months ago

johny444 commented 2 months ago

Hi all I've some problem with flutterslidable on onDismissed function it's work when dismiss the last item but I don't know why when do it when the first or middle item it's error :═╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═ The following assertion was thrown building SlidableDismissal(state: SlidableDismissalState#a0f44(ticker inactive)): A dismissed Slidable widget is still part of the tree. Make sure to implement the onDismissed handle of the ActionPane and to immediately remove the Slidable widget from the application once that handler has fired.

I need some help please and this my code on startActionPane:

startActionPane: ActionPane(
                            motion: ScrollMotion(),
                            dismissible: DismissiblePane(
                              key: ValueKey(item.id),
                              onDismissed: () {
                                // setState(() {
                                //   noteslist.removeAt(i);
                                // });
                                firestore_Datasource().delete_note(item.id);
                                ScaffoldMessenger.of(context).showSnackBar(
                                    SnackBar(
                                        content:
                                            Text('Delete ${item.detail}')));
                              },
                            ),
                            children: [
                              SlidableAction(
                                onPressed: (context) {},
                                backgroundColor: Color(0xFFFE4A49),
                                foregroundColor: Colors.white,
                                icon: Icons.delete,
                                label: 'Delete',
                              ),
                            ],
                          ),