Flutter animations with Animated Container

We can implement Flutter animations manually or with Animated Builder, but if we only need to implement animations for Container only, there is a short way to do that with AnimatedContainer widget.
- Create new AnimatedContainer
1 2 3 4 5 6 7 8 9 10 11 12 13 14
@override Widget build(BuildContext context) { return AnimatedContainer( duration: const Duration( // duration milliseconds: 300, ), curve: Curves.easeIn, // animation child: const Center( child: Text('Hello World!'), ), height: triggeredValue ? 500 : 300, // trigger by value ); } }
With this short way, you do not need to explicit animation controller, animation widget and ticker provider mixin.