美文网首页
widget组件记录

widget组件记录

作者: 温水煮青蛙a | 来源:发表于2023-03-10 20:55 被阅读0次
    //相同child控件 只改变颜色大小
    AnimatedContainer
    //不同child控件切换
    AnimatedSwitcher
    AnimatedOpacity
    AnimatedPadding
    //https://api.flutter.dev/flutter/animation/Curves-class.html
    curve: Curves.linear
    TweenAnimationBuilder
    //缩放
    Transform.scale(scale: null)
    //旋转
    Transform.rotate(angle: null)
    //偏移
                Transform.translate(
                     offset: Offset(10, 10),
                )
    
    
    
    
    
                  AnimatedSwitcher(
                    duration: Duration(seconds: 1),
                    //显示动画效果
                    transitionBuilder: (child, animation) {
                      //默认 透明度渐变
    //                  return FadeTransition(opacity: animation,child: child);
                      return FadeTransition(
                          opacity: animation,
                          //缩放
    //                      child: ScaleTransition(
    //                          scale: animation,
    //                          child: child
    //                      )
                          //旋转
                          child: RotationTransition(
                              turns: animation,
                              child: child
                          )
                      );
                    },
                  )
    
    AnimatedPadding(
                    padding: EdgeInsets.all(10),
                    duration: Duration(seconds: 1),
    //              curve: Curves.linear,//默认
    //              curve: Curves.bounceInOut,
                  curve: Curves.bounceOut,
                )
    
    TweenAnimationBuilder(
                    tween: Tween(begin: 0, end: 1),
                    duration: Duration(seconds: 1),
                    builder: (BuildContext context, value, Widget child) {
                      return Opacity(opacity: value);
                    },
                )
    

    相关文章

      网友评论

          本文标题:widget组件记录

          本文链接:https://www.haomeiwen.com/subject/ftgxnltx.html