Skip to content

Commit

Permalink
fix: displaying total duration on cards
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Sep 8, 2024
1 parent 8496541 commit 889e9ff
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/controller/navigator_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ SnackbarController? snackyy({
final EdgeInsets paddingInsets;
if (button != null) {
if (title.isNotEmpty && message.isNotEmpty) {
paddingInsets = const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0);
paddingInsets = const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0);
} else {
paddingInsets = const EdgeInsets.symmetric(horizontal: 16.0, vertical: 6.0);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/core/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension TracksSelectableUtils on Iterable<Selectable> {
extension TracksWithDatesUtils on List<TrackWithDate> {
int get totalDurationInMS => fold(0, (previousValue, element) => previousValue + element.track.durationMS);
String get totalDurationFormatted {
return (totalDurationInMS ~/ 1000).formattedTime;
return (totalDurationInMS ~/ 1000).secondsFormatted;
}
}

Expand All @@ -75,7 +75,7 @@ extension TracksUtils on List<Track> {
int get totalDurationInMS => fold(0, (previousValue, element) => previousValue + element.durationMS);

String get totalDurationFormatted {
return (totalDurationInMS ~/ 1000).formattedTime;
return (totalDurationInMS ~/ 1000).secondsFormatted;
}

int get year {
Expand Down Expand Up @@ -201,7 +201,7 @@ extension DisplayKeywords on int {
}

extension YearDateFormatted on int {
String get formattedTime => getTimeFormatted(hourChar: 'h', minutesChar: 'min', separator: ' ');
String get secondsFormatted => getSecondsFormatted(hourChar: 'h', minutesChar: 'min', separator: ' ');

String get yearFormatted => getYearFormatted(settings.dateTimeFormat.value); // non reactive

Expand Down
4 changes: 1 addition & 3 deletions lib/ui/widgets/library/multi_artwork_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class MultiArtworkCard extends StatelessWidget {
final thumbnailSize = dimensions.$1;
final fontSize = dimensions.$2;

final totalDurationInMS = tracks.totalDurationInMS;

return GridTile(
child: Container(
margin: const EdgeInsets.symmetric(vertical: 0.0, horizontal: Dimensions.gridHorizontalPadding),
Expand Down Expand Up @@ -82,7 +80,7 @@ class MultiArtworkCard extends StatelessWidget {
child: Text(
[
tracks.displayTrackKeyword,
if (totalDurationInMS > 0) totalDurationInMS.formattedTime,
tracks.totalDurationFormatted,
].join(' - '),
style: context.textTheme.displaySmall?.copyWith(
fontWeight: FontWeight.w500,
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/widgets/stats.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class StatsSection extends StatelessWidget {
return StatsContainer(
icon: Broken.timer_1,
title: '${lang.TOTAL_LISTEN_TIME} :',
value: trSec.formattedTime,
value: trSec.secondsFormatted,
);
},
),
Expand All @@ -75,7 +75,7 @@ class StatsSection extends StatelessWidget {
),
icon: Broken.timer_1,
title: '${lang.TOTAL_LISTEN_TIME} (${lang.YOUTUBE}) :',
value: sec.formattedTime,
value: sec.secondsFormatted,
);
},
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: namida
description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter
publish_to: "none"
version: 4.2.0-beta+240904016
version: 4.2.1-beta+240908177

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down

0 comments on commit 889e9ff

Please sign in to comment.