如下为具体的实现效果,具体的实现代码以及解释可参考代码中的注释
import 'package:flutter/material.dart';
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage>
with SingleTickerProviderStateMixin {
//创建动画控制器 和动画 (动画用于控制log)
AnimationController _animationController;
Animation<double> _animation;
@override
void initState() {
super.initState();
//创建具体的动画控制器和动画
_animationController = AnimationController(
vsync: this, duration: Duration(milliseconds: 1000));
_animation = new CurvedAnimation(
parent: _animationController, curve: Curves.bounceOut);
//为动画添加监听事件
_animation.addListener(() => this.setState(() {}));
//执行动画
_animationController.forward();
}
@ov