fix: PlayerOverlay not hiding when not playing and unneeded bottom space in TrackTableView

This commit is contained in:
Kingkor Roy Tirtho 2022-10-11 14:57:26 +06:00
parent 0ca97b495f
commit 0ebac05a4b
3 changed files with 59 additions and 51 deletions

View File

@ -21,6 +21,14 @@ class PlayerOverlay extends HookConsumerWidget {
@override
Widget build(BuildContext context, 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 onPrevious = usePreviousTrack(ref);
@ -38,9 +46,9 @@ class PlayerOverlay extends HookConsumerWidget {
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
child: AnimatedContainer(
duration: const Duration(milliseconds: 500),
duration: const Duration(milliseconds: 250),
width: MediaQuery.of(context).size.width,
height: 50,
height: canShow ? 50 : 0,
decoration: BoxDecoration(
color: paletteColor.color.withOpacity(.7),
border: Border.all(
@ -49,6 +57,9 @@ class PlayerOverlay extends HookConsumerWidget {
),
borderRadius: BorderRadius.circular(5),
),
child: AnimatedOpacity(
duration: const Duration(milliseconds: 250),
opacity: canShow ? 1 : 0,
child: Material(
type: MaterialType.transparency,
child: Row(
@ -103,6 +114,7 @@ class PlayerOverlay extends HookConsumerWidget {
),
),
),
),
);
}
}

View File

@ -233,7 +233,6 @@ class TrackCollectionView extends HookConsumerWidget {
onTrackPlayButtonPressed: onPlay,
playlistId: id,
userPlaylist: isOwned,
bottomSpace: bottomSpace,
);
},
error: (error, _) =>

View File

@ -15,7 +15,6 @@ class TracksTableView extends HookConsumerWidget {
final List<Track> tracks;
final bool userPlaylist;
final String? playlistId;
final bool bottomSpace;
final bool isSliver;
final Widget? heading;
@ -26,7 +25,6 @@ class TracksTableView extends HookConsumerWidget {
this.userPlaylist = false,
this.playlistId,
this.heading,
this.bottomSpace = false,
this.isSliver = true,
}) : super(key: key);
@ -191,7 +189,6 @@ class TracksTableView extends HookConsumerWidget {
),
);
}).toList(),
if (bottomSpace) const SizedBox(height: 70),
];
if (isSliver) {