import 'package:flutter/material.dart'; /// A reusable widget for displaying empty states throughout the app class EmptyStateWidget extends StatelessWidget { /// The message to display final String message; /// Optional icon to display above the message final IconData? icon; /// Optional callback for action button final VoidCallback? onAction; /// Optional label for the action button final String? actionLabel; const EmptyStateWidget({ super.key, required this.message, this.icon, this.onAction, this.actionLabel, }); @override Widget build(BuildContext context) { return Center( child: Padding( padding: const EdgeInsets.all(24.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ if (icon != null) ...[ Icon( icon, size: 64, color: Theme.of(context).colorScheme.onSurface.withOpacity(0.4), ), const SizedBox(height: 16), ], Text( message, textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyLarge?.copyWith( color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6), ), ), if (onAction != null && actionLabel != null) ...[ const SizedBox(height: 24), FilledButton.icon( onPressed: onAction, icon: const Icon(Icons.add), label: Text(actionLabel!), ), ], ], ), ), ); } }