Skip to content

Commit 85e2ae7

Browse files
authored
Queue string improvements (#343)
1 parent 9717773 commit 85e2ae7

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

lib/src/player/player_utils.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,9 @@ void onArtistTap({
9393
navigatorKey.currentState?.maybePop();
9494
}
9595
}
96+
97+
String createQueueElement(Audio? audio) {
98+
final title = audio?.title?.isNotEmpty == true ? audio?.title! : '';
99+
final artist = audio?.artist?.isNotEmpty == true ? ' • ${audio?.artist}' : '';
100+
return '$title$artist'.trim();
101+
}

lib/src/player/queue_popup.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class QueuePopup extends StatelessWidget {
3939
children: [
4040
for (final e in queue)
4141
Text(
42-
'${e.title ?? ''} • ${e.artist ?? ''}',
42+
createQueueElement(e),
4343
style: theme.textTheme.labelMedium?.copyWith(
4444
color: e == audio
4545
? theme.colorScheme.onSurface

lib/src/player/up_next_bubble.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import 'package:flutter/material.dart';
22
import 'package:provider/provider.dart';
3-
import '../../data.dart';
4-
import '../l10n/l10n.dart';
53
import 'package:yaru_widgets/yaru_widgets.dart';
64

7-
import 'player_model.dart';
5+
import '../../data.dart';
6+
import '../../player.dart';
7+
import '../l10n/l10n.dart';
88

99
class UpNextBubble extends StatelessWidget {
1010
const UpNextBubble({
@@ -42,7 +42,7 @@ class UpNextBubble extends StatelessWidget {
4242
right: 10,
4343
),
4444
child: Text(
45-
context.l10n.upNext,
45+
isUpNextExpanded ? context.l10n.queue : context.l10n.upNext,
4646
style: theme.textTheme.labelSmall,
4747
),
4848
),
@@ -58,7 +58,7 @@ class UpNextBubble extends StatelessWidget {
5858
right: 10,
5959
),
6060
child: Text(
61-
'${e.title ?? ''} • ${e.artist ?? ''}',
61+
createQueueElement(e),
6262
style: theme.textTheme.labelMedium?.copyWith(
6363
color: theme.colorScheme.onSurface,
6464
fontWeight: e == audio
@@ -79,7 +79,7 @@ class UpNextBubble extends StatelessWidget {
7979
bottom: 10,
8080
),
8181
child: Text(
82-
'${nextAudio!.title!} • ${nextAudio?.artist!}',
82+
createQueueElement(nextAudio),
8383
style: theme.textTheme.labelMedium
8484
?.copyWith(color: theme.colorScheme.onSurface),
8585
overflow: TextOverflow.ellipsis,

0 commit comments

Comments
 (0)