Skip to content

Commit

Permalink
fix: full height player image rebuild (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Aug 16, 2024
1 parent c1a040a commit 890d7ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 0 additions & 2 deletions lib/player/view/blurred_full_height_player_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ class BlurredFullHeightPlayerImage extends StatelessWidget {
theme.isLight ? Colors.white : theme.scaffoldBackgroundColor,
child: FullHeightPlayerImage(
borderRadius: BorderRadius.zero,
audio: audio,
fit: BoxFit.cover,
height: size.height,
width: size.width,
isOnline: true,
),
),
),
Expand Down
5 changes: 1 addition & 4 deletions lib/player/view/full_height_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ class FullHeightPlayer extends StatelessWidget with WatchItMixin {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
FullHeightPlayerImage(
audio: audio,
isOnline: isOnline,
),
const FullHeightPlayerImage(),
const SizedBox(
height: kYaruPagePadding,
),
Expand Down
20 changes: 12 additions & 8 deletions lib/player/view/full_height_player_image.dart
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import 'package:flutter/material.dart';
import 'package:watch_it/watch_it.dart';

import '../../common/data/audio.dart';
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';

class FullHeightPlayerImage extends StatelessWidget with WatchItMixin {
const FullHeightPlayerImage({
super.key,
this.audio,
required this.isOnline,
this.fit,
this.height,
this.width,
this.borderRadius,
});

final Audio? audio;
final bool isOnline;
final BoxFit? fit;
final double? height, width;
final BorderRadius? borderRadius;

@override
Widget build(BuildContext context) {
final audio = watchPropertyValue((PlayerModel m) => m.audio);
final icyTitle =
watchPropertyValue((PlayerModel m) => m.mpvMetaData?.icyTitle);

final fallBackImage = PlayerFallBackImage(
key: const ValueKey(0),
audio: audio,
Expand All @@ -37,8 +37,8 @@ class FullHeightPlayerImage extends StatelessWidget with WatchItMixin {
if (audio?.hasPathAndId == true) {
image = LocalCover(
key: ValueKey(audio!.path),
albumId: audio!.albumId!,
path: audio!.path!,
albumId: audio.albumId!,
path: audio.path!,
width: width,
height: height,
fit: fit ?? BoxFit.fitHeight,
Expand All @@ -47,7 +47,11 @@ class FullHeightPlayerImage extends StatelessWidget with WatchItMixin {
} else {
if (audio?.albumArtUrl != null || audio?.imageUrl != null) {
image = SuperNetworkImage(
key: ValueKey(audio?.imageUrl ?? audio?.albumArtUrl),
key: ValueKey(
(icyTitle ?? '') +
(audio?.imageUrl ?? '') +
(audio?.albumArtUrl ?? ''),
),
height: height ?? fullHeightPlayerImageSize,
width: width ?? fullHeightPlayerImageSize,
audio: audio,
Expand Down

0 comments on commit 890d7ee

Please sign in to comment.