AnimatedAlign

Flutter 1.26.0-1.0.pre,Dart 2.12.0 (build 2.12.0-141.0.dev) Description: Animated version of Align that automatically changes the position of subcomponents when alignment changes at a given time.

Flutter imitates tremulous sounds

attribute paraphrase
Alignment – AlignmentGeometry alignment
The child – a Widget? Child widgets
The curve and the curve Animation curve, default is Curves. Linear
Duration and duration Animation execution time
HeightFactor – double? As with Align, this works if the parent height of AnimatedAlign is not specified. AnimatedAlign height is the height of the child AnimatedAlign multiplied by heightFactor
WidthFactor – double? The width of the AnimatedAlign child is the height of the AnimatedAlign child multiplied by widthFactor
OnEnd – VoidCallback? The callback at the end of the animation

Example 1 Basic use

Center(
      child: Container(
        color: Colors.red,
        width: 200,
        height: 200,
        child: AnimatedAlign(
          alignment: _selected ? Alignment.topRight:Alignment.bottomLeft,
          duration: Duration(seconds: 1),
          child: FlutterLogo(size: 50,),
          onEnd: (){
            showToast('End of animation'); },),),);Copy the code

Example 2 Animation curve animation

Center(
      child: Container(
        color: Colors.red,
        width: 200,
        height: 200,
        child: AnimatedAlign(
          alignment: _selected ? Alignment.topRight:Alignment.bottomLeft,
          duration: Duration(seconds: 1),
          curve: Curves.bounceOut,
          child: FlutterLogo(size: 50,),
          onEnd: (){
            showToast('End of animation'); },),),);Copy the code



Curves there are many different kinds of animation Curves,