Skip to content

Commit 890d7ee

Browse files
authored
fix: full height player image rebuild (#851)
1 parent c1a040a commit 890d7ee

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

lib/player/view/blurred_full_height_player_image.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ class BlurredFullHeightPlayerImage extends StatelessWidget {
3838
theme.isLight ? Colors.white : theme.scaffoldBackgroundColor,
3939
child: FullHeightPlayerImage(
4040
borderRadius: BorderRadius.zero,
41-
audio: audio,
4241
fit: BoxFit.cover,
4342
height: size.height,
4443
width: size.width,
45-
isOnline: true,
4644
),
4745
),
4846
),

lib/player/view/full_height_player.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ class FullHeightPlayer extends StatelessWidget with WatchItMixin {
5959
mainAxisAlignment: MainAxisAlignment.center,
6060
mainAxisSize: MainAxisSize.min,
6161
children: [
62-
FullHeightPlayerImage(
63-
audio: audio,
64-
isOnline: isOnline,
65-
),
62+
const FullHeightPlayerImage(),
6663
const SizedBox(
6764
height: kYaruPagePadding,
6865
),

lib/player/view/full_height_player_image.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
import 'package:flutter/material.dart';
22
import 'package:watch_it/watch_it.dart';
33

4-
import '../../common/data/audio.dart';
54
import '../../constants.dart';
65
import '../../local_audio/view/local_cover.dart';
6+
import '../player_model.dart';
77
import 'player_fall_back_image.dart';
88
import 'super_network_image.dart';
99

1010
class FullHeightPlayerImage extends StatelessWidget with WatchItMixin {
1111
const FullHeightPlayerImage({
1212
super.key,
13-
this.audio,
14-
required this.isOnline,
1513
this.fit,
1614
this.height,
1715
this.width,
1816
this.borderRadius,
1917
});
2018

21-
final Audio? audio;
22-
final bool isOnline;
2319
final BoxFit? fit;
2420
final double? height, width;
2521
final BorderRadius? borderRadius;
2622

2723
@override
2824
Widget build(BuildContext context) {
25+
final audio = watchPropertyValue((PlayerModel m) => m.audio);
26+
final icyTitle =
27+
watchPropertyValue((PlayerModel m) => m.mpvMetaData?.icyTitle);
28+
2929
final fallBackImage = PlayerFallBackImage(
3030
key: const ValueKey(0),
3131
audio: audio,
@@ -37,8 +37,8 @@ class FullHeightPlayerImage extends StatelessWidget with WatchItMixin {
3737
if (audio?.hasPathAndId == true) {
3838
image = LocalCover(
3939
key: ValueKey(audio!.path),
40-
albumId: audio!.albumId!,
41-
path: audio!.path!,
40+
albumId: audio.albumId!,
41+
path: audio.path!,
4242
width: width,
4343
height: height,
4444
fit: fit ?? BoxFit.fitHeight,
@@ -47,7 +47,11 @@ class FullHeightPlayerImage extends StatelessWidget with WatchItMixin {
4747
} else {
4848
if (audio?.albumArtUrl != null || audio?.imageUrl != null) {
4949
image = SuperNetworkImage(
50-
key: ValueKey(audio?.imageUrl ?? audio?.albumArtUrl),
50+
key: ValueKey(
51+
(icyTitle ?? '') +
52+
(audio?.imageUrl ?? '') +
53+
(audio?.albumArtUrl ?? ''),
54+
),
5155
height: height ?? fullHeightPlayerImageSize,
5256
width: width ?? fullHeightPlayerImageSize,
5357
audio: audio,

0 commit comments

Comments
 (0)