动画完成
This commit is contained in:
@@ -18,8 +18,10 @@ class _FadTextState extends State<AnimateText> with SingleTickerProviderStateMix
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 500));
|
controller = AnimationController(vsync: this, duration: Duration(milliseconds: 500));
|
||||||
opacity = Tween(begin: 1.0, end: 0.0).animate(controller);
|
opacity = Tween(begin: 1.0, end: 0.0).animate(controller);
|
||||||
|
scale = Tween(begin: 1.0, end: 0.9).animate(controller);
|
||||||
|
position = Tween<Offset>(begin: const Offset(0, 2), end: Offset.zero,).animate(controller);
|
||||||
controller.forward();
|
controller.forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,9 +39,14 @@ class _FadTextState extends State<AnimateText> with SingleTickerProviderStateMix
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return FadeTransition(
|
return ScaleTransition(
|
||||||
opacity: opacity,
|
scale: scale,
|
||||||
child: Text(widget.text),
|
child: SlideTransition(
|
||||||
|
position: position,
|
||||||
|
child: FadeTransition(
|
||||||
|
opacity: opacity,
|
||||||
|
child: Text(widget.text),
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user