import 'package:flutter/material.dart'; import '../../../../shared/theme/app_theme.dart'; /// Page principale du tableau de bord - Version simple class DashboardPage extends StatefulWidget { const DashboardPage({super.key}); @override State createState() => _DashboardPageState(); } class _DashboardPageState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('UnionFlow - Tableau de bord'), backgroundColor: AppTheme.primaryColor, foregroundColor: Colors.white, elevation: 0, actions: [ IconButton( icon: const Icon(Icons.notifications_outlined), onPressed: () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Notifications - Fonctionnalité à venir'), duration: Duration(seconds: 2), ), ); }, ), IconButton( icon: const Icon(Icons.settings_outlined), onPressed: () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Paramètres - Fonctionnalité à venir'), duration: Duration(seconds: 2), ), ); }, ), ], ), body: RefreshIndicator( onRefresh: _refreshDashboard, child: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Message de bienvenue Card( child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Bienvenue sur UnionFlow', style: Theme.of(context).textTheme.headlineSmall?.copyWith( fontWeight: FontWeight.bold, color: AppTheme.primaryColor, ), ), const SizedBox(height: 8), Text( 'Votre plateforme de gestion d\'union familiale', style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.grey[600], ), ), ], ), ), ), const SizedBox(height: 24), // Statistiques rapides Row( children: [ Expanded( child: _buildStatCard( 'Membres', '25', Icons.people, Colors.blue, ), ), const SizedBox(width: 16), Expanded( child: _buildStatCard( 'Cotisations', '15', Icons.payment, Colors.green, ), ), ], ), const SizedBox(height: 16), Row( children: [ Expanded( child: _buildStatCard( 'Événements', '8', Icons.event, Colors.orange, ), ), const SizedBox(width: 16), Expanded( child: _buildStatCard( 'Solidarité', '3', Icons.favorite, Colors.red, ), ), ], ), const SizedBox(height: 24), // Actions rapides Text( 'Actions rapides', style: Theme.of(context).textTheme.titleLarge?.copyWith( fontWeight: FontWeight.bold, ), ), const SizedBox(height: 16), GridView.count( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), crossAxisCount: 2, crossAxisSpacing: 16, mainAxisSpacing: 16, childAspectRatio: 1.5, children: [ _buildActionCard( 'Nouveau membre', Icons.person_add, Colors.blue, () => _showComingSoon('Nouveau membre'), ), _buildActionCard( 'Nouvelle cotisation', Icons.add_card, Colors.green, () => _showComingSoon('Nouvelle cotisation'), ), _buildActionCard( 'Nouvel événement', Icons.event_available, Colors.orange, () => _showComingSoon('Nouvel événement'), ), _buildActionCard( 'Demande d\'aide', Icons.help_outline, Colors.red, () => _showComingSoon('Demande d\'aide'), ), ], ), const SizedBox(height: 24), ], ), ), ), ); } Widget _buildStatCard(String title, String value, IconData icon, Color color) { return Card( child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Icon(icon, color: color, size: 24), Text( value, style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, color: color, ), ), ], ), const SizedBox(height: 8), Text( title, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w500, ), ), ], ), ), ); } Widget _buildActionCard(String title, IconData icon, Color color, VoidCallback onTap) { return Card( child: InkWell( onTap: onTap, borderRadius: BorderRadius.circular(8), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(icon, color: color, size: 32), const SizedBox(height: 8), Text( title, textAlign: TextAlign.center, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w500, ), ), ], ), ), ), ); } void _showComingSoon(String feature) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('$feature - Fonctionnalité à venir'), duration: const Duration(seconds: 2), ), ); } Future _refreshDashboard() async { // Simuler un délai de rafraîchissement await Future.delayed(const Duration(seconds: 1)); if (mounted) { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Tableau de bord actualisé'), duration: Duration(seconds: 2), backgroundColor: Colors.green, ), ); } } }