mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix: PlayerOverlay not hiding when not playing and unneeded bottom space in TrackTableView
This commit is contained in:
parent
0ca97b495f
commit
0ebac05a4b
@ -21,6 +21,14 @@ class PlayerOverlay extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, ref) {
|
Widget build(BuildContext context, ref) {
|
||||||
final paletteColor = usePaletteColor(albumArt, ref);
|
final paletteColor = usePaletteColor(albumArt, ref);
|
||||||
|
final canShow = ref.watch(
|
||||||
|
playbackProvider.select(
|
||||||
|
(s) =>
|
||||||
|
s.track != null ||
|
||||||
|
s.isPlaying ||
|
||||||
|
s.status == PlaybackStatus.loading,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final onNext = useNextTrack(ref);
|
final onNext = useNextTrack(ref);
|
||||||
final onPrevious = usePreviousTrack(ref);
|
final onPrevious = usePreviousTrack(ref);
|
||||||
@ -38,9 +46,9 @@ class PlayerOverlay extends HookConsumerWidget {
|
|||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
|
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 250),
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 50,
|
height: canShow ? 50 : 0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: paletteColor.color.withOpacity(.7),
|
color: paletteColor.color.withOpacity(.7),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@ -49,55 +57,59 @@ class PlayerOverlay extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
child: Material(
|
child: AnimatedOpacity(
|
||||||
type: MaterialType.transparency,
|
duration: const Duration(milliseconds: 250),
|
||||||
child: Row(
|
opacity: canShow ? 1 : 0,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
child: Material(
|
||||||
children: [
|
type: MaterialType.transparency,
|
||||||
Expanded(
|
child: Row(
|
||||||
child: MouseRegion(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
cursor: SystemMouseCursors.click,
|
children: [
|
||||||
child: GestureDetector(
|
Expanded(
|
||||||
onTap: () => GoRouter.of(context).push("/player"),
|
child: MouseRegion(
|
||||||
child: PlayerTrackDetails(
|
cursor: SystemMouseCursors.click,
|
||||||
albumArt: albumArt,
|
child: GestureDetector(
|
||||||
color: paletteColor.bodyTextColor,
|
onTap: () => GoRouter.of(context).push("/player"),
|
||||||
|
child: PlayerTrackDetails(
|
||||||
|
albumArt: albumArt,
|
||||||
|
color: paletteColor.bodyTextColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
IconButton(
|
||||||
IconButton(
|
icon: const Icon(Icons.skip_previous_rounded),
|
||||||
icon: const Icon(Icons.skip_previous_rounded),
|
|
||||||
color: paletteColor.bodyTextColor,
|
|
||||||
onPressed: () {
|
|
||||||
onPrevious();
|
|
||||||
}),
|
|
||||||
Consumer(
|
|
||||||
builder: (context, ref, _) {
|
|
||||||
return IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
ref.read(playbackProvider).isPlaying
|
|
||||||
? Icons.pause_rounded
|
|
||||||
: Icons.play_arrow_rounded,
|
|
||||||
),
|
|
||||||
color: paletteColor.bodyTextColor,
|
color: paletteColor.bodyTextColor,
|
||||||
onPressed: Actions.handler<PlayPauseIntent>(
|
onPressed: () {
|
||||||
context,
|
onPrevious();
|
||||||
PlayPauseIntent(ref),
|
}),
|
||||||
),
|
Consumer(
|
||||||
);
|
builder: (context, ref, _) {
|
||||||
},
|
return IconButton(
|
||||||
),
|
icon: Icon(
|
||||||
IconButton(
|
ref.read(playbackProvider).isPlaying
|
||||||
icon: const Icon(Icons.skip_next_rounded),
|
? Icons.pause_rounded
|
||||||
onPressed: () => onNext(),
|
: Icons.play_arrow_rounded,
|
||||||
color: paletteColor.bodyTextColor,
|
),
|
||||||
),
|
color: paletteColor.bodyTextColor,
|
||||||
],
|
onPressed: Actions.handler<PlayPauseIntent>(
|
||||||
),
|
context,
|
||||||
],
|
PlayPauseIntent(ref),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.skip_next_rounded),
|
||||||
|
onPressed: () => onNext(),
|
||||||
|
color: paletteColor.bodyTextColor,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -233,7 +233,6 @@ class TrackCollectionView extends HookConsumerWidget {
|
|||||||
onTrackPlayButtonPressed: onPlay,
|
onTrackPlayButtonPressed: onPlay,
|
||||||
playlistId: id,
|
playlistId: id,
|
||||||
userPlaylist: isOwned,
|
userPlaylist: isOwned,
|
||||||
bottomSpace: bottomSpace,
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
error: (error, _) =>
|
error: (error, _) =>
|
||||||
|
@ -15,7 +15,6 @@ class TracksTableView extends HookConsumerWidget {
|
|||||||
final List<Track> tracks;
|
final List<Track> tracks;
|
||||||
final bool userPlaylist;
|
final bool userPlaylist;
|
||||||
final String? playlistId;
|
final String? playlistId;
|
||||||
final bool bottomSpace;
|
|
||||||
final bool isSliver;
|
final bool isSliver;
|
||||||
|
|
||||||
final Widget? heading;
|
final Widget? heading;
|
||||||
@ -26,7 +25,6 @@ class TracksTableView extends HookConsumerWidget {
|
|||||||
this.userPlaylist = false,
|
this.userPlaylist = false,
|
||||||
this.playlistId,
|
this.playlistId,
|
||||||
this.heading,
|
this.heading,
|
||||||
this.bottomSpace = false,
|
|
||||||
this.isSliver = true,
|
this.isSliver = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -191,7 +189,6 @@ class TracksTableView extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
if (bottomSpace) const SizedBox(height: 70),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (isSliver) {
|
if (isSliver) {
|
||||||
|
Loading…
Reference in New Issue
Block a user