Skip to content

Commit

Permalink
Solved some bugs related to the remaining time related functions (#32)
Browse files Browse the repository at this point in the history
* bug solved

* added minute/ minutes  and hour/hours logic
  • Loading branch information
BrawlerXull authored Jul 20, 2023
1 parent 148df6b commit 7e296fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
- PromisesObjC (2.2.0)
- screen_state (0.0.1):
- Flutter
Expand All @@ -844,6 +846,7 @@ DEPENDENCIES:
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- screen_state (from `.symlinks/plugins/screen_state/ios`)
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
Expand Down Expand Up @@ -903,6 +906,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/mobile_scanner/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
screen_state:
:path: ".symlinks/plugins/screen_state/ios"
sensors_plus:
Expand Down Expand Up @@ -949,6 +954,7 @@ SPEC CHECKSUMS:
mobile_scanner: 47056db0c04027ea5f41a716385542da28574662
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
screen_state: a7ae251997e97f3f001839df09b57313b0ddef18
sensors_plus: 5717760720f7e6acd96fdbd75b7428f5ad755ec2
Expand Down
12 changes: 8 additions & 4 deletions lib/app/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,21 @@ class Utils {
}
}

if (duration.inMinutes <= 1) {
if (duration.inMinutes < 1) {
return 'less than 1 minute';
} else if (duration.inHours < 24) {
final hours = duration.inHours;
final minutes = duration.inMinutes % 60;
if (hours == 0) {
return '$minutes minutes';
return minutes == 1 ? '$minutes minute' : '$minutes minutes';
} else if (minutes == 0) {
return '$hours hours';
return hours == 1 ? '$hours hour' : '$hours hours';
} else if (hours == 1) {
return minutes == 1
? '$hours hour $minutes minute'
: '$hours hour $minutes minutes';
} else {
return '$hours hours $minutes minutes';
return '$hours hour $minutes minutes';
}
} else if (duration.inDays == 1) {
return '1 day';
Expand Down

0 comments on commit 7e296fb

Please sign in to comment.