🐛 Bug fixes

This commit is contained in:
LittleSheep 2024-08-30 13:23:57 +08:00
parent f16c216479
commit 07a86c32a0
3 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,7 @@
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart'; import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart';
import 'package:rhythm_box/widgets/player/bottom_player.dart'; import 'package:rhythm_box/widgets/player/bottom_player.dart';
@ -22,13 +25,15 @@ class LyricsScreen extends StatelessWidget {
), ),
], ],
), ),
bottomNavigationBar: const SizedBox( bottomNavigationBar: SizedBox(
height: 85, height: 85 + max(MediaQuery.of(context).padding.bottom, 16),
child: Material( child: Material(
elevation: 2, elevation: 2,
child: BottomPlayer( child: const BottomPlayer(
key: Key('lyrics-page-bottom-player'), key: Key('lyrics-page-bottom-player'),
usePop: true, usePop: true,
).paddingOnly(
bottom: max(MediaQuery.of(context).padding.bottom, 16),
), ),
), ),
), ),

View File

@ -9,6 +9,7 @@ import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:media_kit/media_kit.dart'; import 'package:media_kit/media_kit.dart';
import 'package:rhythm_box/providers/audio_player.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/queue.dart';
import 'package:rhythm_box/screens/player/siblings.dart'; import 'package:rhythm_box/screens/player/siblings.dart';
import 'package:rhythm_box/services/artist.dart'; import 'package:rhythm_box/services/artist.dart';
@ -30,6 +31,7 @@ class PlayerScreen extends StatefulWidget {
class _PlayerScreenState extends State<PlayerScreen> { class _PlayerScreenState extends State<PlayerScreen> {
late final AudioPlayerProvider _playback = Get.find(); late final AudioPlayerProvider _playback = Get.find();
late final QueryingTrackInfoProvider _query = Get.find(); late final QueryingTrackInfoProvider _query = Get.find();
late final AuthenticationProvider _auth = Get.find();
String? get _albumArt => String? get _albumArt =>
(_playback.state.value.activeTrack?.album?.images).asUrlString( (_playback.state.value.activeTrack?.album?.images).asUrlString(
@ -74,6 +76,7 @@ class _PlayerScreenState extends State<PlayerScreen> {
children: [ children: [
Expanded( Expanded(
child: ListView( child: ListView(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 24), padding: const EdgeInsets.symmetric(vertical: 24),
children: [ children: [
Obx( Obx(
@ -133,7 +136,8 @@ class _PlayerScreenState extends State<PlayerScreen> {
], ],
), ),
), ),
if (_playback.state.value.activeTrack != null) if (_playback.state.value.activeTrack != null &&
_auth.auth.value != null)
TrackHeartButton( TrackHeartButton(
trackId: _playback.state.value.activeTrack!.id!, trackId: _playback.state.value.activeTrack!.id!,
), ),

View File

@ -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/audio_player/audio_player.dart';
import 'package:rhythm_box/services/server/active_sourced_track.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/server/sourced_track.dart';
import 'package:rhythm_box/services/sourced_track/sourced_track.dart';
import 'package:shelf/shelf.dart'; import 'package:shelf/shelf.dart';
class ServerPlaybackRoutesProvider { class ServerPlaybackRoutesProvider {
@ -21,10 +20,10 @@ class ServerPlaybackRoutesProvider {
final ActiveSourcedTrackProvider activeSourcedTrack = Get.find(); final ActiveSourcedTrackProvider activeSourcedTrack = Get.find();
final sourcedTrack = activeSourcedTrack.state.value?.id == track.id final sourcedTrack = activeSourcedTrack.state.value?.id == track.id
? activeSourcedTrack ? activeSourcedTrack.state.value
: await Get.find<SourcedTrackProvider>().fetch(RhythmMedia(track)); : await Get.find<SourcedTrackProvider>().fetch(RhythmMedia(track));
activeSourcedTrack.updateTrack(sourcedTrack as SourcedTrack?); activeSourcedTrack.updateTrack(sourcedTrack);
final res = await Dio().get( final res = await Dio().get(
sourcedTrack!.url, sourcedTrack!.url,