fix: show toast error and fallback icon when album art fails to load

This commit is contained in:
2022-08-06 02:25:55 +03:00
parent 100157a8d4
commit 197be6330b
5 changed files with 22 additions and 3 deletions
-1
View File
@@ -45,7 +45,6 @@ class _LyricsPageState extends State<LyricsPage> {
lyrics = fullLyrics;
fetching = false;
});
// print(thing);
}
}
+12
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'lyrics.dart';
@@ -135,6 +136,17 @@ class _SearchResultState extends State<SearchResult> {
width: 75,
height: 75,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
Fluttertoast.showToast(
msg: 'Failed to load album art for: ${widget.title}',
toastLength: Toast.LENGTH_LONG);
return const Center(
child: SizedBox(
width: 75,
height: 75,
child: Icon(Icons.broken_image, size: 40)),
);
},
),
),
Flexible(