Dismissible Widget in ListView does not animate smoothly

777 views Asked by At

I'm using a dismissible widget in a List view for swipe to delete. Here is my code for the dismissible Item:

new Dismissible(
        key: new Key(visitor.id.toString()),
        onDismissed: (direction) {
          Visitor removedVisitor;
          setMountedState(() {
            removedVisitor = _visitors.removeAt(index);
          });
          _deleteVisitor(removedVisitor, index);
        },
        // Show a red background as the item is swiped away
        background: new LeaveBehindView(),
        child: item,
      )

(setMountedState is a function which is basically => if(mounted) setState...)

The problem is, from the examples, the swipe action is supposed to animate the item below the dismissed item smoothly after resizing. But in my case, the animation is abrupt. I have tried changing the values of resizeDuration but the animation is still not smooth.

0

There are 0 answers