Step 1 / 5
Change the value, get an animation
AnimatedContainer remembers its previous properties. When selected flips and you rebuild, it smoothly tweens width, color and radius to the new values.
Change a property and let AnimatedFoo widgets tween it for you, with no controllers.
1AnimatedContainer(2 duration: const Duration(milliseconds: 300),3 curve: Curves.easeOutCubic,4 width: selected ? 200 : 100,5 height: 100,6 decoration: BoxDecoration(7 color: selected ? Colors.teal : Colors.grey,8 borderRadius: BorderRadius.circular(selected ? 24 : 8),9 ),10)1112AnimatedSwitcher(13 duration: const Duration(milliseconds: 250),14 child: Text('$count', key: ValueKey(count)),15)1617// Shared-element transition between two screens18Hero(tag: 'avatar-$id', child: CircleAvatar(backgroundImage: image))
AnimatedContainer(duration: 600ms, curve: Curves.easeInOut)AnimatedContainer remembers its previous properties. When selected flips and you rebuild, it smoothly tweens width, color and radius to the new values.