Polished Holidays view
This commit is contained in:
@ -13,11 +13,13 @@ class AnimatedTime extends StatefulWidget {
|
||||
|
||||
class _AnimatedTimeState extends State<AnimatedTime> {
|
||||
Duration current = Duration.zero;
|
||||
late Timer timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer.periodic(const Duration(seconds: 1), (Timer t) => update());
|
||||
timer = Timer.periodic(const Duration(seconds: 1), (Timer t) => update());
|
||||
current = widget.callback();
|
||||
}
|
||||
|
||||
void update() {
|
||||
@ -50,4 +52,10 @@ class _AnimatedTimeState extends State<AnimatedTime> {
|
||||
textStyle: const TextStyle(fontSize: 15),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
timer.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user