showSnackBar static method
void
showSnackBar({
- required BuildContext context,
- required String message,
- Duration duration = const Duration(seconds: 3),
- bool isError = false,
Exibe uma mensagem de feedback rápido (SnackBar)
Implementation
static void showSnackBar({
required BuildContext context,
required String message,
Duration duration = const Duration(seconds: 3),
bool isError = false,
}) {
final theme = SyncThemeProvider.current;
final messenger = ScaffoldMessenger.of(context);
messenger.hideCurrentSnackBar();
messenger.showSnackBar(
SnackBar(
content: Text(
message,
style: theme.bodyStyle.copyWith(
color: Colors.white,
),
),
backgroundColor: isError ? theme.error : theme.primary,
duration: duration,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
);
}