We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 89b8420 + 4be7203 commit 0b1add3Copy full SHA for 0b1add3
lib/loaders/color_loader.dart
@@ -16,6 +16,7 @@ class _ColorLoaderState extends State<ColorLoader>
16
with SingleTickerProviderStateMixin {
17
final List<Color> colors;
18
final Duration duration;
19
+ Timer timer;
20
21
_ColorLoaderState(this.colors, this.duration);
22
@@ -59,7 +60,7 @@ class _ColorLoaderState extends State<ColorLoader>
59
60
61
tweenIndex = 0;
62
- Timer.periodic(duration, (Timer t) {
63
+ timer = Timer.periodic(duration, (Timer t) {
64
setState(() {
65
tweenIndex = (tweenIndex + 1) % colors.length;
66
});
@@ -82,7 +83,8 @@ class _ColorLoaderState extends State<ColorLoader>
82
83
84
@override
85
void dispose() {
- super.dispose();
86
+ timer.cancel();
87
controller.dispose();
88
+ super.dispose();
89
}
90
0 commit comments