Files
mobile/lib/core/widgets/empty_state.dart
T

57 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import '../theme/app_colors.dart';
/// État vide avec icône dans un cercle coloré.
class EmptyState extends StatelessWidget {
const EmptyState({
super.key,
required this.icon,
required this.title,
required this.subtitle,
this.iconColor,
this.actionLabel,
this.onAction,
});
final IconData icon;
final String title;
final String subtitle;
final Color? iconColor;
final String? actionLabel;
final VoidCallback? onAction;
@override
Widget build(BuildContext context) {
final color = iconColor ?? AppColors.primary;
return Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 72,
height: 72,
decoration: BoxDecoration(
color: color.withValues(alpha: 0.1),
shape: BoxShape.circle,
),
child: Icon(icon, size: 32, color: color),
),
const SizedBox(height: 16),
Text(title, textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 6),
Text(subtitle, textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyMedium),
if (actionLabel != null && onAction != null) ...[
const SizedBox(height: 20),
OutlinedButton(onPressed: onAction, child: Text(actionLabel!)),
],
],
),
),
);
}
}