refactoring

This commit is contained in:
dahoud
2026-03-31 09:14:47 +00:00
parent 9bfffeeebe
commit 5383df6dcb
200 changed files with 11192 additions and 7063 deletions

View File

@@ -38,150 +38,95 @@ class ConsultantDashboard extends StatelessWidget {
final stats = dashboardData?.stats;
return SingleChildScrollView(
padding: const EdgeInsets.all(24),
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// En-tête Consultant
AnimatedFadeIn(
delay: const Duration(milliseconds: 100),
child: _buildUserHeader(),
),
const SizedBox(height: 24),
// En-tête Consultant
AnimatedFadeIn(
delay: const Duration(milliseconds: 100),
child: UserIdentityCard(
initials: 'CON',
name: 'Consultant Expert',
subtitle: 'Expertise & Analyses Stratégiques',
badgeLabel: 'EXPERT',
gradient: LinearGradient(
colors: [UnionFlowColors.amber, UnionFlowColors.gold],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
accentColor: UnionFlowColors.amber,
),
),
const SizedBox(height: 12),
// Stats missions (données backend réelles)
// Stats missions
AnimatedSlideIn(
delay: const Duration(milliseconds: 200),
child: Row(
child: GridView.count(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 2,
mainAxisSpacing: 6,
crossAxisSpacing: 6,
childAspectRatio: 2.0,
children: [
Expanded(
child: UnionStatWidget(
label: 'Événements',
value: '${stats?.totalEvents ?? 0}',
icon: Icons.work_outline,
color: UnionFlowColors.amber,
trend: stats?.upcomingEvents != null ? '${stats!.upcomingEvents} à venir' : null,
isTrendUp: true,
),
UnionStatWidget(
label: 'Événements',
value: '${stats?.totalEvents ?? 0}',
icon: Icons.work_outline,
color: UnionFlowColors.amber,
trend: stats?.upcomingEvents != null ? '${stats!.upcomingEvents} à venir' : null,
isTrendUp: true,
),
const SizedBox(width: 12),
Expanded(
child: UnionStatWidget(
label: 'Organisations',
value: '${stats?.totalOrganizations ?? 0}',
icon: Icons.business_outlined,
color: UnionFlowColors.indigo,
),
UnionStatWidget(
label: 'Organisations',
value: '${stats?.totalOrganizations ?? 0}',
icon: Icons.business_outlined,
color: UnionFlowColors.indigo,
),
UnionStatWidget(
label: 'Demandes',
value: '${stats?.pendingRequests ?? 0}',
icon: Icons.pending_actions,
color: UnionFlowColors.warning,
),
UnionStatWidget(
label: 'Membres',
value: '${stats?.totalMembers ?? 0}',
icon: Icons.people_outline,
color: UnionFlowColors.success,
),
],
),
),
const SizedBox(height: 12),
AnimatedFadeIn(
delay: const Duration(milliseconds: 300),
child: Row(
children: [
Expanded(
child: UnionStatWidget(
label: 'Demandes',
value: '${stats?.pendingRequests ?? 0}',
icon: Icons.pending_actions,
color: UnionFlowColors.warning,
),
),
const SizedBox(width: 12),
Expanded(
child: UnionStatWidget(
label: 'Membres',
value: '${stats?.totalMembers ?? 0}',
icon: Icons.people_outline,
color: UnionFlowColors.success,
),
),
],
),
),
const SizedBox(height: 24),
// Événements à venir (données backend)
// Événements à venir
if (dashboardData != null && dashboardData.hasUpcomingEvents) ...[
AnimatedFadeIn(
delay: const Duration(milliseconds: 400),
child: const Text(
child: UFSectionHeader(
'Prochains Événements',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: UnionFlowColors.textPrimary,
),
trailing: '${dashboardData.upcomingEvents.length} programmés',
),
),
const SizedBox(height: 16),
const SizedBox(height: 8),
AnimatedSlideIn(
delay: const Duration(milliseconds: 500),
child: Column(
children: dashboardData.upcomingEvents.take(3).map((event) =>
Container(
margin: const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: UnionFlowColors.surface,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: UnionFlowColors.border, width: 1),
boxShadow: UnionFlowColors.softShadow,
),
child: Row(
children: [
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
gradient: UnionFlowColors.warmGradient,
borderRadius: BorderRadius.circular(10),
),
child: const Icon(
Icons.calendar_today,
color: Colors.white,
size: 22,
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
event.title,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: UnionFlowColors.textPrimary,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 4),
Text(
event.formattedDate,
style: const TextStyle(
fontSize: 12,
color: UnionFlowColors.textSecondary,
),
),
],
),
),
],
),
)
DashboardEventRow(
title: event.title,
date: event.formattedDate,
),
).toList(),
),
),
const SizedBox(height: 24),
const SizedBox(height: 12),
],
// Répartition organisations par type (données backend)
// Répartition organisations par type
if (stats != null && stats.organizationTypeDistribution != null && stats.organizationTypeDistribution!.isNotEmpty) ...[
AnimatedFadeIn(
delay: const Duration(milliseconds: 600),
@@ -191,90 +136,64 @@ class ConsultantDashboard extends StatelessWidget {
sections: _buildOrgTypeSections(stats.organizationTypeDistribution!),
),
),
const SizedBox(height: 24),
const SizedBox(height: 12),
],
// Actions consultant
// Mes Outils
AnimatedFadeIn(
delay: const Duration(milliseconds: 700),
child: const Text(
'Mes Outils',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: UnionFlowColors.textPrimary,
child: const UFSectionHeader('Mes Outils'),
),
),
),
const SizedBox(height: 16),
const SizedBox(height: 8),
AnimatedSlideIn(
delay: const Duration(milliseconds: 700),
child: Row(
children: [
Expanded(
child: UnionActionButton(
label: 'Audits',
icon: Icons.assessment,
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const ReportsPageWrapper())),
backgroundColor: UnionFlowColors.unionGreen,
),
AnimatedSlideIn(
delay: const Duration(milliseconds: 700),
child: GridView.count(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 3,
mainAxisSpacing: 6,
crossAxisSpacing: 6,
childAspectRatio: 2.8,
children: [
UnionActionButton(
label: 'Audits',
icon: Icons.assessment,
iconColor: UnionFlowColors.unionGreen,
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ReportsPageWrapper())),
),
UnionActionButton(
label: 'Analyses',
icon: Icons.analytics,
iconColor: UnionFlowColors.indigo,
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ReportsPageWrapper())),
),
UnionActionButton(
label: 'Rapports',
icon: Icons.description,
iconColor: UnionFlowColors.gold,
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ReportsPageWrapper())),
),
UnionActionButton(
label: 'Clients',
icon: Icons.people_outline,
iconColor: UnionFlowColors.amber,
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const MembersPageWrapper())),
),
UnionActionButton(
label: 'Calendrier',
icon: Icons.calendar_today,
iconColor: UnionFlowColors.terracotta,
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
),
UnionActionButton(
label: 'Documents',
icon: Icons.folder_outlined,
iconColor: UnionFlowColors.info,
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const HelpSupportPage())),
),
],
),
const SizedBox(width: 12),
Expanded(
child: UnionActionButton(
label: 'Analyses',
icon: Icons.analytics,
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const ReportsPageWrapper())),
backgroundColor: UnionFlowColors.indigo,
),
),
const SizedBox(width: 12),
Expanded(
child: UnionActionButton(
label: 'Rapports',
icon: Icons.description,
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const ReportsPageWrapper())),
backgroundColor: UnionFlowColors.gold,
),
),
],
),
),
const SizedBox(height: 12),
AnimatedSlideIn(
delay: const Duration(milliseconds: 800),
child: Row(
children: [
Expanded(
child: UnionActionButton(
label: 'Clients',
icon: Icons.people_outline,
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const MembersPageWrapper())),
backgroundColor: UnionFlowColors.amber,
),
),
const SizedBox(width: 12),
Expanded(
child: UnionActionButton(
label: 'Calendrier',
icon: Icons.calendar_today,
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const EventsPageWrapper())),
backgroundColor: UnionFlowColors.terracotta,
),
),
const SizedBox(width: 12),
Expanded(
child: UnionActionButton(
label: 'Documents',
icon: Icons.folder_outlined,
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const HelpSupportPage())),
backgroundColor: UnionFlowColors.info,
),
),
],
),
),
],
),
@@ -303,35 +222,14 @@ class ConsultantDashboard extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
),
alignment: Alignment.center,
child: const Text(
'C',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w900,
fontSize: 18,
),
),
child: const Text('C', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w900, fontSize: 18)),
),
const SizedBox(width: 12),
const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'UnionFlow',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: UnionFlowColors.textPrimary,
),
),
Text(
'Consultant',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w400,
color: UnionFlowColors.textSecondary,
),
),
Text('UnionFlow', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
Text('Consultant', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w400, color: UnionFlowColors.textSecondary)),
],
),
],
@@ -348,88 +246,8 @@ class ConsultantDashboard extends StatelessWidget {
);
}
Widget _buildUserHeader() {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [UnionFlowColors.amber, UnionFlowColors.gold],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(16),
border: const Border(
top: BorderSide(color: UnionFlowColors.amber, width: 3),
),
boxShadow: [
BoxShadow(
color: UnionFlowColors.amber.withOpacity(0.3),
blurRadius: 12,
offset: const Offset(0, 4),
),
],
),
child: Row(
children: [
CircleAvatar(
radius: 28,
backgroundColor: Colors.white.withOpacity(0.3),
child: const Text(
'CON',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Consultant Expert',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
const SizedBox(height: 4),
Text(
'Expertise & Analyses Stratégiques',
style: TextStyle(
fontSize: 12,
color: Colors.white.withOpacity(0.9),
),
),
],
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: const Text(
'EXPERT',
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w800,
color: UnionFlowColors.amber,
letterSpacing: 0.5,
),
),
),
],
),
);
}
List<PieChartSectionData> _buildOrgTypeSections(Map<String, int> distribution) {
final colors = [
const colors = [
UnionFlowColors.unionGreen,
UnionFlowColors.gold,
UnionFlowColors.indigo,
@@ -451,5 +269,3 @@ class ConsultantDashboard extends StatelessWidget {
});
}
}