flutter动画组件 2020-10-29 18-RotationTransition Catalogue 效果: 代码: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748class GMExampleRotationTransitionTest extends StatefulWidget { GMExampleRotationTransitionTest({Key key}) : super(key: key); @override _GMExampleRotationTransitionTestState createState() => _GMExampleRotationTransitionTestState();}class _GMExampleRotationTransitionTestState extends State<GMExampleRotationTransitionTest> with SingleTickerProviderStateMixin { AnimationController _animationController; Animation _animation; @override void initState() { _animationController = AnimationController(duration: Duration(seconds: 2), vsync: this); _animation = Tween(begin: 0.0, end: 0.5).animate(_animationController); //开始动画 _animationController.forward(); super.initState(); } @override Widget build(BuildContext context) { return RotationTransition( turns: _animation, child: Container( height: 200, width: 200, color: Colors.red, alignment: Alignment.center, child: Text("test"), ), ); } @override void dispose() { _animationController.dispose(); super.dispose(); }}