CR Sohan
CR Sohan

Reputation: 35

How to move list item given source index and destination index with animation in flutter

I am building a leaderboard screen in the flutter application, whenever the user comes to the leaderboard screen, I want to show the animation of his old position to a new position in the leaderboard, so I need an animation of this row to go up or down based on his standings, please someone help me which widget to use to get this functionality working. Thanks

Upvotes: 0

Views: 766

Answers (1)

WSBT
WSBT

Reputation: 36383

AnimatedList is the widget you are looking for. It automatically generates entrance and exit animation when items are added/deleted. Combined that with SizeTransition, and you will get a nice "growing/shrinking" effect.

There are some really good examples (and even a video tutorial) on the official docs as well.

You can also look at this answer for a more complex example of using 2 of them.

Upvotes: 3

Related Questions