mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-21 15:02:21 +02:00
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.
27 lines
864 B
Dart
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,
|
|
),
|
|
);
|
|
}
|