mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-03 09:38:35 +02:00
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:
@@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user