Animate multiple list items together (expanding/collapsing)

500 views Asked by At

Is there a way to animate multiple listView items together as one block to make Expanding/Collapsing animation. I tried AnimatedList, but it animates items one by one, not as one group or block. ExpansionTile and ExpansionPanel won't work for me because they create all children at start and in case there is for example 100 children inside one group - those 100 widgets will be created at once, which is really bad for performance, even on Release build.

1

There are 1 answers

8
w461 On

If I understand correctly, you have one or several headers, each can have multiple items, which can be collapsed with an animation.

So you please some bool toggle whether expanded or collapsed per header. The toggle then displays on 'expanded' a Container which wraps a ListView. And with the animation controller you control the height of the container.