1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Fix little issues with countdown timer.

This commit is contained in:
Pierre HUBERT 2019-11-02 20:17:00 +01:00
parent bcf9a1586a
commit 527927da82

View File

@ -30,7 +30,7 @@ class _CountdownWidgetState extends State<CountdownWidget> {
int get totalDuration => (widget.endTime - widget.startTime).abs(); int get totalDuration => (widget.endTime - widget.startTime).abs();
String get remainingTimeStr { String get remainingTimeStr {
final remaining = Duration(seconds: remainingTime); final remaining = Duration(seconds: remainingTime.abs());
return tr( return tr(
"%days% Days %hours% Hours %minutes% Minutes %seconds% Seconds", "%days% Days %hours% Hours %minutes% Minutes %seconds% Seconds",
@ -51,7 +51,10 @@ class _CountdownWidgetState extends State<CountdownWidget> {
} }
void _timerCb(Timer timer) { void _timerCb(Timer timer) {
if (!mounted) timer.cancel(); if (!mounted) {
timer.cancel();
return;
}
setState(() {}); setState(() {});
} }