Skip to content

Commit

Permalink
Merge pull request #121 from awhitford/fade_timer
Browse files Browse the repository at this point in the history
Ensured that the timer has been canceled. Resolves #98.
  • Loading branch information
aagarwal1012 committed Oct 12, 2020
2 parents fa78a43 + 8f1765e commit 601083b
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 601083b

Please sign in to comment.