build method
Builds the error state widget with icon, message, and optional retry button.
Implementation
@override
Widget build(BuildContext context) {
final errorMessage = _getErrorMessage();
if (kDebugMode) {
debugPrint('Error: $errorMessage');
}
final theme = Theme.of(context);
final defaultTextStyle = _baseTextStyle.copyWith(
color: theme.textTheme.bodyMedium?.color,
);
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.error_outline,
size: iconSize,
color: iconColor ?? theme.colorScheme.error,
),
SizedBox(height: spacing),
Text(
errorMessage,
style: textStyle ?? defaultTextStyle,
textAlign: TextAlign.center,
),
if (showRetryButton && onRetry != null) ...[
SizedBox(height: spacing),
ElevatedButton.icon(
onPressed: onRetry,
icon: const Icon(Icons.refresh),
label: Text(retryButtonText),
),
],
],
),
);
}