TEmptyState.error constructor
TEmptyState.error({
- Key? key,
- String title = 'Something went wrong',
- String description = 'Failed to load data. Please check your connection and try again.',
- VoidCallback? onRetry,
- Widget? action,
- bool compact = false,
- EdgeInsetsGeometry padding = const EdgeInsets.all(32.0),
Creates an error / failure empty state with an optional retry callback.
Implementation
factory TEmptyState.error({
Key? key,
String title = 'Something went wrong',
String description = 'Failed to load data. Please check your connection and try again.',
VoidCallback? onRetry,
Widget? action,
bool compact = false,
EdgeInsetsGeometry padding = const EdgeInsets.all(32.0),
}) {
final effectiveAction = action ??
(onRetry != null
? TButton(
text: 'Try Again',
icon: Icons.refresh_rounded,
type: TButtonType.tonal,
size: TButtonSize.xs,
onPressed: (_) => onRetry(),
)
: null);
return TEmptyState(
key: key,
icon: Icons.error_outline_rounded,
iconColor: Colors.redAccent,
title: title,
description: description,
action: effectiveAction,
compact: compact,
padding: padding,
);
}