Skip to content

Commit

Permalink
use new track list tile for Next Up and previous tracks, remove old q…
Browse files Browse the repository at this point in the history
…ueue list tile
  • Loading branch information
Chaphasilor committed Oct 27, 2024
1 parent 5776327 commit 69c533b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 250 deletions.
11 changes: 10 additions & 1 deletion lib/components/AlbumScreen/track_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ class QueueListTile extends StatelessWidget {
final int actualIndex;
final int indexOffset;
final bool isCurrentTrack;
final bool isPreviousTrack;
final bool isInPlaylist;
final bool allowReorder;

Expand All @@ -318,6 +319,7 @@ class QueueListTile extends StatelessWidget {
required this.isCurrentTrack,
required this.isInPlaylist,
required this.allowReorder,
this.isPreviousTrack = false,
this.parentItem,
this.onRemoveFromList,
this.themeCallback,
Expand All @@ -337,6 +339,7 @@ class QueueListTile extends StatelessWidget {
parentItem: parentItem,
listIndex: listIndex,
actualIndex: item.indexNumber ?? -1,
isPreviousTrack: isPreviousTrack,
isInPlaylist: isInPlaylist,
allowReorder: allowReorder,
onRemoveFromList: onRemoveFromList,
Expand All @@ -356,6 +359,7 @@ class TrackListItem extends ConsumerStatefulWidget {
final bool showIndex;
final bool showArtists;
final bool showPlayCount;
final bool isPreviousTrack;
final bool isInPlaylist;
final bool allowReorder;
final Widget dismissBackground;
Expand All @@ -372,6 +376,7 @@ class TrackListItem extends ConsumerStatefulWidget {
required this.onTap,
required this.confirmDismiss,
this.parentItem,
this.isPreviousTrack = false,
this.isInPlaylist = false,
this.allowReorder = false,
this.showIndex = false,
Expand Down Expand Up @@ -460,6 +465,7 @@ class TrackListItemState extends ConsumerState<TrackListItem>
child: ThemedTrackListTile(
playable: playable,
isCurrentTrack: isCurrentlyPlaying,
isPreviousTrack: widget.isPreviousTrack,
themeCallback: (x) => _menuTheme = x,
baseItem: widget.baseItem,
listIndex: widget.listIndex,
Expand All @@ -477,6 +483,7 @@ class TrackListItemState extends ConsumerState<TrackListItem>
: ThemedTrackListTile(
playable: playable,
isCurrentTrack: isCurrentlyPlaying,
isPreviousTrack: widget.isPreviousTrack,
themeCallback: (x) => _menuTheme = x,
baseItem: widget.baseItem,
listIndex: widget.listIndex,
Expand Down Expand Up @@ -518,6 +525,7 @@ class TrackListItemState extends ConsumerState<TrackListItem>
class ThemedTrackListTile extends ConsumerWidget {
final bool playable;
final bool isCurrentTrack;
final bool isPreviousTrack;
final void Function(FinampTheme) themeCallback;
final jellyfin_models.BaseItemDto baseItem;
final Future<int>? listIndex;
Expand All @@ -533,6 +541,7 @@ class ThemedTrackListTile extends ConsumerWidget {
super.key,
required this.playable,
required this.isCurrentTrack,
required this.isPreviousTrack,
required this.themeCallback,
required this.baseItem,
required this.listIndex,
Expand All @@ -548,7 +557,7 @@ class ThemedTrackListTile extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Opacity(
opacity: playable ? 1.0 : 0.5,
opacity: playable ? (isPreviousTrack ? 0.7 : 1.0) : 0.5,
child: Card(
color: Colors.transparent,
elevation: 0,
Expand Down
45 changes: 15 additions & 30 deletions lib/components/PlayerScreen/queue_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import '../../services/process_artist.dart';
import '../../services/queue_service.dart';
import '../album_image.dart';
import '../themed_bottom_sheet.dart';
import 'queue_list_item.dart';
import 'queue_source_helper.dart';

class _QueueListStreamState {
Expand Down Expand Up @@ -466,16 +465,17 @@ class _PreviousTracksListState extends State<PreviousTracksList>
final item = _previousTracks![index];
final actualIndex = index;
final indexOffset = -((_previousTracks?.length ?? 0) - index);
return QueueListItem(
return QueueListTile(
key: ValueKey(item.id),
item: item,
listIndex: index,
item: item.baseItem!,
listIndex: Future.value(index),
actualIndex: actualIndex,
indexOffset: indexOffset,
subqueue: _previousTracks!,
isInPlaylist: queueItemInPlaylist(item),
parentItem: item.source.item,
allowReorder:
_queueService.playbackOrder == FinampPlaybackOrder.linear,
onTap: () async {
onTap: (bool playable) async {
FeedbackHelper.feedback(FeedbackType.selection);
await _queueService.skipByOffset(indexOffset);
scrollToKey(
Expand Down Expand Up @@ -522,7 +522,7 @@ class _NextUpTracksListState extends State<NextUpTracksList> {
_nextUp ??= snapshot.data!.nextUp;

return SliverPadding(
padding: const EdgeInsets.only(top: 0.0, left: 4.0, right: 4.0),
padding: const EdgeInsets.only(top: 0.0, left: 8.0, right: 8.0),
sliver: SliverReorderableList(
autoScrollerVelocityScalar: 20.0,
onReorder: (oldIndex, newIndex) {
Expand Down Expand Up @@ -558,14 +558,17 @@ class _NextUpTracksListState extends State<NextUpTracksList> {
final item = _nextUp![index];
final actualIndex = index;
final indexOffset = index + 1;
return QueueListItem(
return QueueListTile(
key: ValueKey(item.id),
item: item,
listIndex: index,
item: item.baseItem!,
listIndex: Future.value(index),
actualIndex: actualIndex,
indexOffset: indexOffset,
subqueue: _nextUp!,
onTap: () async {
isInPlaylist: queueItemInPlaylist(item),
parentItem: item.source.item,
allowReorder: _queueService.playbackOrder ==
FinampPlaybackOrder.linear,
onTap: (bool playable) async {
FeedbackHelper.feedback(FeedbackType.selection);
await _queueService.skipByOffset(indexOffset);
scrollToKey(
Expand Down Expand Up @@ -649,24 +652,6 @@ class _QueueTracksListState extends State<QueueTracksList> {
final actualIndex = index;
final indexOffset = index + _nextUp!.length + 1;

// return QueueListItem(
// key: ValueKey(item.id),
// item: item,
// listIndex: index,
// actualIndex: actualIndex,
// indexOffset: indexOffset,
// subqueue: _queue!,
// allowReorder:
// _queueService.playbackOrder == FinampPlaybackOrder.linear,
// onTap: () async {
// FeedbackHelper.feedback(FeedbackType.selection);
// await _queueService.skipByOffset(indexOffset);
// scrollToKey(
// key: widget.previousTracksHeaderKey,
// duration: const Duration(milliseconds: 500));
// },
// isCurrentTrack: false,
// );
return QueueListTile(
key: ValueKey(item.id),
item: item.baseItem!,
Expand Down
219 changes: 0 additions & 219 deletions lib/components/PlayerScreen/queue_list_item.dart

This file was deleted.

0 comments on commit 69c533b

Please sign in to comment.