Skip to content

Commit

Permalink
fix wrong cover and theme for AddToPlaylistButton
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Oct 22, 2024
1 parent b9ba60e commit 700340e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import 'package:finamp/models/jellyfin_models.dart';
import 'package:finamp/services/favorite_provider.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get_it/get_it.dart';

import 'playlist_actions_menu.dart';

Expand All @@ -35,6 +37,8 @@ class AddToPlaylistButton extends ConsumerStatefulWidget {
}

class _AddToPlaylistButtonState extends ConsumerState<AddToPlaylistButton> {
final _queueService = GetIt.instance<QueueService>();

@override
Widget build(BuildContext context) {
if (widget.item == null) {
Expand Down Expand Up @@ -74,12 +78,14 @@ class _AddToPlaylistButtonState extends ConsumerState<AddToPlaylistButton> {
}

bool inPlaylist = queueItemInPlaylist(widget.queueItem);
final currentTrack = _queueService.getCurrentTrack()?.baseItem;
await showPlaylistActionsMenu(
context: context,
item: widget.item!,
parentPlaylist:
inPlaylist ? widget.queueItem!.source.item : null,
usePlayerTheme: true,
usePlayerTheme: widget.item?.blurHash != null &&
widget.item?.blurHash == currentTrack?.blurHash,
);
}),
),
Expand Down
5 changes: 2 additions & 3 deletions lib/components/PlayerScreen/queue_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ class _QueueListItemState extends State<QueueListItem>
: const Color.fromRGBO(255, 255, 255, 0.125);

void menuCallback() {
var currentTrack = jellyfin_models.BaseItemDto.fromJson(
_queueService.getCurrentTrack()?.item.extras?["itemJson"]);
var currentTrack = _queueService.getCurrentTrack()?.baseItem;
showModalSongMenu(
context: context,
item: baseItem,
usePlayerTheme: widget.item.baseItem?.blurHash != null &&
widget.item.baseItem?.blurHash == currentTrack.blurHash,
widget.item.baseItem?.blurHash == currentTrack?.blurHash,
themeProvider: _menuTheme,
isInPlaylist: queueItemInPlaylist(widget.item),
parentItem: widget.item.source.item,
Expand Down

0 comments on commit 700340e

Please sign in to comment.