企业网站标题优化南昌网络营销网站
企业网站标题优化,南昌网络营销网站,wordpress源码整合,网站 关键词 怎么改详细介绍#xff1a;优化成双色渐变版本效果图#xff1a;关键点把通用圆形设置为双色渐变#xff0c;把动画值设置给透明度代码实例import package:flutter/cupertino.dart;
import package:flutter/material.dart;class DemoPage extends StatefulWidget{const DemoPage({…详细介绍优化成双色渐变版本效果图关键点把通用圆形设置为双色渐变把动画值设置给透明度代码实例import package:flutter/cupertino.dart; import package:flutter/material.dart; class DemoPage extends StatefulWidget{ const DemoPage({super.key}); override StateStatefulWidget createState() _DemoPageState(); } class _DemoPageState extends StateDemoPage with SingleTickerProviderStateMixin{ late AnimationController _controller; //动画控制器 late Animationdouble _sizeAnimation; late Animationdouble _colorAnimation; late Animationdouble _size1Animation; late Animationdouble _color1Animation; late Animationdouble _size2Animation; late Animationdouble _color2Animation; late Animationdouble _size3Animation; late Animationdouble _color3Animation; override void initState(){ super.initState(); //初始化动画控制器 _controller AnimationController( vsync: this, duration: Duration(seconds: 4) ); //TweenSequence - 动画序列 TweenSequenceItem - 序列项 _sizeAnimation TweenSequencedouble([ TweenSequenceItem(tween:Tweendouble(begin: 50,end:130), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 130,end:210), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 210,end:290), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 290,end:50), weight: 1.0 ), ]).animate( CurvedAnimation(parent: _controller, curve: Curves.linear), ); _colorAnimation TweenSequencedouble([ TweenSequenceItem( tween: Tweendouble(begin: 1.0,end: 0.7), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.7,end: 0.4), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.4,end: 0.1), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.0,end: 0.0), weight: 1.0, ), ]).animate(CurvedAnimation(parent: _controller, curve: Curves.linear)); _size1Animation TweenSequencedouble([ TweenSequenceItem(tween:Tweendouble(begin: 130,end:210), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 210,end:290), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 290,end:50), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 50,end:130), weight: 1.0 ), ]).animate( CurvedAnimation(parent: _controller, curve: Curves.linear), ); _color1Animation TweenSequencedouble([ TweenSequenceItem( tween: Tweendouble(begin: 0.7,end: 0.4), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.4,end: 0.1), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.0,end: 0.0), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 1.0,end: 0.7), weight: 1.0, ), ]).animate(CurvedAnimation(parent: _controller, curve: Curves.linear)); _size2Animation TweenSequencedouble([ TweenSequenceItem(tween:Tweendouble(begin: 210,end:290), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 290,end:50), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 50,end:130), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 130,end:210), weight: 1.0 ), ]).animate( CurvedAnimation(parent: _controller, curve: Curves.linear), ); _color2Animation TweenSequencedouble([ TweenSequenceItem( tween: Tweendouble(begin: 0.4,end: 0.1), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.0,end: 0.0), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 1.0,end: 0.7), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.7,end: 0.4), weight: 1.0, ), ]).animate(CurvedAnimation(parent: _controller, curve: Curves.linear)); _size3Animation TweenSequencedouble([ TweenSequenceItem(tween:Tweendouble(begin: 290,end:50), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 50,end:130), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 130,end:210), weight: 1.0 ), TweenSequenceItem(tween:Tweendouble(begin: 210,end:290), weight: 1.0 ), ]).animate( CurvedAnimation(parent: _controller, curve: Curves.linear), ); _color3Animation TweenSequencedouble([ TweenSequenceItem( tween: Tweendouble(begin: 0.0,end: 0.0), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 1.0,end: 0.7), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.7,end: 0.4), weight: 1.0, ), TweenSequenceItem( tween: Tweendouble(begin: 0.4,end: 0.1), weight: 1.0, ), ]).animate(CurvedAnimation(parent: _controller, curve: Curves.linear)); _controller.repeat(); //动画重复 } override void dispose() { _controller.dispose(); super.dispose(); } override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: Center( child: Stack( children: [ // 动画部分 Center( child: AnimatedBuilder( animation: _controller, builder: (context, child) { return Stack( alignment: Alignment.center, children: [ _buildAnimatedCircle( size: _size3Animation.value, colorValue: _color3Animation.value, ), _buildAnimatedCircle( size: _size2Animation.value, colorValue: _color2Animation.value, ), _buildAnimatedCircle( size: _size1Animation.value, colorValue: _color1Animation.value, ), _buildAnimatedCircle( size: _sizeAnimation.value, colorValue: _colorAnimation.value, ), ], ); }, ), ), ], ), ), ); } // 构建动画圆形的通用方法 Widget _buildAnimatedCircle({ required double size, required double colorValue, Widget? child, }) { return Container( width: size, height: size, decoration: BoxDecoration( gradient: LinearGradient( begin: AlignmentGeometry.topCenter, end: AlignmentGeometry.bottomCenter, colors: [ Color(0xFF00E1FF).withOpacity(colorValue), Color(0xFF248EFF).withOpacity(colorValue), ] ), shape: BoxShape.circle, ), child: child ! null ? Center(child: child) : null, ); } }