initAnimate method
void
initAnimate()
Implementation
void initAnimate() {
// 初始化动画
controller =
AnimationController(duration: Duration(milliseconds: 200), vsync: this);
// move
moveAnimation = Tween<double>(begin: 0.0, end: widget.size - 2)
.animate(CurvedAnimation(parent: controller, curve: Curves.easeIn))
..addListener(() {
setState(() {});
});
// color
colorAnimation = ColorTween(begin: Colors.white, end: color)
.animate(CurvedAnimation(parent: controller, curve: Curves.linear));
// 默认选中状态
if (_open) controller.forward();
}