diff --git a/lib/ui/widgets/countdown_widget.dart b/lib/ui/widgets/countdown_widget.dart index 7ff56bc..9a112e0 100644 --- a/lib/ui/widgets/countdown_widget.dart +++ b/lib/ui/widgets/countdown_widget.dart @@ -30,7 +30,7 @@ class _CountdownWidgetState extends State { int get totalDuration => (widget.endTime - widget.startTime).abs(); String get remainingTimeStr { - final remaining = Duration(seconds: remainingTime); + final remaining = Duration(seconds: remainingTime.abs()); return tr( "%days% Days %hours% Hours %minutes% Minutes %seconds% Seconds", @@ -51,7 +51,10 @@ class _CountdownWidgetState extends State { } void _timerCb(Timer timer) { - if (!mounted) timer.cancel(); + if (!mounted) { + timer.cancel(); + return; + } setState(() {}); }