mirror of
https://github.com/gokadzev/Musify.git
synced 2025-05-17 22:46:05 +08:00
fix(musify): fixed some bugs related to lyrics
This commit is contained in:
@ -779,7 +779,8 @@ Future<Map<String, dynamic>> getSongDetails(
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> getSongLyrics(String artist, String title) async {
|
||||
Future<String?> getSongLyrics(String? artist, String title) async {
|
||||
if (artist == null) return null;
|
||||
if (lastFetchedLyrics != '$artist - $title') {
|
||||
lyrics.value = null;
|
||||
var _lyrics = await LyricsManager().fetchLyrics(artist, title);
|
||||
@ -788,7 +789,7 @@ Future<String?> getSongLyrics(String artist, String title) async {
|
||||
_lyrics = _lyrics.replaceAll(RegExp(r'\n{4}'), '\n\n');
|
||||
lyrics.value = _lyrics;
|
||||
} else {
|
||||
lyrics.value = 'not found';
|
||||
return null;
|
||||
}
|
||||
|
||||
lastFetchedLyrics = '$artist - $title';
|
||||
|
@ -227,11 +227,11 @@ class NowPlayingArtwork extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(_radius),
|
||||
),
|
||||
child: FutureBuilder<String?>(
|
||||
future: getSongLyrics(metadata.artist ?? '', metadata.title),
|
||||
future: getSongLyrics(metadata.artist, metadata.title),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Spinner();
|
||||
} else if (snapshot.hasError || snapshot.data == 'not found') {
|
||||
} else if (snapshot.hasError || snapshot.data == null) {
|
||||
return Center(
|
||||
child: Text(
|
||||
context.l10n!.lyricsNotAvailable,
|
||||
|
Reference in New Issue
Block a user