Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update strings #367

Merged
merged 9 commits into from
Nov 8, 2024
Prev Previous commit
Next Next commit
Fix timer now showing minutes when 0
  • Loading branch information
AhsanSarwar45 committed Sep 23, 2024
commit c405d82f2c58ee6a75f2932317bc922d5d511b36
5 changes: 3 additions & 2 deletions lib/timer/types/time_duration.dart
Original file line number Diff line number Diff line change
@@ -86,8 +86,9 @@ class TimeDuration extends JsonSerializable {
if (inMilliseconds == 0) return "0";
String twoDigits(int n) => n.toString().padLeft(2, "0").substring(0, 2);
String hoursString = hours > 0 ? '$hours:' : '';
String minutesString =
minutes > 0 ? (hours > 0 ? '${twoDigits(minutes)}:' : '$minutes:') : '';
String minutesString = (minutes > 0 || hours > 0)
? (hours > 0 ? '${twoDigits(minutes)}:' : '$minutes:')
: '';
String secondsString =
(hours > 0 || minutes > 0) ? twoDigits(seconds) : '$seconds';
String millisecondsString =