ToggleController constructor
ToggleController({
- required TickerProvider vsync,
- required Duration animationDuration,
Implementation
ToggleController({
required TickerProvider vsync,
required Duration animationDuration,
}) : _animating =
new AnimationController(vsync: vsync, duration: animationDuration) {
_animating
..addListener(notifyListeners)
..addStatusListener((status) {
switch (status) {
case AnimationStatus.forward:
_state = CurrentAnimationState.OPENING;
break;
case AnimationStatus.completed:
_state = CurrentAnimationState.OPEN;
break;
case AnimationStatus.reverse:
_state = CurrentAnimationState.CLOSING;
break;
case AnimationStatus.dismissed:
_state = CurrentAnimationState.CLOSED;
break;
}
// This notifies the listeners about the current running State of animation.
notifyListeners();
});
}