-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
example code: just add Dismissible Widget in the main.dart of example project
issue
1、if I use the onDismissed callback, it will always hit the exception: A dismissed Dismissible widget is still part of the tree.
Make sure to implement the onDismissed handler and to immediately remove the Dismissible widget from the application once that handler has fired.
2、if I use the confirmDismiss callback to setState, the re-layout animation is strange...
example code:
? AnimatedReorderableGridView(
items: list,
itemBuilder: (BuildContext context, int index) {
final user = list[index];
return Dismissible(
key: ValueKey(user.id),
confirmDismiss: (direction) async {
setState(() {
list.removeAt(index);
});
return true;
},
onDismissed: (DismissDirection direction) {
// setState(() {
// list.removeAt(index);
// });
},
child: ItemCard(
key: ValueKey('${user.id}_item'),
id: user.id,
dragEnabled: !nonDraggableItems.contains(user),
isLocked: lockedItems.contains(user),
));
},
Metadata
Metadata
Assignees
Labels
No labels