如何在Flutter中自定义文字动画?
How to Customise Text Animation in Flutter?
我正在研究 Flutter Text Animation.Its 一个 Scaler 文本动画。
我想做的是,我只想确保 'text' 只出现一次,并保留 way.So,我可以点击 'Text' 以转移到新的 page.Not 刚刚出现褪色和重新出现 again.Can 有人给我建议代码吗?
[AnimatedTextKit(animatedTexts:[
ScaleAnimatedText(
" Rehman",
textStyle: TextStyle(
fontSize: 85.0,
fontFamily: "MonteCarlo",
color: Colors.white
)
)
],
你试过这3个参数吗?
isRepeatingAnimation set to false
or repeatForever set to false
or totalRepeatCount set to 1 or 0
或者自定义您自己的过渡,例如:
class _ScaleTransitionState extends State<ScaleTransition>
with TickerProviderStateMixin {
AnimationController _controller;
Animation<double> _animation;
@override
initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(milliseconds: 1000), vsync: this, value: 0);
_animation = CurvedAnimation(parent: _controller, curve: Curves.easeIn);
_controller.forward();
}
@override
dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
child: ScaleTransition(
scale: _animation,
alignment: Alignment.center,
child: Center(
child: Text(
'Test',
style: TextStyle(
fontSize: 50,
),
),
),
),
);
}
}
我正在研究 Flutter Text Animation.Its 一个 Scaler 文本动画。 我想做的是,我只想确保 'text' 只出现一次,并保留 way.So,我可以点击 'Text' 以转移到新的 page.Not 刚刚出现褪色和重新出现 again.Can 有人给我建议代码吗?
[AnimatedTextKit(animatedTexts:[
ScaleAnimatedText(
" Rehman",
textStyle: TextStyle(
fontSize: 85.0,
fontFamily: "MonteCarlo",
color: Colors.white
)
)
],
你试过这3个参数吗?
isRepeatingAnimation set to false
or repeatForever set to false
or totalRepeatCount set to 1 or 0
或者自定义您自己的过渡,例如:
class _ScaleTransitionState extends State<ScaleTransition>
with TickerProviderStateMixin {
AnimationController _controller;
Animation<double> _animation;
@override
initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(milliseconds: 1000), vsync: this, value: 0);
_animation = CurvedAnimation(parent: _controller, curve: Curves.easeIn);
_controller.forward();
}
@override
dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
child: ScaleTransition(
scale: _animation,
alignment: Alignment.center,
child: Center(
child: Text(
'Test',
style: TextStyle(
fontSize: 50,
),
),
),
),
);
}
}