Let's make a simple example, given a Column(), I have 2 Containers in it, and a button.
Column(
children: [
MyButton(
label: "Expand me"
onTap: () => setState(() => isOpen = !isOpen)
),
Container(
child: Text("Container 1"),
height: 200
),
if (isOpen)
Container(
child: Text("Container 2"),
height: 150
)
]
)
so basically, if we press the button, the second Container will appear right under the first one, like an expansion panel.
Now I want to add an animation, and I'm having a hard time finding the best fit for my use case, as most solutions look really complex for such a simple task.
The animation is really simple, instead of making the Container 2 appear out of nowhere under the first one, it would be nice if the Container 2 would start behind Container 1, and then slide towards the bottom, until in position.
What is the cleanest way to achieve this in flutter?