feat(ux): unify added-to-queue snackbars and add fetch retry

Every single-track enqueue now shows the shared added-to-queue
snackbar with a View action into Library (six call sites through one
helper). URL fetch failures in Home and via share intent gain a Retry
action; unrecognized-URL errors deliberately keep none since retrying
is deterministic.
This commit is contained in:
zarzet
2026-07-26 19:00:31 +07:00
parent 69830f6d46
commit 424ca5d77e
5 changed files with 42 additions and 34 deletions
+2 -4
View File
@@ -8,6 +8,7 @@ import 'package:spotiflac_android/providers/library_collections_provider.dart';
import 'package:spotiflac_android/providers/local_library_provider.dart';
import 'package:spotiflac_android/providers/settings_provider.dart';
import 'package:spotiflac_android/widgets/download_service_picker.dart';
import 'package:spotiflac_android/widgets/view_queue_snackbar_action.dart';
/// Shared single-track "add to queue" flow for detail screens: shows the
/// quality/service picker when the user opted into it, otherwise resolves
@@ -24,10 +25,7 @@ void downloadSingleTrack(
final settings = ref.read(settingsProvider);
void notifyQueued() {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(context.l10n.snackbarAddedToQueue(track.name))),
);
showAddedToQueueSnackBar(context, track.name);
}
if (settings.askQualityBeforeDownload || forceQualityPicker) {
@@ -10,3 +10,14 @@ SnackBarAction buildViewQueueSnackBarAction(BuildContext context) {
},
);
}
/// Shared "Added to queue" snackbar with a View action jumping to Library.
void showAddedToQueueSnackBar(BuildContext context, String trackName) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(context.l10n.snackbarAddedToQueue(trackName)),
action: buildViewQueueSnackBarAction(context),
),
);
}