bool left = true;
Row(
children: [
Expanded(
flex: left? 1: 0,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
color: Colors.red,
child: Text('Left Box'),
),
),
Expanded(
flex: left? 0: 1,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
color: Colors.green,
child: Text('Left Box'),
),
),
]),
The above code sample is what I am dealing with. I cannot animate the container by using the width
parameter since I want it to take the whole space when the left container is selected for example. Using MediaQuery
or constant values did not work as intended. Is there a way to force the container to animate from the expanded flex
condition?