showError static method
- BuildContext context,
- String message, {
- Duration duration = const Duration(seconds: 3),
Shows an error snackbar with an error icon.
Implementation
static void showError(
BuildContext context,
String message, {
Duration duration = const Duration(seconds: 3),
}) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Row(
children: [
const Icon(Icons.error_outline, color: Colors.white),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.red.shade600,
behavior: SnackBarBehavior.floating,
duration: duration,
),
);
}