From 1a841d382fd1b3c099169d6deed4583e5d2183a5 Mon Sep 17 00:00:00 2001 From: Kelrap Date: Mon, 12 Aug 2024 16:04:11 -0400 Subject: [PATCH] Add getter for remaining time --- lib/pangea/widgets/chat/round_timer.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pangea/widgets/chat/round_timer.dart b/lib/pangea/widgets/chat/round_timer.dart index 15ddf5440..44ca0eda3 100644 --- a/lib/pangea/widgets/chat/round_timer.dart +++ b/lib/pangea/widgets/chat/round_timer.dart @@ -27,8 +27,10 @@ class RoundTimerState extends State { }); } + int get remainingTime => widget.timerMaxSeconds - currentSeconds; + String get timerText => - '${((widget.timerMaxSeconds - currentSeconds) ~/ 60).toString().padLeft(2, '0')}: ${((widget.timerMaxSeconds - currentSeconds) % 60).toString().padLeft(2, '0')}'; + '${(remainingTime ~/ 60).toString().padLeft(2, '0')}: ${(remainingTime % 60).toString().padLeft(2, '0')}'; startTimeout([int milliseconds = 1000]) { _timer = Timer.periodic(const Duration(seconds: 1), (timer) {