feat(metadata): show average bitrate for lossless files in the track screen

This commit is contained in:
zarzet
2026-07-27 01:20:38 +07:00
parent 52b1147275
commit e8a3fc58c7
3 changed files with 37 additions and 5 deletions
+21
View File
@@ -706,6 +706,27 @@ extension _TrackMetadataCards on _TrackMetadataScreenState {
),
),
),
if (!_isBitrateFormatLabel(fileExtension) &&
_audioBitrate != null &&
_audioBitrate! > 0)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color: colorScheme.tertiaryContainer,
borderRadius: BorderRadius.circular(20),
),
child: Text(
'${_audioBitrate}kbps',
style: TextStyle(
color: colorScheme.onTertiaryContainer,
fontWeight: FontWeight.w600,
fontSize: 12,
),
),
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
+5 -5
View File
@@ -315,11 +315,11 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen>
final formatChanged =
resolvedFormat != null &&
resolvedFormat != normalizeAudioFormatValue(storedFormat);
final resolvedBitrate = _isBitrateFormatValue(resolvedFormat)
? _readPlausibleBitrateKbps(
metadata['bitrate'] ?? metadata['bit_rate'],
)
: null;
// Lossless files carry an average bitrate too (computed by the backend
// from file size / duration) — useful for spotting fake 24-bit rips.
final resolvedBitrate = _readPlausibleBitrateKbps(
metadata['bitrate'] ?? metadata['bit_rate'],
);
final resolvedDuration = readPositiveInt(metadata['duration']);
final resolvedAlbum = metadata['album']?.toString();
final resolvedTitle = metadata['title']?.toString();