Skip to content

Commit

Permalink
fix: fallback for badly tagged local audios icons (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Aug 7, 2024
1 parent 6000d6a commit 82598a7
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/common/view/audio_tile_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,33 @@ class AudioTileImage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final icon = Icon(
switch (audio?.audioType) {
AudioType.radio => Iconz().radio,
AudioType.podcast => Iconz().podcast,
_ => Iconz().musicNote,
},
size: size / (1.65),
);
Widget image;
if (audio?.hasPathAndId == true) {
image = LocalCover(
albumId: audio!.albumId!,
path: audio!.path!,
fit: BoxFit.cover,
dimension: size,
fallback: Icon(
switch (audio?.audioType) {
AudioType.radio => Iconz().radio,
AudioType.podcast => Iconz().podcast,
_ => Iconz().musicNote,
},
size: size / (1.65),
),
fallback: icon,
);
} else {
} else if (audio?.imageUrl != null || audio?.albumArtUrl != null) {
image = SafeNetworkImage(
url: audio?.imageUrl ?? audio?.albumArtUrl,
height: size,
fit: BoxFit.cover,
fallBackIcon: icon,
errorIcon: icon,
);
} else {
image = icon;
}

return SizedBox.square(
Expand Down

0 comments on commit 82598a7

Please sign in to comment.