From 07a86c32a0a328ba9a49e73f9be9184318ca45a1 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 30 Aug 2024 13:23:57 +0800 Subject: [PATCH] :bug: Bug fixes --- lib/screens/player/lyrics.dart | 11 ++++++++--- lib/screens/player/view.dart | 6 +++++- lib/services/server/routes/playback.dart | 5 ++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/screens/player/lyrics.dart b/lib/screens/player/lyrics.dart index e239138..b2cb54b 100644 --- a/lib/screens/player/lyrics.dart +++ b/lib/screens/player/lyrics.dart @@ -1,4 +1,7 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart'; import 'package:rhythm_box/widgets/player/bottom_player.dart'; @@ -22,13 +25,15 @@ class LyricsScreen extends StatelessWidget { ), ], ), - bottomNavigationBar: const SizedBox( - height: 85, + bottomNavigationBar: SizedBox( + height: 85 + max(MediaQuery.of(context).padding.bottom, 16), child: Material( elevation: 2, - child: BottomPlayer( + child: const BottomPlayer( key: Key('lyrics-page-bottom-player'), usePop: true, + ).paddingOnly( + bottom: max(MediaQuery.of(context).padding.bottom, 16), ), ), ), diff --git a/lib/screens/player/view.dart b/lib/screens/player/view.dart index 3ea5350..ed46b63 100644 --- a/lib/screens/player/view.dart +++ b/lib/screens/player/view.dart @@ -9,6 +9,7 @@ import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:media_kit/media_kit.dart'; import 'package:rhythm_box/providers/audio_player.dart'; +import 'package:rhythm_box/providers/auth.dart'; import 'package:rhythm_box/screens/player/queue.dart'; import 'package:rhythm_box/screens/player/siblings.dart'; import 'package:rhythm_box/services/artist.dart'; @@ -30,6 +31,7 @@ class PlayerScreen extends StatefulWidget { class _PlayerScreenState extends State { late final AudioPlayerProvider _playback = Get.find(); late final QueryingTrackInfoProvider _query = Get.find(); + late final AuthenticationProvider _auth = Get.find(); String? get _albumArt => (_playback.state.value.activeTrack?.album?.images).asUrlString( @@ -74,6 +76,7 @@ class _PlayerScreenState extends State { children: [ Expanded( child: ListView( + shrinkWrap: true, padding: const EdgeInsets.symmetric(vertical: 24), children: [ Obx( @@ -133,7 +136,8 @@ class _PlayerScreenState extends State { ], ), ), - if (_playback.state.value.activeTrack != null) + if (_playback.state.value.activeTrack != null && + _auth.auth.value != null) TrackHeartButton( trackId: _playback.state.value.activeTrack!.id!, ), diff --git a/lib/services/server/routes/playback.dart b/lib/services/server/routes/playback.dart index 5cba05e..e2fb5bf 100755 --- a/lib/services/server/routes/playback.dart +++ b/lib/services/server/routes/playback.dart @@ -7,7 +7,6 @@ import 'package:rhythm_box/providers/audio_player.dart'; import 'package:rhythm_box/services/audio_player/audio_player.dart'; import 'package:rhythm_box/services/server/active_sourced_track.dart'; import 'package:rhythm_box/services/server/sourced_track.dart'; -import 'package:rhythm_box/services/sourced_track/sourced_track.dart'; import 'package:shelf/shelf.dart'; class ServerPlaybackRoutesProvider { @@ -21,10 +20,10 @@ class ServerPlaybackRoutesProvider { final ActiveSourcedTrackProvider activeSourcedTrack = Get.find(); final sourcedTrack = activeSourcedTrack.state.value?.id == track.id - ? activeSourcedTrack + ? activeSourcedTrack.state.value : await Get.find().fetch(RhythmMedia(track)); - activeSourcedTrack.updateTrack(sourcedTrack as SourcedTrack?); + activeSourcedTrack.updateTrack(sourcedTrack); final res = await Dio().get( sourcedTrack!.url,