Authentification stable - WIP
This commit is contained in:
@@ -1,110 +1,270 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../shared/theme/app_theme.dart';
|
||||
import '../../../../core/animations/page_transitions.dart';
|
||||
import '../../../demo/presentation/pages/animations_demo_page.dart';
|
||||
import '../../../debug/debug_api_test_page.dart';
|
||||
import '../../../performance/presentation/pages/performance_demo_page.dart';
|
||||
|
||||
// Imports des nouveaux widgets refactorisés
|
||||
import '../widgets/welcome/welcome_section_widget.dart';
|
||||
import '../widgets/kpi/kpi_cards_widget.dart';
|
||||
import '../widgets/actions/quick_actions_widget.dart';
|
||||
import '../widgets/activities/recent_activities_widget.dart';
|
||||
import '../widgets/charts/charts_analytics_widget.dart';
|
||||
|
||||
// Import de l'architecture unifiée pour amélioration progressive
|
||||
import '../../../../shared/widgets/common/unified_page_layout.dart';
|
||||
|
||||
/// Page principale du tableau de bord UnionFlow
|
||||
///
|
||||
/// Affiche une vue d'ensemble complète de l'association avec :
|
||||
/// - Section d'accueil personnalisée
|
||||
/// - Indicateurs clés de performance (KPI)
|
||||
/// - Actions rapides et gestion
|
||||
/// - Flux d'activités en temps réel
|
||||
/// - Analyses et tendances graphiques
|
||||
///
|
||||
/// Architecture modulaire avec widgets réutilisables pour une
|
||||
/// maintenabilité optimale et une évolutivité facilitée.
|
||||
class DashboardPage extends StatelessWidget {
|
||||
/// Page principale du tableau de bord - Version simple
|
||||
class DashboardPage extends StatefulWidget {
|
||||
const DashboardPage({super.key});
|
||||
|
||||
@override
|
||||
State<DashboardPage> createState() => _DashboardPageState();
|
||||
}
|
||||
|
||||
class _DashboardPageState extends State<DashboardPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Utilisation de UnifiedPageLayout pour améliorer la cohérence
|
||||
// tout en conservant tous les widgets spécialisés existants
|
||||
return UnifiedPageLayout(
|
||||
title: 'Tableau de bord',
|
||||
icon: Icons.dashboard,
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.animation),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
PageTransitions.morphWithBlur(const AnimationsDemoPage()),
|
||||
);
|
||||
},
|
||||
tooltip: 'Démonstration des animations',
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.notifications_outlined),
|
||||
onPressed: () {
|
||||
// TODO: Implémenter la navigation vers les notifications
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.bug_report),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
PageTransitions.slideFromRight(const DebugApiTestPage()),
|
||||
);
|
||||
},
|
||||
tooltip: 'Debug API',
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.speed),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
PageTransitions.slideFromRight(const PerformanceDemoPage()),
|
||||
);
|
||||
},
|
||||
tooltip: 'Performance',
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
onPressed: () {
|
||||
// TODO: Implémenter la navigation vers les paramètres
|
||||
},
|
||||
),
|
||||
],
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 1. ACCUEIL & CONTEXTE - Message de bienvenue personnalisé
|
||||
// CONSERVÉ: Widget spécialisé avec toutes ses fonctionnalités
|
||||
const WelcomeSectionWidget(),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 2. VISION GLOBALE - Indicateurs clés de performance (KPI)
|
||||
// CONSERVÉ: KPI enrichis avec détails, cibles, périodes
|
||||
const KPICardsWidget(),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 3. ACTIONS PRIORITAIRES - Actions rapides et gestion
|
||||
// CONSERVÉ: Grille d'actions organisées par catégories
|
||||
const QuickActionsWidget(),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 4. SUIVI TEMPS RÉEL - Flux d'activités en direct
|
||||
// CONSERVÉ: Activités avec indicateur "Live" et horodatage
|
||||
const RecentActivitiesWidget(),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 5. ANALYSES APPROFONDIES - Graphiques et tendances
|
||||
// CONSERVÉ: 1617 lignes de graphiques sophistiqués avec fl_chart
|
||||
const ChartsAnalyticsWidget(),
|
||||
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<void> _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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user