fixed hours parsing

This commit is contained in:
Vadim 2024-05-03 13:12:33 +02:00
parent 90a4b9a056
commit c8617ec00b

View file

@ -19,7 +19,6 @@ class TimerText extends StatelessWidget {
parseSeconds(), parseSeconds(),
style: Theme.of(context).textTheme.displayMedium, style: Theme.of(context).textTheme.displayMedium,
), ),
if (duration.inMinutes < 1)
Text( Text(
addZeroIfNeeded(timeLeft.inMilliseconds % 1000, 3), addZeroIfNeeded(timeLeft.inMilliseconds % 1000, 3),
style: Theme.of(context).textTheme.displaySmall, style: Theme.of(context).textTheme.displaySmall,
@ -32,7 +31,7 @@ class TimerText extends StatelessWidget {
final buffer = StringBuffer(); final buffer = StringBuffer();
int remainingMs = timeLeft.inMilliseconds; int remainingMs = timeLeft.inMilliseconds;
// longer than 1 hours // longer than 1 hours
if (duration.inSeconds >= Duration.millisecondsPerHour) { if (duration.inMilliseconds >= Duration.millisecondsPerHour) {
final hours = remainingMs ~/ Duration.millisecondsPerHour; final hours = remainingMs ~/ Duration.millisecondsPerHour;
buffer.writeAll([addZeroIfNeeded(hours), ':']); buffer.writeAll([addZeroIfNeeded(hours), ':']);
remainingMs -= hours * Duration.millisecondsPerHour; remainingMs -= hours * Duration.millisecondsPerHour;