|
|
|
@ -11,11 +11,13 @@ class IntroOverlayBuilder { |
|
|
|
}) { |
|
|
|
return Column( |
|
|
|
children: [ |
|
|
|
SizedBox( |
|
|
|
width: 200.w, |
|
|
|
height: 200.w, |
|
|
|
child: Lottie.asset('assets/lottie/intro_foriday.json'), |
|
|
|
), |
|
|
|
isWakeup |
|
|
|
? _AnimatedLottieWidget() |
|
|
|
: SizedBox( |
|
|
|
width: 200.w, |
|
|
|
height: 200.w, |
|
|
|
child: Lottie.asset('assets/lottie/intro_foriday.json'), |
|
|
|
), |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.only(bottom: 20.w), |
|
|
|
child: Text( |
|
|
|
@ -106,3 +108,61 @@ class IntroOverlayBuilder { |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 新增的动画Widget |
|
|
|
class _AnimatedLottieWidget extends StatefulWidget { |
|
|
|
@override |
|
|
|
_AnimatedLottieWidgetState createState() => _AnimatedLottieWidgetState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _AnimatedLottieWidgetState extends State<_AnimatedLottieWidget> |
|
|
|
with SingleTickerProviderStateMixin { |
|
|
|
late AnimationController _animationController; |
|
|
|
late Animation<double> _scaleAnimation; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
// 创建动画控制器,持续时间1.5秒 |
|
|
|
_animationController = AnimationController( |
|
|
|
duration: const Duration(milliseconds: 1000), |
|
|
|
vsync: this, |
|
|
|
); |
|
|
|
|
|
|
|
// 创建缩放动画,从0.8到1.2再回到1.0 |
|
|
|
_scaleAnimation = Tween<double>( |
|
|
|
begin: 0.8, |
|
|
|
end: 1.2, |
|
|
|
).animate(CurvedAnimation( |
|
|
|
parent: _animationController, |
|
|
|
curve: Curves.elasticInOut, |
|
|
|
)); |
|
|
|
|
|
|
|
// 启动动画并设置为循环 |
|
|
|
_animationController.repeat(reverse: true); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
_animationController.dispose(); |
|
|
|
super.dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return AnimatedBuilder( |
|
|
|
animation: _scaleAnimation, |
|
|
|
builder: (context, child) { |
|
|
|
return Transform.scale( |
|
|
|
scale: _scaleAnimation.value, |
|
|
|
child: SizedBox( |
|
|
|
width: 200.w, |
|
|
|
height: 200.w, |
|
|
|
child: Lottie.asset('assets/lottie/intro_foriday.json'), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|