diff --git a/lib/player/view/bottom_player_image.dart b/lib/player/view/bottom_player_image.dart index 3355ebdd0..0f1fbcf09 100644 --- a/lib/player/view/bottom_player_image.dart +++ b/lib/player/view/bottom_player_image.dart @@ -5,8 +5,9 @@ import 'package:watch_it/watch_it.dart'; import '../../app/app_model.dart'; import '../../common/data/audio.dart'; import '../../local_audio/view/local_cover.dart'; +import '../player_model.dart'; import 'player_fall_back_image.dart'; -import 'super_network_image.dart'; +import 'player_remote_source_image.dart'; class BottomPlayerImage extends StatelessWidget with WatchItMixin { const BottomPlayerImage({ @@ -45,6 +46,8 @@ class BottomPlayerImage extends StatelessWidget with WatchItMixin { ); } + final mpvMetaData = watchPropertyValue((PlayerModel m) => m.mpvMetaData); + Widget child; final fallBackImage = PlayerFallBackImage( @@ -63,9 +66,14 @@ class BottomPlayerImage extends StatelessWidget with WatchItMixin { dimension: size, fallback: fallBackImage, ); - } else if (audio?.albumArtUrl != null || audio?.imageUrl != null) { - child = SuperNetworkImage( - key: ValueKey(audio?.albumArtUrl ?? audio?.imageUrl), + } else if (mpvMetaData?.icyTitle != null || + audio?.albumArtUrl != null || + audio?.imageUrl != null) { + child = PlayerRemoteSourceImage( + key: ValueKey( + mpvMetaData?.icyTitle ?? audio?.albumArtUrl ?? audio?.imageUrl, + ), + mpvMetaData: mpvMetaData, height: size, width: size, audio: audio, diff --git a/lib/player/view/full_height_player_image.dart b/lib/player/view/full_height_player_image.dart index 119168b3f..f8cf79d45 100644 --- a/lib/player/view/full_height_player_image.dart +++ b/lib/player/view/full_height_player_image.dart @@ -5,7 +5,7 @@ import '../../constants.dart'; import '../../local_audio/view/local_cover.dart'; import '../player_model.dart'; import 'player_fall_back_image.dart'; -import 'super_network_image.dart'; +import 'player_remote_source_image.dart'; class FullHeightPlayerImage extends StatelessWidget with WatchItMixin { const FullHeightPlayerImage({ @@ -23,8 +23,8 @@ class FullHeightPlayerImage extends StatelessWidget with WatchItMixin { @override Widget build(BuildContext context) { final audio = watchPropertyValue((PlayerModel m) => m.audio); - final icyTitle = - watchPropertyValue((PlayerModel m) => m.mpvMetaData?.icyTitle); + + final mpvMetaData = watchPropertyValue((PlayerModel m) => m.mpvMetaData); final fallBackImage = PlayerFallBackImage( key: const ValueKey(0), @@ -45,10 +45,13 @@ class FullHeightPlayerImage extends StatelessWidget with WatchItMixin { fallback: fallBackImage, ); } else { - if (audio?.albumArtUrl != null || audio?.imageUrl != null) { - image = SuperNetworkImage( + if (mpvMetaData?.icyTitle != null || + audio?.albumArtUrl != null || + audio?.imageUrl != null) { + image = PlayerRemoteSourceImage( + mpvMetaData: mpvMetaData, key: ValueKey( - (icyTitle ?? '') + + (mpvMetaData?.icyTitle ?? '') + (audio?.imageUrl ?? '') + (audio?.albumArtUrl ?? ''), ), diff --git a/lib/player/view/player_fall_back_image.dart b/lib/player/view/player_fall_back_image.dart index 186a377e6..ae11021bc 100644 --- a/lib/player/view/player_fall_back_image.dart +++ b/lib/player/view/player_fall_back_image.dart @@ -11,17 +11,17 @@ class PlayerFallBackImage extends StatelessWidget { const PlayerFallBackImage({ super.key, this.audio, - this.height, - this.width, + required this.height, + required this.width, }); final Audio? audio; - final double? height; - final double? width; + final double height; + final double width; @override Widget build(BuildContext context) { - const iconSize = 40.0; + final iconSize = width * 0.7; final theme = context.t; IconData iconData; if (audio?.audioType == AudioType.radio) { diff --git a/lib/player/view/super_network_image.dart b/lib/player/view/player_remote_source_image.dart similarity index 86% rename from lib/player/view/super_network_image.dart rename to lib/player/view/player_remote_source_image.dart index cbf038c46..e821e626d 100644 --- a/lib/player/view/super_network_image.dart +++ b/lib/player/view/player_remote_source_image.dart @@ -1,14 +1,13 @@ import 'package:flutter/material.dart'; -import 'package:watch_it/watch_it.dart'; import '../../common/data/audio.dart'; +import '../../common/data/mpv_meta_data.dart'; import '../../common/view/icy_image.dart'; import '../../common/view/safe_network_image.dart'; import '../../extensions/build_context_x.dart'; -import '../player_model.dart'; -class SuperNetworkImage extends StatelessWidget with WatchItMixin { - const SuperNetworkImage({ +class PlayerRemoteSourceImage extends StatelessWidget { + const PlayerRemoteSourceImage({ super.key, required this.height, required this.width, @@ -16,6 +15,7 @@ class SuperNetworkImage extends StatelessWidget with WatchItMixin { required this.fit, required this.fallBackIcon, required this.errorIcon, + required this.mpvMetaData, }); final double height; @@ -24,11 +24,11 @@ class SuperNetworkImage extends StatelessWidget with WatchItMixin { final BoxFit? fit; final Widget fallBackIcon; final Widget errorIcon; + final MpvMetaData? mpvMetaData; @override Widget build(BuildContext context) { final theme = context.t; - final mpvMetaData = watchPropertyValue((PlayerModel m) => m.mpvMetaData); final safeNetworkImage = SafeNetworkImage( url: audio?.imageUrl ?? audio?.albumArtUrl,