Skip to content

Commit

Permalink
Ensured that the timer has been canceled. Resolves #98.
Browse files Browse the repository at this point in the history
  • Loading branch information
awhitford committed Oct 11, 2020
1 parent fa78a43 commit 8f1765e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/fade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class _FadeTextState extends State<FadeAnimatedTextKit>

@override
void dispose() {
_timer?.cancel();
_controller?.stop();
_controller?.dispose();
super.dispose();
Expand Down Expand Up @@ -228,6 +229,7 @@ class _FadeTextState extends State<FadeAnimatedTextKit>
void _animationEndCallback(state) {
if (state == AnimationStatus.completed) {
_isCurrentlyPausing = true;
assert(null == _timer || !_timer.isActive);
_timer = Timer(_texts[_index]['pause'], _nextAnimation);
}
}
Expand All @@ -247,6 +249,7 @@ class _FadeTextState extends State<FadeAnimatedTextKit>

_setPause();

assert(null == _timer || !_timer.isActive);
_timer =
Timer(Duration(milliseconds: max(pause, left)), _nextAnimation);
}
Expand Down

0 comments on commit 8f1765e

Please sign in to comment.