init method
Implementation
void init(Duration time) {
_maxLeft = _barKey.currentContext!.size!.width;
_boxWidth = _boxKey.currentContext!.size!.width;
// 判断是否滚动
if (_maxLeft > _boxWidth) {
// 初始化动画
controller = AnimationController(
duration: Duration(milliseconds: widget.duration), vsync: this)
..repeat();
createAnimate(0.0, -_maxLeft);
}
}