Container height Animation starts from the middle
to start scale animation from certain points. You can wrap your Container with Align
widget and give certain start positions with simplicty.
define your controller and animation variables;
AnimationController animationController; Animation<double> tween;
init them in initState method;
@override void initState() { super.initState(); animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 800)); tween = Tween<double>(begin:0,end:1).animate(CurvedAnimation(parent: animationController, curve: Curves.easeIn)); animationController.addListener(() { setState(() {}); });}
then in build method or where ever you add use return Widget like below;
Widget animatedContainer(){ return Align( alignment: Alignment.topRight,// .topCenter, .topLeft, .bottomLeft, bottomCenter...etc child: Container( width: (size.width * tween.value).abs(), height: (200 *tween.value).abs(), color:Colors.red ), );}
You could use TweenMax for Flutter package: https://pub.dartlang.org/packages/tweenmax
Here is an example: https://github.com/mrgoonie/flutter_tweenmax/blob/master/lib/screens/animated_column_chart.dart
Click on the bottom button to animate those bars.
Cheers,