Files
SpotiFLAC-Mobile/lib/widgets/view_queue_snackbar_action.dart
T
zarzet 799bb0f7a1 fix(ui): make snackbars transient and replace stale messages
Limit transient messages to three seconds, keep action snackbars on a timer, and provide close controls. Apply one latest-message policy to the app and metadata sheet while preserving glass animations.
2026-10-02 18:34:36 +07:00

27 lines
864 B
Dart

import 'package:flutter/material.dart';
import 'package:spotiflac_android/l10n/l10n.dart';
import 'package:spotiflac_android/services/shell_navigation_service.dart';
SnackBarAction buildViewQueueSnackBarAction(BuildContext context) {
return SnackBarAction(
label: context.l10n.snackbarViewQueue,
onPressed: () {
ShellNavigationService.requestTab(ShellTab.library);
},
);
}
/// 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),
duration: const Duration(seconds: 3),
persist: false,
showCloseIcon: true,
),
);
}