showError static method
void
showError(
- BuildContext context,
- String message, {
- Duration duration = const Duration(seconds: 3),
- VoidCallback? onRetry,
显示错误提示
Implementation
static void showError(
BuildContext context,
String message, {
Duration duration = const Duration(seconds: 3),
VoidCallback? onRetry,
}) {
_showToast(
context,
message,
icon: Icons.error_outline,
iconColor: const Color(0xFFE53935),
backgroundColor: const Color(0xFFFEF5F5),
textColor: const Color(0xFFC62828),
duration: duration,
action: onRetry != null
? SnackBarAction(
label: '重试',
textColor: const Color(0xFFE53935),
onPressed: onRetry,
)
: null,
);
}