Reputation:
I'm using Dismissible
to dismiss the items, but when an item is dismissed I get default boring animation. Is there a way to change that animation like Gmail does?
Example:
My own animation (not smooth)
So, in my animation, you can see slight pause when the item is deleted and next item coming up on the screen taking up old item position.
Upvotes: 1
Views: 1973
Reputation:
Thanks to @Rémi Rousselet for his efforts.
Finally I found the reason for that ugly animation. Never use itemExtent
when you are planning to use Dismissible
. I was mad, I used it.
Upvotes: 0
Reputation: 277037
That's the default animation of Dismissible
.
List<String> content;
ListView.builder(
itemCount: content.length,
itemBuilder: (context, index) {
return Dismissible(
key: ValueKey(content[index]),
onDismissed: (_) {
setState(() {
content = List.from(content)..removeAt(index);
});
},
background: Container(color: Colors.green),
child: ListTile(
title: Text(content[index]),
),
);
},
)
Upvotes: 1