Reputation: 734
Is it possible to dismiss dismissable programmatically? Not by swipe, but by let's say button click. The only thing that comes in mind is imitating gesture event with a certain velocity, but this sounds horribly wrong.
Upvotes: 26
Views: 2505
Reputation: 30114
How about considering an AnimatedList instead.
A scrolling container that animates items when they are inserted or removed. This widget is similar to one created by ListView.builder.
Upvotes: 2
Reputation: 705
Please try this.
key: Key(UniqueKey().toString()),
2nd Way
onDismissed: (DismissDirection direction) { dismissViewList(ObjecClass); }
And function is :
dismissViewList(ObjecClass) {
if (_personList.contains(ObjecClass)) {
//_personList is list of ObjecClass shown in ListView
setState(() {
_personList.remove(ObjecClass);
});
}
}
Upvotes: -3