//相同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);
},
)
网友评论