import 'package:flutter/material.dart'; class ErrorView extends StatelessWidget { final String message; final VoidCallback? onRetry; final String? retryText; final IconData? icon; const ErrorView({ super.key, required this.message, this.onRetry, this.retryText, this.icon, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Center( child: Padding( padding: const EdgeInsets.all(32), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 100, height: 100, decoration: BoxDecoration( color: theme.colorScheme.error.withValues(alpha: 26), shape: BoxShape.circle, ), child: Icon( icon ?? Icons.error_outline, size: 48, color: theme.colorScheme.error, ), ), const SizedBox(height: 24), Text( 'Oops!', style: theme.textTheme.headlineMedium?.copyWith( fontWeight: FontWeight.bold, color: theme.colorScheme.onSurface, ), ), const SizedBox(height: 12), Text( message, style: theme.textTheme.bodyMedium?.copyWith( color: theme.colorScheme.onSurface.withValues(alpha: 179), ), textAlign: TextAlign.center, ), if (onRetry != null) ...[ const SizedBox(height: 32), ElevatedButton.icon( onPressed: onRetry, icon: const Icon(Icons.refresh), label: Text(retryText ?? 'Erneut versuchen'), ), ], ], ), ), ); } } class EmptyStateView extends StatelessWidget { final String title; final String? subtitle; final IconData icon; final VoidCallback? onAction; final String? actionText; const EmptyStateView({ super.key, required this.title, this.subtitle, this.icon = Icons.inbox, this.onAction, this.actionText, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Center( child: Padding( padding: const EdgeInsets.all(32), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 100, height: 100, decoration: BoxDecoration( color: Colors.grey.shade200, shape: BoxShape.circle, ), child: Icon( icon, size: 48, color: Colors.grey.shade500, ), ), const SizedBox(height: 24), Text( title, style: theme.textTheme.titleLarge?.copyWith( fontWeight: FontWeight.w600, color: theme.colorScheme.onSurface, ), textAlign: TextAlign.center, ), if (subtitle != null) ...[ const SizedBox(height: 8), Text( subtitle!, style: theme.textTheme.bodyMedium?.copyWith( color: theme.colorScheme.onSurface.withValues(alpha: 153), ), textAlign: TextAlign.center, ), ], if (onAction != null && actionText != null) ...[ const SizedBox(height: 24), ElevatedButton( onPressed: onAction, child: Text(actionText!), ), ], ], ), ), ); } }