mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-15 00:25:17 +00:00
fix(player): queue button not showing when not logged in
This commit is contained in:
parent
bcfbecc40a
commit
6c2d65587b
@ -22,10 +22,12 @@ import 'package:spotube/utils/type_conversion_utils.dart';
|
|||||||
class PlayerActions extends HookConsumerWidget {
|
class PlayerActions extends HookConsumerWidget {
|
||||||
final MainAxisAlignment mainAxisAlignment;
|
final MainAxisAlignment mainAxisAlignment;
|
||||||
final bool floatingQueue;
|
final bool floatingQueue;
|
||||||
|
final bool showQueue;
|
||||||
final List<Widget>? extraActions;
|
final List<Widget>? extraActions;
|
||||||
PlayerActions({
|
PlayerActions({
|
||||||
this.mainAxisAlignment = MainAxisAlignment.center,
|
this.mainAxisAlignment = MainAxisAlignment.center,
|
||||||
this.floatingQueue = true,
|
this.floatingQueue = true,
|
||||||
|
this.showQueue = true,
|
||||||
this.extraActions,
|
this.extraActions,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@ -72,31 +74,32 @@ class PlayerActions extends HookConsumerWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: mainAxisAlignment,
|
mainAxisAlignment: mainAxisAlignment,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
if (showQueue)
|
||||||
icon: const Icon(SpotubeIcons.queue),
|
IconButton(
|
||||||
tooltip: context.l10n.queue,
|
icon: const Icon(SpotubeIcons.queue),
|
||||||
onPressed: playlist.activeTrack != null
|
tooltip: context.l10n.queue,
|
||||||
? () {
|
onPressed: playlist.activeTrack != null
|
||||||
showModalBottomSheet(
|
? () {
|
||||||
context: context,
|
showModalBottomSheet(
|
||||||
isDismissible: true,
|
context: context,
|
||||||
enableDrag: true,
|
isDismissible: true,
|
||||||
isScrollControlled: true,
|
enableDrag: true,
|
||||||
backgroundColor: Colors.black12,
|
isScrollControlled: true,
|
||||||
barrierColor: Colors.black12,
|
backgroundColor: Colors.black12,
|
||||||
shape: RoundedRectangleBorder(
|
barrierColor: Colors.black12,
|
||||||
borderRadius: BorderRadius.circular(10),
|
shape: RoundedRectangleBorder(
|
||||||
),
|
borderRadius: BorderRadius.circular(10),
|
||||||
constraints: BoxConstraints(
|
),
|
||||||
maxHeight: MediaQuery.of(context).size.height * .7,
|
constraints: BoxConstraints(
|
||||||
),
|
maxHeight: MediaQuery.of(context).size.height * .7,
|
||||||
builder: (context) {
|
),
|
||||||
return PlayerQueue(floating: floatingQueue);
|
builder: (context) {
|
||||||
},
|
return PlayerQueue(floating: floatingQueue);
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
: null,
|
}
|
||||||
),
|
: null,
|
||||||
|
),
|
||||||
if (!isLocalTrack)
|
if (!isLocalTrack)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(SpotubeIcons.alternativeRoute),
|
icon: const Icon(SpotubeIcons.alternativeRoute),
|
||||||
|
@ -10,6 +10,7 @@ import 'package:spotube/components/shared/shimmers/shimmer_playbutton_card.dart'
|
|||||||
import 'package:spotube/components/shared/waypoint.dart';
|
import 'package:spotube/components/shared/waypoint.dart';
|
||||||
import 'package:spotube/extensions/context.dart';
|
import 'package:spotube/extensions/context.dart';
|
||||||
import 'package:spotube/models/logger.dart';
|
import 'package:spotube/models/logger.dart';
|
||||||
|
import 'package:spotube/provider/authentication_provider.dart';
|
||||||
import 'package:spotube/services/queries/queries.dart';
|
import 'package:spotube/services/queries/queries.dart';
|
||||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||||
|
|
||||||
@ -94,6 +95,7 @@ class PersonalizedPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, ref) {
|
Widget build(BuildContext context, ref) {
|
||||||
|
final auth = ref.watch(AuthenticationNotifier.provider);
|
||||||
final featuredPlaylistsQuery = useQueries.playlist.featured(ref);
|
final featuredPlaylistsQuery = useQueries.playlist.featured(ref);
|
||||||
final playlists = useMemoized(
|
final playlists = useMemoized(
|
||||||
() => featuredPlaylistsQuery.pages
|
() => featuredPlaylistsQuery.pages
|
||||||
@ -132,12 +134,13 @@ class PersonalizedPage extends HookConsumerWidget {
|
|||||||
hasNextPage: featuredPlaylistsQuery.hasNextPage,
|
hasNextPage: featuredPlaylistsQuery.hasNextPage,
|
||||||
onFetchMore: featuredPlaylistsQuery.fetchNext,
|
onFetchMore: featuredPlaylistsQuery.fetchNext,
|
||||||
),
|
),
|
||||||
PersonalizedItemCard(
|
if (auth != null)
|
||||||
albums: albums,
|
PersonalizedItemCard(
|
||||||
title: context.l10n.new_releases,
|
albums: albums,
|
||||||
hasNextPage: newReleases.hasNextPage,
|
title: context.l10n.new_releases,
|
||||||
onFetchMore: newReleases.fetchNext,
|
hasNextPage: newReleases.hasNextPage,
|
||||||
),
|
onFetchMore: newReleases.fetchNext,
|
||||||
|
),
|
||||||
...?madeForUser.data?["content"]?["items"]?.map((item) {
|
...?madeForUser.data?["content"]?["items"]?.map((item) {
|
||||||
final playlists = item["content"]?["items"]
|
final playlists = item["content"]?["items"]
|
||||||
?.where((itemL2) => itemL2["type"] == "playlist")
|
?.where((itemL2) => itemL2["type"] == "playlist")
|
||||||
|
@ -9,6 +9,7 @@ import 'package:spotube/collections/assets.gen.dart';
|
|||||||
import 'package:spotube/collections/spotube_icons.dart';
|
import 'package:spotube/collections/spotube_icons.dart';
|
||||||
import 'package:spotube/components/player/player_actions.dart';
|
import 'package:spotube/components/player/player_actions.dart';
|
||||||
import 'package:spotube/components/player/player_controls.dart';
|
import 'package:spotube/components/player/player_controls.dart';
|
||||||
|
import 'package:spotube/components/player/player_queue.dart';
|
||||||
import 'package:spotube/components/player/volume_slider.dart';
|
import 'package:spotube/components/player/volume_slider.dart';
|
||||||
import 'package:spotube/components/shared/animated_gradient.dart';
|
import 'package:spotube/components/shared/animated_gradient.dart';
|
||||||
import 'package:spotube/components/shared/dialogs/track_details_dialog.dart';
|
import 'package:spotube/components/shared/dialogs/track_details_dialog.dart';
|
||||||
@ -77,6 +78,24 @@ class PlayerView extends HookConsumerWidget {
|
|||||||
foregroundColor: titleTextColor,
|
foregroundColor: titleTextColor,
|
||||||
toolbarOpacity: 1,
|
toolbarOpacity: 1,
|
||||||
leading: const BackButton(),
|
leading: const BackButton(),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(SpotubeIcons.info, size: 18),
|
||||||
|
tooltip: context.l10n.details,
|
||||||
|
style: IconButton.styleFrom(foregroundColor: bodyTextColor),
|
||||||
|
onPressed: currentTrack == null
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return TrackDetailsDialog(
|
||||||
|
track: currentTrack,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
body: SizedBox(
|
body: SizedBox(
|
||||||
@ -183,38 +202,53 @@ class PlayerView extends HookConsumerWidget {
|
|||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
PlayerActions(
|
PlayerActions(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
floatingQueue: false,
|
showQueue: false,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
if (auth != null)
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
children: [
|
||||||
children: [
|
const SizedBox(width: 10),
|
||||||
const SizedBox(width: 10),
|
Expanded(
|
||||||
Expanded(
|
child: OutlinedButton.icon(
|
||||||
child: OutlinedButton.icon(
|
icon: const Icon(SpotubeIcons.queue),
|
||||||
icon: const Icon(SpotubeIcons.info),
|
label: Text(context.l10n.queue),
|
||||||
label: Text(context.l10n.details),
|
|
||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
foregroundColor: bodyTextColor,
|
foregroundColor: bodyTextColor,
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: bodyTextColor ?? Colors.white,
|
color: bodyTextColor ?? Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: currentTrack == null
|
onPressed: currentTrack != null
|
||||||
? null
|
? () {
|
||||||
: () {
|
showModalBottomSheet(
|
||||||
showDialog(
|
context: context,
|
||||||
context: context,
|
isDismissible: true,
|
||||||
builder: (context) {
|
enableDrag: true,
|
||||||
return TrackDetailsDialog(
|
isScrollControlled: true,
|
||||||
track: currentTrack,
|
backgroundColor: Colors.black12,
|
||||||
);
|
barrierColor: Colors.black12,
|
||||||
});
|
shape: RoundedRectangleBorder(
|
||||||
},
|
borderRadius:
|
||||||
),
|
BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight:
|
||||||
|
MediaQuery.of(context)
|
||||||
|
.size
|
||||||
|
.height *
|
||||||
|
.7,
|
||||||
|
),
|
||||||
|
builder: (context) {
|
||||||
|
return PlayerQueue(
|
||||||
|
floating: false);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null),
|
||||||
|
),
|
||||||
|
if (auth != null) const SizedBox(width: 10),
|
||||||
|
if (auth != null)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: OutlinedButton.icon(
|
child: OutlinedButton.icon(
|
||||||
label: Text(context.l10n.lyrics),
|
label: Text(context.l10n.lyrics),
|
||||||
@ -251,9 +285,9 @@ class PlayerView extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
SliderTheme(
|
SliderTheme(
|
||||||
data: theme.sliderTheme.copyWith(
|
data: theme.sliderTheme.copyWith(
|
||||||
|
Loading…
Reference in New Issue
Block a user