Skip to content

Commit

Permalink
Show <current track position>/<current queue size> on queue screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Komodo5197 committed Apr 30, 2024
1 parent d29bd8f commit e500336
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
23 changes: 21 additions & 2 deletions lib/components/PlayerScreen/queue_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ class _QueueListStreamState {
}

class QueueList extends StatefulWidget {

static const routeName = "/queue";

const QueueList({
Key? key,
required this.scrollController,
Expand Down Expand Up @@ -1203,6 +1202,8 @@ class PreviousTracksSectionHeader extends SliverPersistentHeaderDelegate {
this.height = 50.0,
});

final _queueService = GetIt.instance<QueueService>();

@override
Widget build(context, double shrinkOffset, bool overlapsContent) {
return Padding(
Expand Down Expand Up @@ -1250,6 +1251,24 @@ class PreviousTracksSectionHeader extends SliverPersistentHeaderDelegate {
);
}
}),
const Spacer(),
StreamBuilder(
stream: _queueService.getQueueStream(),
builder: (context, snapshot) {
if (snapshot.hasData) {
var trackPosition = snapshot.data!.previousTracks.length +
(snapshot.data!.currentTrack == null ? 0 : 1);
var trackCount = trackPosition +
snapshot.data!.nextUp.length +
snapshot.data!.queue.length;
return Padding(
padding: const EdgeInsets.only(top: 4.0, right: 8.0),
child: Text(AppLocalizations.of(context)!
.queueTotalSize(trackPosition, trackCount)),
);
}
return const SizedBox.shrink();
}),
],
),
),
Expand Down
14 changes: 13 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1308,5 +1308,17 @@
"description": "Text shown on button to require an item which is already downloaded by a parent collection, preventing it from being deleted if the parent is removed."
},
"showArtistChipImage": "Show artist images with artist name",
"showArtistChipImageSubtitle": "This affects small artist image previews, such as on the player screen."
"showArtistChipImageSubtitle": "This affects small artist image previews, such as on the player screen.",
"queueTotalSize": "Playing { trackPosition }/{ trackCount }",
"@queueTotalSize": {
"placeholders": {
"trackPosition": {
"type": "int"
},
"trackCount": {
"type": "int"
}
},
"description": "Display for current track position out of total queue size."
}
}

0 comments on commit e500336

Please sign in to comment.