IndicatorController constructor
IndicatorController({
- required TickerProvider vsync,
- required Color color,
- required Duration duration,
- required Duration timeout,
- required double offset,
Implementation
IndicatorController({
required this.vsync,
required this.color,
required this.duration,
required this.timeout,
required this.offset,
}) {
_offsetTween = Tween(begin: 0, end: offset);
_colorTween = TweenSequence<Color?>([
TweenSequenceItem(
weight: 2.0,
tween: ColorTween(begin: color.withOpacity(0), end: color)),
TweenSequenceItem(
weight: 1.0, tween: ColorTween(begin: color, end: color)),
TweenSequenceItem(
weight: 2.0,
tween: ColorTween(begin: color, end: color.withOpacity(0))),
]);
_controller = AnimationController(vsync: vsync, duration: duration);
_colorAnimation = _colorTween.animate(
CurvedAnimation(parent: _controller, curve: const Interval(0, 1.0)))
..addListener(_animationListener);
_offsetAnimation = _offsetTween.animate(_controller)
..addListener(_animationListener)
..addStatusListener(_animationStatusListener);
_controller.forward();
}