refactoring
This commit is contained in:
@@ -8,8 +8,8 @@ class DashboardConfig {
|
||||
|
||||
// Configuration des couleurs
|
||||
static const bool useCustomTheme = true;
|
||||
static const String primaryColorHex = '#4169E1'; // Bleu Roi
|
||||
static const String secondaryColorHex = '#008B8B'; // Bleu Pétrole
|
||||
static const String primaryColorHex = '#2E7D32'; // Vert Forêt
|
||||
static const String secondaryColorHex = '#4CAF50'; // Vert Accentuation
|
||||
|
||||
// Configuration des données (toujours API réelle, pas de données fictives)
|
||||
static String get apiBaseUrl => AppConfig.apiBaseUrl;
|
||||
|
||||
@@ -45,7 +45,7 @@ class DashboardRemoteDataSourceImpl implements DashboardRemoteDataSource {
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getDashboardData', error: e);
|
||||
throw ServerException('Network error: ${e.message}');
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getDashboardData', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
@@ -68,7 +68,7 @@ class DashboardRemoteDataSourceImpl implements DashboardRemoteDataSource {
|
||||
throw const NotFoundException('Profil membre non trouvé');
|
||||
}
|
||||
AppLogger.error('DashboardRemoteDataSource: getMemberDashboardData', error: e);
|
||||
throw ServerException('Network error: ${e.message}');
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getMemberDashboardData', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
@@ -109,7 +109,7 @@ class DashboardRemoteDataSourceImpl implements DashboardRemoteDataSource {
|
||||
throw const NotFoundException('Compte adhérent non trouvé');
|
||||
}
|
||||
AppLogger.error('DashboardRemoteDataSource: getCompteAdherent', error: e);
|
||||
throw ServerException('Network error: ${e.message}');
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getCompteAdherent', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
@@ -135,7 +135,7 @@ class DashboardRemoteDataSourceImpl implements DashboardRemoteDataSource {
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getDashboardStats', error: e);
|
||||
throw ServerException('Network error: ${e.message}');
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getDashboardStats', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
@@ -166,7 +166,7 @@ class DashboardRemoteDataSourceImpl implements DashboardRemoteDataSource {
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getRecentActivities', error: e);
|
||||
throw ServerException('Network error: ${e.message}');
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getRecentActivities', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
@@ -197,7 +197,7 @@ class DashboardRemoteDataSourceImpl implements DashboardRemoteDataSource {
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getUpcomingEvents', error: e);
|
||||
throw ServerException('Network error: ${e.message}');
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
AppLogger.error('DashboardRemoteDataSource: getUpcomingEvents', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
|
||||
@@ -47,14 +47,16 @@ class DashboardRepositoryImpl implements DashboardRepository {
|
||||
@override
|
||||
Future<Either<Failure, DashboardEntity>> getDashboardData(
|
||||
String organizationId,
|
||||
String userId,
|
||||
) async {
|
||||
String userId, {
|
||||
bool useGlobalDashboard = false,
|
||||
}) async {
|
||||
if (!await networkInfo.isConnected) {
|
||||
return const Left(NetworkFailure('No internet connection'));
|
||||
}
|
||||
try {
|
||||
// Membre sans contexte org : utiliser l'API dashboard membre (GET /api/dashboard/membre/me)
|
||||
final useMemberDashboard = organizationId.trim().isEmpty;
|
||||
// useGlobalDashboard=true signifie qu'on veut les stats globales même sans orgId (ex: SUPER_ADMIN)
|
||||
final useMemberDashboard = !useGlobalDashboard && organizationId.trim().isEmpty;
|
||||
if (useMemberDashboard) {
|
||||
// Chargement parallèle de la synthèse et du compte adhérent unifié
|
||||
MembreDashboardSyntheseModel? synthese;
|
||||
@@ -309,8 +311,8 @@ class DashboardRepositoryImpl implements DashboardRepository {
|
||||
monthlyGrowth: model.monthlyGrowth,
|
||||
engagementRate: model.engagementRate,
|
||||
lastUpdated: model.lastUpdated,
|
||||
totalOrganizations: null,
|
||||
organizationTypeDistribution: null,
|
||||
totalOrganizations: model.totalOrganizations,
|
||||
organizationTypeDistribution: model.organizationTypeDistribution,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class FinanceRepository {
|
||||
epargneBalance: epargneBalance,
|
||||
);
|
||||
} on DioException catch (e, st) {
|
||||
if (e.type == DioExceptionType.cancel) rethrow;
|
||||
AppLogger.error('FinanceRepository: getFinancialSummary échoué', error: e, stackTrace: st);
|
||||
rethrow;
|
||||
} catch (e, st) {
|
||||
@@ -50,6 +51,7 @@ class FinanceRepository {
|
||||
.map((json) => _transactionFromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on DioException catch (e, st) {
|
||||
if (e.type == DioExceptionType.cancel) rethrow;
|
||||
AppLogger.error('FinanceRepository: getTransactions échoué', error: e, stackTrace: st);
|
||||
if (e.response?.statusCode == 404) return [];
|
||||
rethrow;
|
||||
|
||||
@@ -9,8 +9,9 @@ abstract class DashboardRepository {
|
||||
|
||||
Future<Either<Failure, DashboardEntity>> getDashboardData(
|
||||
String organizationId,
|
||||
String userId,
|
||||
);
|
||||
String userId, {
|
||||
bool useGlobalDashboard = false,
|
||||
});
|
||||
|
||||
Future<Either<Failure, DashboardStatsEntity>> getDashboardStats(
|
||||
String organizationId,
|
||||
|
||||
@@ -17,6 +17,7 @@ class GetDashboardData implements UseCase<DashboardEntity, GetDashboardDataParam
|
||||
return await repository.getDashboardData(
|
||||
params.organizationId,
|
||||
params.userId,
|
||||
useGlobalDashboard: params.useGlobalDashboard,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -24,14 +25,16 @@ class GetDashboardData implements UseCase<DashboardEntity, GetDashboardDataParam
|
||||
class GetDashboardDataParams extends Equatable {
|
||||
final String organizationId;
|
||||
final String userId;
|
||||
final bool useGlobalDashboard;
|
||||
|
||||
const GetDashboardDataParams({
|
||||
required this.organizationId,
|
||||
required this.userId,
|
||||
this.useGlobalDashboard = false,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [organizationId, userId];
|
||||
List<Object> get props => [organizationId, userId, useGlobalDashboard];
|
||||
}
|
||||
|
||||
@injectable
|
||||
|
||||
@@ -90,6 +90,7 @@ class DashboardBloc extends Bloc<DashboardEvent, DashboardState> {
|
||||
GetDashboardDataParams(
|
||||
organizationId: event.organizationId,
|
||||
userId: event.userId,
|
||||
useGlobalDashboard: event.useGlobalDashboard,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -120,6 +121,7 @@ class DashboardBloc extends Bloc<DashboardEvent, DashboardState> {
|
||||
GetDashboardDataParams(
|
||||
organizationId: event.organizationId,
|
||||
userId: event.userId,
|
||||
useGlobalDashboard: event.useGlobalDashboard,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -10,27 +10,33 @@ abstract class DashboardEvent extends Equatable {
|
||||
class LoadDashboardData extends DashboardEvent {
|
||||
final String organizationId;
|
||||
final String userId;
|
||||
/// Si true, utilise le dashboard global (stats toutes orgs) même quand organizationId est vide.
|
||||
/// Utilisé pour SUPER_ADMIN qui n'appartient pas à une org.
|
||||
final bool useGlobalDashboard;
|
||||
|
||||
const LoadDashboardData({
|
||||
required this.organizationId,
|
||||
required this.userId,
|
||||
this.useGlobalDashboard = false,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [organizationId, userId];
|
||||
List<Object> get props => [organizationId, userId, useGlobalDashboard];
|
||||
}
|
||||
|
||||
class RefreshDashboardData extends DashboardEvent {
|
||||
final String organizationId;
|
||||
final String userId;
|
||||
final bool useGlobalDashboard;
|
||||
|
||||
const RefreshDashboardData({
|
||||
required this.organizationId,
|
||||
required this.userId,
|
||||
this.useGlobalDashboard = false,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [organizationId, userId];
|
||||
List<Object> get props => [organizationId, userId, useGlobalDashboard];
|
||||
}
|
||||
|
||||
class LoadDashboardStats extends DashboardEvent {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
@@ -21,6 +22,7 @@ class FinanceBloc extends Bloc<FinanceEvent, FinanceState> {
|
||||
final transactions = await _repository.getTransactions();
|
||||
emit(FinanceLoaded(summary: summary, transactions: transactions));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(FinanceError('Erreur chargement des finances: $e'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class _AdvancedDashboardPageState extends State<AdvancedDashboardPage>
|
||||
return BlocProvider(
|
||||
create: (context) => _dashboardBloc,
|
||||
child: Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
backgroundColor: AppColors.lightBackground,
|
||||
appBar: const UFAppBar(
|
||||
title: 'DASHBOARD AVANCÉ',
|
||||
),
|
||||
@@ -146,7 +146,7 @@ class _AdvancedDashboardPageState extends State<AdvancedDashboardPage>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
BlocBuilder<DashboardBloc, DashboardState>(
|
||||
builder: (context, state) {
|
||||
if (state is DashboardLoaded || state is DashboardRefreshing) {
|
||||
@@ -281,7 +281,7 @@ class _AdvancedDashboardPageState extends State<AdvancedDashboardPage>
|
||||
onRefresh: () async => _refreshDashboardData(),
|
||||
color: AppColors.primaryGreen,
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
// Métriques temps réel
|
||||
@@ -289,15 +289,15 @@ class _AdvancedDashboardPageState extends State<AdvancedDashboardPage>
|
||||
organizationId: widget.organizationId,
|
||||
userId: widget.userId,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Grille de statistiques
|
||||
_buildStatsGrid(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Notifications
|
||||
const DashboardNotificationsWidget(maxNotifications: 3),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Activités et événements
|
||||
const Row(
|
||||
@@ -360,7 +360,7 @@ class _AdvancedDashboardPageState extends State<AdvancedDashboardPage>
|
||||
|
||||
Widget _buildReportsTab() {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildReportCard(
|
||||
@@ -402,7 +402,7 @@ class _AdvancedDashboardPageState extends State<AdvancedDashboardPage>
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisSpacing: 12,
|
||||
mainAxisSpacing: 12,
|
||||
childAspectRatio: 1.25,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
ConnectedStatsCard(
|
||||
title: 'Membres',
|
||||
|
||||
@@ -49,14 +49,14 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: UnionFlowColors.background,
|
||||
backgroundColor: AppColors.lightBackground,
|
||||
appBar: _buildAppBar(),
|
||||
body: AfricanPatternBackground(
|
||||
child: BlocBuilder<DashboardBloc, DashboardState>(
|
||||
builder: (context, state) {
|
||||
if (state is DashboardLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: UnionFlowColors.unionGreen),
|
||||
child: CircularProgressIndicator(color: AppColors.primaryGreen),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
|
||||
PreferredSizeWidget _buildAppBar() {
|
||||
return AppBar(
|
||||
backgroundColor: UnionFlowColors.surface,
|
||||
backgroundColor: AppColors.lightSurface,
|
||||
elevation: 0,
|
||||
title: Row(
|
||||
children: [
|
||||
@@ -114,7 +114,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -122,7 +122,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -148,7 +148,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
count: _unreadNotifications,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.notifications_outlined),
|
||||
color: UnionFlowColors.textPrimary,
|
||||
color: AppColors.textPrimaryLight,
|
||||
onPressed: () {
|
||||
setState(() => _unreadNotifications = 0);
|
||||
UnionNotificationToast.show(
|
||||
@@ -165,9 +165,9 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
],
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
labelColor: UnionFlowColors.unionGreen,
|
||||
unselectedLabelColor: UnionFlowColors.textSecondary,
|
||||
indicatorColor: UnionFlowColors.unionGreen,
|
||||
labelColor: AppColors.primaryGreen,
|
||||
unselectedLabelColor: AppColors.textSecondaryLight,
|
||||
indicatorColor: AppColors.primaryGreen,
|
||||
labelStyle: const TextStyle(fontSize: 13, fontWeight: FontWeight.w700),
|
||||
tabs: const [
|
||||
Tab(text: 'Vue d\'ensemble'),
|
||||
@@ -188,7 +188,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
userId: widget.userId,
|
||||
));
|
||||
},
|
||||
color: UnionFlowColors.unionGreen,
|
||||
color: AppColors.primaryGreen,
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
@@ -216,7 +216,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
final stats = data.stats;
|
||||
return SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -242,7 +242,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
label: 'Membres',
|
||||
value: stats.totalMembers.toString(),
|
||||
icon: Icons.people_outline,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
color: AppColors.primaryGreen,
|
||||
trend: '+8%',
|
||||
isTrendUp: true,
|
||||
),
|
||||
@@ -288,7 +288,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Progression - Animée
|
||||
AnimatedFadeIn(
|
||||
@@ -299,7 +299,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
subtitle: '70% des membres ont cotisé ce mois',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Actions rapides - Animées
|
||||
AnimatedSlideIn(
|
||||
@@ -316,7 +316,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.unionGreenPale,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
iconColor: AppColors.primaryGreen,
|
||||
),
|
||||
UnionActionButton(
|
||||
icon: Icons.send,
|
||||
@@ -354,7 +354,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Activité récente - Animée
|
||||
AnimatedFadeIn(
|
||||
@@ -382,7 +382,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
final taux = (stats.engagementRate * 100).toStringAsFixed(0);
|
||||
return SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -398,7 +398,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
title: 'Période mise à jour',
|
||||
message: 'Affichage pour ${period.label.toLowerCase()}',
|
||||
icon: Icons.calendar_today,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
color: AppColors.primaryGreen,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -425,7 +425,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
sections: [
|
||||
UnionPieChartSection.create(
|
||||
value: 40,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
color: AppColors.primaryGreen,
|
||||
title: '40%\nCotisations',
|
||||
),
|
||||
UnionPieChartSection.create(
|
||||
@@ -446,7 +446,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Titre
|
||||
AnimatedFadeIn(
|
||||
@@ -454,13 +454,13 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
child: const Text(
|
||||
'Métriques Financières',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Métriques - Animées (données backend)
|
||||
AnimatedSlideIn(
|
||||
@@ -523,7 +523,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
final tiles = data.recentActivities.map((a) => _activityToTile(a)).toList();
|
||||
return SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -582,21 +582,20 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
|
||||
Widget _buildFinanceMetric(String label, String value, IconData icon, Color color) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
color: AppColors.lightSurface,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, size: 24, color: color),
|
||||
child: Icon(icon, size: 16, color: color),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
@@ -608,14 +607,14 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: color,
|
||||
),
|
||||
@@ -631,62 +630,62 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
Widget _buildMemberNotRegisteredState() {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(28),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.primaryGradient,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.person_add_alt_1_outlined,
|
||||
size: 56,
|
||||
size: 36,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
const SizedBox(height: 14),
|
||||
const Text(
|
||||
'Bienvenue dans UnionFlow',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Votre compte est en cours de configuration par un administrateur. '
|
||||
'Votre tableau de bord sera disponible dès que votre profil membre aura été activé.',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondaryLight,
|
||||
height: 1.5,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.unionGreen.withOpacity(0.08),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: UnionFlowColors.unionGreen.withOpacity(0.3)),
|
||||
color: AppColors.primaryGreen.withOpacity(0.08),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.primaryGreen.withOpacity(0.3)),
|
||||
),
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.info_outline, size: 18, color: UnionFlowColors.unionGreen),
|
||||
Icon(Icons.info_outline, size: 18, color: AppColors.primaryGreen),
|
||||
SizedBox(width: 10),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Contactez votre administrateur si ce message persiste.',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
color: AppColors.primaryGreen,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -707,24 +706,24 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.errorPale,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.error_outline,
|
||||
size: 64,
|
||||
size: 40,
|
||||
color: UnionFlowColors.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'Erreur de chargement',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -732,7 +731,7 @@ class _ConnectedDashboardPageState extends State<ConnectedDashboardPage> with Si
|
||||
message,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
@@ -20,12 +20,8 @@ class ActiveMemberDashboard extends StatelessWidget {
|
||||
backgroundColor: UnionFlowColors.background,
|
||||
appBar: _buildAppBar(),
|
||||
drawer: DashboardDrawer(
|
||||
onNavigate: (route) {
|
||||
Navigator.of(context).pushNamed(route);
|
||||
},
|
||||
onLogout: () {
|
||||
context.read<AuthBloc>().add(const AuthLogoutRequested());
|
||||
},
|
||||
onNavigate: (route) => Navigator.of(context).pushNamed(route),
|
||||
onLogout: () => context.read<AuthBloc>().add(const AuthLogoutRequested()),
|
||||
),
|
||||
body: AfricanPatternBackground(
|
||||
child: BlocBuilder<AuthBloc, AuthState>(
|
||||
@@ -46,18 +42,25 @@ class ActiveMemberDashboard 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
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildUserHeader(user),
|
||||
child: UserIdentityCard(
|
||||
initials: user?.initials ?? 'MA',
|
||||
name: user?.fullName ?? 'Membre Actif',
|
||||
subtitle: 'Depuis ${user?.createdAt.year ?? 2024} · Très Actif',
|
||||
badgeLabel: 'ACTIF',
|
||||
gradient: UnionFlowColors.warmGradient,
|
||||
accentColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Balance principale ou Vue Unifiée (Compte Adhérent)
|
||||
// Balance / Vue Unifiée
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 200),
|
||||
child: dashboardData?.monCompte != null
|
||||
@@ -73,309 +76,147 @@ class ActiveMemberDashboard extends StatelessWidget {
|
||||
label: 'Mon Solde Total',
|
||||
amount: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
trend: stats != null && stats.monthlyGrowth != 0
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}% ce mois'
|
||||
: 'Aucune variation',
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendPositive: (stats?.monthlyGrowth ?? 0) >= 0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Bloc KPI unifié (4 stats regroupées)
|
||||
// KPIs
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: UnionFlowColors.border, width: 1),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.check_circle,
|
||||
color: (stats?.totalContributions ?? 0) > 0
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.textTertiary,
|
||||
trend: stats != null && stats.totalContributions > 0 && stats.engagementRate > 0
|
||||
? (stats.engagementRate >= 1.0
|
||||
? 'Tout payé'
|
||||
: '${(stats.engagementRate * 100).toStringAsFixed(0)}% payé')
|
||||
: null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) >= 1.0,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Engagement',
|
||||
value: stats != null && stats.engagementRate > 0
|
||||
? '${(stats.engagementRate * 100).toStringAsFixed(0)}%'
|
||||
: stats != null && stats.totalContributions > 0
|
||||
? '—'
|
||||
: '0%',
|
||||
icon: Icons.trending_up,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats != null && stats.engagementRate > 0.9
|
||||
? 'Excellent'
|
||||
: stats != null && stats.engagementRate > 0.5
|
||||
? 'Bon'
|
||||
: null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) > 0.7,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Contribution Totale',
|
||||
value: _formatAmount(stats?.contributionsAmountOnly ?? stats?.totalContributionAmount ?? 0),
|
||||
icon: Icons.savings,
|
||||
color: UnionFlowColors.amber,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_available,
|
||||
color: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.check_circle,
|
||||
color: (stats?.totalContributions ?? 0) > 0
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.textTertiary,
|
||||
trend: stats != null && stats.totalContributions > 0 && stats.engagementRate > 0
|
||||
? (stats.engagementRate >= 1.0
|
||||
? 'Tout payé'
|
||||
: '${(stats.engagementRate * 100).toStringAsFixed(0)}% payé')
|
||||
: null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) >= 1.0,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Engagement',
|
||||
value: stats != null && stats.engagementRate > 0
|
||||
? '${(stats.engagementRate * 100).toStringAsFixed(0)}%'
|
||||
: '0%',
|
||||
icon: Icons.trending_up,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats != null && stats.engagementRate > 0.9
|
||||
? 'Excellent'
|
||||
: stats != null && stats.engagementRate > 0.5
|
||||
? 'Bon'
|
||||
: null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) > 0.7,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Contribution Totale',
|
||||
value: _formatAmount(stats?.contributionsAmountOnly ?? stats?.totalContributionAmount ?? 0),
|
||||
icon: Icons.savings,
|
||||
color: UnionFlowColors.amber,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_available,
|
||||
color: UnionFlowColors.terracotta,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Activité récente (données backend)
|
||||
// Activité récente
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity) ...[
|
||||
const AnimatedFadeIn(
|
||||
delay: Duration(milliseconds: 500),
|
||||
child: Text(
|
||||
'Activité Récente',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
child: UFSectionHeader('Activité Récente'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Column(
|
||||
children: dashboardData.recentActivities.take(3).map((activity) =>
|
||||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: UnionFlowColors.border, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: activity.type == 'contribution'
|
||||
? UnionFlowColors.success.withOpacity(0.2)
|
||||
: activity.type == 'event'
|
||||
? UnionFlowColors.gold.withOpacity(0.2)
|
||||
: UnionFlowColors.indigo.withOpacity(0.2),
|
||||
child: Icon(
|
||||
activity.type == 'contribution'
|
||||
? Icons.payment
|
||||
: activity.type == 'event'
|
||||
? Icons.event
|
||||
: Icons.person_add,
|
||||
size: 18,
|
||||
color: activity.type == 'contribution'
|
||||
? UnionFlowColors.success
|
||||
: activity.type == 'event'
|
||||
? UnionFlowColors.gold
|
||||
: UnionFlowColors.indigo,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
activity.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
activity.description,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
activity.timeAgo,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
DashboardActivityRow(
|
||||
title: activity.title,
|
||||
description: activity.description,
|
||||
timeAgo: activity.timeAgo,
|
||||
icon: DashboardActivityRow.iconFor(activity.type),
|
||||
color: DashboardActivityRow.colorFor(activity.type),
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Bloc Actions rapides unifié (6 boutons regroupés)
|
||||
// Actions rapides
|
||||
const AnimatedFadeIn(
|
||||
delay: Duration(milliseconds: 650),
|
||||
child: UFSectionHeader('Actions Rapides'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: UnionFlowColors.border, width: 1),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Actions Rapides',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Cotiser',
|
||||
icon: Icons.payment,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const CotisationsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Épargner',
|
||||
icon: Icons.savings_outlined,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EpargnePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Crédit',
|
||||
icon: Icons.account_balance_wallet,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EpargnePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.amber,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Événements',
|
||||
icon: Icons.event,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EventsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Solidarité',
|
||||
icon: Icons.favorite_outline,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const DemandesAidePageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Profil',
|
||||
icon: Icons.person_outline,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const ProfilePageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.indigo,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
UnionActionButton(
|
||||
label: 'Cotiser',
|
||||
icon: Icons.payment,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const CotisationsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Épargner',
|
||||
icon: Icons.savings_outlined,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EpargnePage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Crédit',
|
||||
icon: Icons.account_balance_wallet,
|
||||
iconColor: UnionFlowColors.amber,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EpargnePage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Événements',
|
||||
icon: Icons.event,
|
||||
iconColor: UnionFlowColors.terracotta,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Solidarité',
|
||||
icon: Icons.favorite_outline,
|
||||
iconColor: UnionFlowColors.error,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const DemandesAidePageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Profil',
|
||||
icon: Icons.person_outline,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ProfilePageWrapper())),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -403,35 +244,14 @@ class ActiveMemberDashboard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'U',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
child: const Text('U', 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(
|
||||
'Membre Actif',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
Text('UnionFlow', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
|
||||
Text('Membre Actif', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w400, color: UnionFlowColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -440,82 +260,9 @@ class ActiveMemberDashboard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader(dynamic user) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.warmGradient,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.gold, width: 3),
|
||||
),
|
||||
boxShadow: UnionFlowColors.goldGlowShadow,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: Colors.white.withOpacity(0.3),
|
||||
child: Text(
|
||||
user?.initials ?? 'MA',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
user?.fullName ?? 'Membre Actif',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Depuis ${user?.createdAt.year ?? 2024} • Très Actif',
|
||||
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(
|
||||
'ACTIF',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.gold,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatAmount(double amount) {
|
||||
if (amount >= 1000000) {
|
||||
return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
} else if (amount >= 1000) {
|
||||
return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
}
|
||||
if (amount >= 1000000) return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
if (amount >= 1000) return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
return '${amount.toStringAsFixed(0)} FCFA';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,175 +38,104 @@ class HRManagerDashboard 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 RH
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildUserHeader(),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// En-tête RH
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: UserIdentityCard(
|
||||
initials: 'RH',
|
||||
name: 'Gestionnaire RH',
|
||||
subtitle: 'Ressources Humaines & Talents',
|
||||
badgeLabel: 'RH',
|
||||
gradient: LinearGradient(
|
||||
colors: [UnionFlowColors.terracotta, UnionFlowColors.terracottaLight],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
accentColor: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Stats RH (données backend réelles)
|
||||
// Stats RH
|
||||
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: 'Membres',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.people_outlined,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
trend: stats != null && stats.monthlyGrowth > 0
|
||||
? '+${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendUp: (stats?.monthlyGrowth ?? 0) > 0,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Membres',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.people_outlined,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
trend: stats != null && stats.monthlyGrowth > 0
|
||||
? '+${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendUp: (stats?.monthlyGrowth ?? 0) > 0,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Actifs',
|
||||
value: '${stats?.activeMembers ?? 0}',
|
||||
icon: Icons.person,
|
||||
color: UnionFlowColors.success,
|
||||
trend: stats != null && stats.totalMembers > 0
|
||||
? '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Actifs',
|
||||
value: '${stats?.activeMembers ?? 0}',
|
||||
icon: Icons.person,
|
||||
color: UnionFlowColors.success,
|
||||
trend: stats != null && stats.totalMembers > 0
|
||||
? '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Demandes',
|
||||
value: '${stats?.pendingRequests ?? 0}',
|
||||
icon: Icons.pending_actions,
|
||||
color: UnionFlowColors.amber,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event,
|
||||
color: UnionFlowColors.info,
|
||||
trend: stats?.totalEvents != null ? '${stats!.totalEvents} total' : null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
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.amber,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event,
|
||||
color: UnionFlowColors.info,
|
||||
trend: stats?.totalEvents != null ? '${stats!.totalEvents} total' : null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Activité récente (données backend)
|
||||
// Activité récente
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: const Text(
|
||||
'Activité RH Récente',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
child: const UFSectionHeader('Activité RH Récente'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: Column(
|
||||
children: dashboardData.recentActivities.take(4).map((activity) =>
|
||||
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),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: activity.type == 'member'
|
||||
? UnionFlowColors.success.withOpacity(0.2)
|
||||
: activity.type == 'contribution'
|
||||
? UnionFlowColors.amber.withOpacity(0.2)
|
||||
: UnionFlowColors.terracotta.withOpacity(0.2),
|
||||
child: Icon(
|
||||
activity.type == 'member'
|
||||
? Icons.person_add
|
||||
: activity.type == 'contribution'
|
||||
? Icons.payment
|
||||
: Icons.event,
|
||||
size: 18,
|
||||
color: activity.type == 'member'
|
||||
? UnionFlowColors.success
|
||||
: activity.type == 'contribution'
|
||||
? UnionFlowColors.amber
|
||||
: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
activity.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
activity.userName,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
activity.timeAgo,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
DashboardActivityRow(
|
||||
title: activity.title,
|
||||
description: activity.description,
|
||||
timeAgo: activity.timeAgo,
|
||||
icon: DashboardActivityRow.iconFor(activity.type),
|
||||
color: DashboardActivityRow.colorFor(activity.type),
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Répartition membres actifs/inactifs (données backend)
|
||||
if (stats != null && stats.totalMembers > 0)
|
||||
// Répartition membres actifs/inactifs
|
||||
if (stats != null && stats.totalMembers > 0) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: UnionPieChart(
|
||||
@@ -226,125 +155,88 @@ class HRManagerDashboard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Indicateurs RH
|
||||
// Indicateurs Clés
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: const Text(
|
||||
'Indicateurs Clés',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
child: const UFSectionHeader('Indicateurs Clés'),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: _buildMetric('Turnover', '5%', UnionFlowColors.success)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: _buildMetric('Absentéisme', '2%', UnionFlowColors.warning)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 800),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: _buildMetric('Satisfaction', '87%', UnionFlowColors.gold)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: _buildMetric('Formation', '45h', UnionFlowColors.indigo)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Actions RH
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 900),
|
||||
child: const Text(
|
||||
'Gestion RH',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
UnionStatWidget(label: 'Turnover', value: '5%', icon: Icons.swap_horiz, color: UnionFlowColors.success),
|
||||
UnionStatWidget(label: 'Absentéisme', value: '2%', icon: Icons.event_busy, color: UnionFlowColors.warning),
|
||||
UnionStatWidget(label: 'Satisfaction', value: '87%', icon: Icons.sentiment_satisfied, color: UnionFlowColors.gold),
|
||||
UnionStatWidget(label: 'Formation', value: '45h', icon: Icons.school, color: UnionFlowColors.indigo),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 1000),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Employés',
|
||||
icon: Icons.people,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const MembersPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Congés',
|
||||
icon: Icons.event_available,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const EventsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.amber,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Paie',
|
||||
icon: Icons.payments,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const ContributionsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// Actions RH
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 900),
|
||||
child: const UFSectionHeader('Gestion RH'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 1100),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Recrutement',
|
||||
icon: Icons.person_add,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const MembersPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.info,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Formation',
|
||||
icon: Icons.school,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const EventsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.indigo,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Rapports',
|
||||
icon: Icons.analytics,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const ReportsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 1000),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
UnionActionButton(
|
||||
label: 'Employés',
|
||||
icon: Icons.people,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const MembersPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Congés',
|
||||
icon: Icons.event_available,
|
||||
iconColor: UnionFlowColors.amber,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Paie',
|
||||
icon: Icons.payments,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ContributionsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Recrutement',
|
||||
icon: Icons.person_add,
|
||||
iconColor: UnionFlowColors.info,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const MembersPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Formation',
|
||||
icon: Icons.school,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Rapports',
|
||||
icon: Icons.analytics,
|
||||
iconColor: UnionFlowColors.terracotta,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ReportsPageWrapper())),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -375,35 +267,14 @@ class HRManagerDashboard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'H',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
child: const Text('H', 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(
|
||||
'RH Manager',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
Text('UnionFlow', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
|
||||
Text('RH Manager', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w400, color: UnionFlowColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -428,115 +299,4 @@ class HRManagerDashboard extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [UnionFlowColors.terracotta, UnionFlowColors.terracottaLight],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.terracotta, width: 3),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: UnionFlowColors.terracotta.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(
|
||||
'RH',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Gestionnaire RH',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Ressources Humaines & Talents',
|
||||
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(
|
||||
'RH',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.terracotta,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMetric(String label, String value, Color color) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,6 @@ import '../../widgets/dashboard_drawer.dart';
|
||||
class ModeratorDashboard extends StatelessWidget {
|
||||
const ModeratorDashboard({super.key});
|
||||
|
||||
String _formatAmount(double amount) {
|
||||
if (amount >= 1000000) {
|
||||
return '${(amount / 1000000).toStringAsFixed(amount % 1000000 == 0 ? 0 : 1)}M FCFA';
|
||||
} else if (amount >= 1000) {
|
||||
return '${(amount / 1000).toStringAsFixed(amount % 1000 == 0 ? 0 : 1)}K FCFA';
|
||||
}
|
||||
return '${amount.toStringAsFixed(0)} FCFA';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -54,18 +45,25 @@ class ModeratorDashboard 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 Modérateur
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildUserHeader(user),
|
||||
child: UserIdentityCard(
|
||||
initials: user?.initials ?? 'SM',
|
||||
name: user?.fullName ?? 'Secrétaire',
|
||||
subtitle: 'Depuis ${user?.createdAt?.year ?? DateTime.now().year} · Très Actif',
|
||||
badgeLabel: 'ACTIF',
|
||||
gradient: UnionFlowColors.warmGradient,
|
||||
accentColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Balance principale ou Vue Unifiée (Compte Adhérent)
|
||||
// Balance / Vue Unifiée
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 200),
|
||||
child: dashboardData?.monCompte != null
|
||||
@@ -81,290 +79,180 @@ class ModeratorDashboard extends StatelessWidget {
|
||||
label: 'Mon Solde Total',
|
||||
amount: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
trend: stats != null && stats.monthlyGrowth != 0
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}% ce mois'
|
||||
: 'Aucune variation',
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendPositive: (stats?.monthlyGrowth ?? 0) >= 0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Bloc KPI unifié (4 stats regroupées)
|
||||
// KPIs membre
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 250),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: UnionFlowColors.border, width: 1),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.check_circle,
|
||||
color: (stats?.totalContributions ?? 0) > 0
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.textTertiary,
|
||||
trend: stats != null && stats.totalContributions > 0 && stats.engagementRate > 0
|
||||
? (stats.engagementRate >= 1.0
|
||||
? 'Tout payé'
|
||||
: '${(stats.engagementRate * 100).toStringAsFixed(0)}% payé')
|
||||
: null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) >= 1.0,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Engagement',
|
||||
value: stats != null && stats.engagementRate > 0
|
||||
? '${(stats.engagementRate * 100).toStringAsFixed(0)}%'
|
||||
: stats != null && stats.totalContributions > 0 ? '—' : '0%',
|
||||
icon: Icons.trending_up,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats != null && stats.engagementRate > 0.9
|
||||
? 'Excellent'
|
||||
: stats != null && stats.engagementRate > 0.5 ? 'Bon' : null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) > 0.7,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Contribution Totale',
|
||||
value: _formatAmount(stats?.contributionsAmountOnly ?? stats?.totalContributionAmount ?? 0),
|
||||
icon: Icons.savings,
|
||||
color: UnionFlowColors.amber,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_available,
|
||||
color: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Bloc Actions rapides unifié (6 boutons regroupés)
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: UnionFlowColors.border, width: 1),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Actions Rapides',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Cotiser',
|
||||
icon: Icons.payment,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const CotisationsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Épargner',
|
||||
icon: Icons.savings_outlined,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EpargnePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Crédit',
|
||||
icon: Icons.account_balance_wallet,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EpargnePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.amber,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Événements',
|
||||
icon: Icons.event,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EventsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.terracotta,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Solidarité',
|
||||
icon: Icons.favorite_outline,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const DemandesAidePageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Profil',
|
||||
icon: Icons.person_outline,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const ProfilePageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.indigo,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// ——— Administration / Modération (tout en bas, après les actions membre) ———
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: const Text(
|
||||
'Espace Modérateur',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Stats de modération (données backend réelles)
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Row(
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'En attente',
|
||||
value: '${stats?.pendingRequests ?? 0}',
|
||||
icon: Icons.pending_actions,
|
||||
color: UnionFlowColors.warning,
|
||||
trend: stats != null && stats.pendingRequests > 0 ? 'Action requise' : null,
|
||||
isTrendUp: false,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.check_circle,
|
||||
color: (stats?.totalContributions ?? 0) > 0
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.textTertiary,
|
||||
trend: stats != null && stats.totalContributions > 0 && stats.engagementRate > 0
|
||||
? (stats.engagementRate >= 1.0
|
||||
? 'Tout payé'
|
||||
: '${(stats.engagementRate * 100).toStringAsFixed(0)}% payé')
|
||||
: null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) >= 1.0,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Membres Actifs',
|
||||
value: '${stats?.activeMembers ?? 0}',
|
||||
icon: Icons.check_circle_outline,
|
||||
color: UnionFlowColors.success,
|
||||
trend: stats != null && stats.totalMembers > 0
|
||||
? '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Engagement',
|
||||
value: stats != null && stats.engagementRate > 0
|
||||
? '${(stats.engagementRate * 100).toStringAsFixed(0)}%'
|
||||
: '0%',
|
||||
icon: Icons.trending_up,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats != null && stats.engagementRate > 0.9
|
||||
? 'Excellent'
|
||||
: stats != null && stats.engagementRate > 0.5 ? 'Bon' : null,
|
||||
isTrendUp: (stats?.engagementRate ?? 0) > 0.7,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Contribution Totale',
|
||||
value: _formatAmount(stats?.contributionsAmountOnly ?? stats?.totalContributionAmount ?? 0),
|
||||
icon: Icons.savings,
|
||||
color: UnionFlowColors.amber,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_available,
|
||||
color: UnionFlowColors.terracotta,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Row(
|
||||
// Actions rapides membre
|
||||
const AnimatedFadeIn(
|
||||
delay: Duration(milliseconds: 300),
|
||||
child: UFSectionHeader('Actions Rapides'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 350),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Cotiser',
|
||||
icon: Icons.payment,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const CotisationsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Membres Total',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.people_outline,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Épargner',
|
||||
icon: Icons.savings_outlined,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EpargnePage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Crédit',
|
||||
icon: Icons.account_balance_wallet,
|
||||
iconColor: UnionFlowColors.amber,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EpargnePage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Événements',
|
||||
icon: Icons.event,
|
||||
iconColor: UnionFlowColors.terracotta,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Solidarité',
|
||||
icon: Icons.favorite_outline,
|
||||
iconColor: UnionFlowColors.error,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const DemandesAidePageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Profil',
|
||||
icon: Icons.person_outline,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ProfilePageWrapper())),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Activité des membres (données backend réelles)
|
||||
if (stats != null && stats.totalMembers > 0)
|
||||
// ——— Espace Modérateur ———
|
||||
const AnimatedFadeIn(
|
||||
delay: Duration(milliseconds: 600),
|
||||
child: UFSectionHeader('Espace Modérateur'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Stats de modération
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
UnionStatWidget(
|
||||
label: 'En attente',
|
||||
value: '${stats?.pendingRequests ?? 0}',
|
||||
icon: Icons.pending_actions,
|
||||
color: UnionFlowColors.warning,
|
||||
trend: stats != null && stats.pendingRequests > 0 ? 'Action requise' : null,
|
||||
isTrendUp: false,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Membres Actifs',
|
||||
value: '${stats?.activeMembers ?? 0}',
|
||||
icon: Icons.check_circle_outline,
|
||||
color: UnionFlowColors.success,
|
||||
trend: stats != null && stats.totalMembers > 0
|
||||
? '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Membres Total',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.people_outline,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Activité des membres
|
||||
if (stats != null && stats.totalMembers > 0) ...[
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: UnionPieChart(
|
||||
@@ -384,157 +272,79 @@ class ModeratorDashboard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Demandes en attente (données backend)
|
||||
// Activité récente à modérer
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: const Text(
|
||||
'Activité Récente à Modérer',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
child: const UFSectionHeader('Activité Récente à Modérer'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Column(
|
||||
children: dashboardData.recentActivities.take(4).map((activity) =>
|
||||
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: [
|
||||
CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: UnionFlowColors.indigo.withOpacity(0.2),
|
||||
child: Icon(
|
||||
activity.type == 'member' ? Icons.person_add :
|
||||
activity.type == 'event' ? Icons.event :
|
||||
Icons.info_outline,
|
||||
size: 20,
|
||||
color: UnionFlowColors.indigo,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
activity.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
activity.description,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
activity.timeAgo,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
DashboardActivityRow(
|
||||
title: activity.title,
|
||||
description: activity.description,
|
||||
timeAgo: activity.timeAgo,
|
||||
icon: DashboardActivityRow.iconFor(activity.type),
|
||||
color: DashboardActivityRow.colorFor(activity.type),
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Actions de modération
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
child: Row(
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Approuver',
|
||||
icon: Icons.check_circle,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const AdhesionsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.success,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Approuver',
|
||||
icon: Icons.check_circle,
|
||||
iconColor: UnionFlowColors.success,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const AdhesionsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Vérifier',
|
||||
icon: Icons.visibility,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const AdhesionsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.info,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Vérifier',
|
||||
icon: Icons.visibility,
|
||||
iconColor: UnionFlowColors.info,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const AdhesionsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Signaler',
|
||||
icon: Icons.flag,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const HelpSupportPage())),
|
||||
backgroundColor: UnionFlowColors.error,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Signaler',
|
||||
icon: Icons.flag,
|
||||
iconColor: UnionFlowColors.error,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const HelpSupportPage())),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 800),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Membres',
|
||||
icon: Icons.people,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const MembersPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Membres',
|
||||
icon: Icons.people,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const MembersPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Contenus',
|
||||
icon: Icons.article,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const EventsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Contenus',
|
||||
icon: Icons.article,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Historique',
|
||||
icon: Icons.history,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (_) => const ContributionsPageWrapper())),
|
||||
backgroundColor: UnionFlowColors.indigo,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Historique',
|
||||
icon: Icons.history,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ContributionsPageWrapper())),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -564,35 +374,14 @@ class ModeratorDashboard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'U',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
child: const Text('U', 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(
|
||||
'Modérateur',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
Text('UnionFlow', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
|
||||
Text('Modérateur', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w400, color: UnionFlowColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -601,74 +390,12 @@ class ModeratorDashboard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader(dynamic user) {
|
||||
final year = user?.createdAt?.year ?? DateTime.now().year;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.warmGradient,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.gold, width: 3),
|
||||
),
|
||||
boxShadow: UnionFlowColors.goldGlowShadow,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: Colors.white.withOpacity(0.3),
|
||||
child: Text(
|
||||
user?.initials ?? 'SM',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
user?.fullName ?? 'Secrétaire',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Depuis $year • Très Actif',
|
||||
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(
|
||||
'ACTIF',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.gold,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
String _formatAmount(double amount) {
|
||||
if (amount >= 1000000) {
|
||||
return '${(amount / 1000000).toStringAsFixed(amount % 1000000 == 0 ? 0 : 1)}M FCFA';
|
||||
} else if (amount >= 1000) {
|
||||
return '${(amount / 1000).toStringAsFixed(amount % 1000 == 0 ? 0 : 1)}K FCFA';
|
||||
}
|
||||
return '${amount.toStringAsFixed(0)} FCFA';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../../../../events/presentation/pages/events_page_wrapper.dart';
|
||||
import '../../../../contributions/presentation/pages/contributions_page_wrapper.dart';
|
||||
import '../../../../reports/presentation/pages/reports_page_wrapper.dart';
|
||||
import '../../../../notifications/presentation/pages/notifications_page_wrapper.dart';
|
||||
import '../../../../adhesions/presentation/pages/adhesions_page_wrapper.dart';
|
||||
import '../../widgets/dashboard_drawer.dart';
|
||||
import '../../../data/datasources/dashboard_remote_datasource.dart';
|
||||
import '../../../data/services/dashboard_export_service.dart';
|
||||
@@ -25,12 +26,8 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
backgroundColor: UnionFlowColors.background,
|
||||
appBar: _buildAppBar(context),
|
||||
drawer: DashboardDrawer(
|
||||
onNavigate: (route) {
|
||||
Navigator.of(context).pushNamed(route);
|
||||
},
|
||||
onLogout: () {
|
||||
context.read<AuthBloc>().add(const AuthLogoutRequested());
|
||||
},
|
||||
onNavigate: (route) => Navigator.of(context).pushNamed(route),
|
||||
onLogout: () => context.read<AuthBloc>().add(const AuthLogoutRequested()),
|
||||
),
|
||||
body: AfricanPatternBackground(
|
||||
child: BlocBuilder<AuthBloc, AuthState>(
|
||||
@@ -54,277 +51,98 @@ class OrgAdminDashboard 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 Admin
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildUserHeader(user, orgContext),
|
||||
child: UserIdentityCard(
|
||||
initials: user?.initials ?? 'AD',
|
||||
name: user?.fullName ?? 'Administrateur',
|
||||
subtitle: orgContext?.organizationName ?? 'Organisation',
|
||||
badgeLabel: 'ADMIN',
|
||||
gradient: UnionFlowColors.goldGradient,
|
||||
accentColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Balance organisation (données backend réelles)
|
||||
// Balance organisation
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 200),
|
||||
child: UnionBalanceCard(
|
||||
label: 'Caisse de l\'Organisation',
|
||||
amount: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
trend: stats != null && stats.monthlyGrowth != 0
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}% ce mois'
|
||||
: 'Aucune variation',
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendPositive: (stats?.monthlyGrowth ?? 0) >= 0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Stats organisation (données backend réelles)
|
||||
// Stats organisation — cellules très plates
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Row(
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 3.0,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Membres',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.people_outlined,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
trend: stats != null && stats.monthlyGrowth > 0
|
||||
? '+${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendUp: (stats?.monthlyGrowth ?? 0) > 0,
|
||||
),
|
||||
UnionStatWidget(
|
||||
compact: true,
|
||||
label: 'Membres',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.people_outlined,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
trend: stats != null && stats.monthlyGrowth > 0
|
||||
? '+${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendUp: (stats?.monthlyGrowth ?? 0) > 0,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Actifs',
|
||||
value: '${stats?.activeMembers ?? 0}',
|
||||
icon: Icons.check_circle_outline,
|
||||
color: UnionFlowColors.success,
|
||||
trend: stats != null && stats.totalMembers > 0
|
||||
? '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
compact: true,
|
||||
label: 'Actifs',
|
||||
value: '${stats?.activeMembers ?? 0}',
|
||||
icon: Icons.check_circle_outline,
|
||||
color: UnionFlowColors.success,
|
||||
trend: stats != null && stats.totalMembers > 0
|
||||
? '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
compact: true,
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats?.totalEvents != null ? '${stats!.totalEvents} total' : null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
UnionStatWidget(
|
||||
compact: true,
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.trending_up,
|
||||
color: UnionFlowColors.amber,
|
||||
trend: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
isTrendUp: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats?.totalEvents != null ? '${stats!.totalEvents} total' : null,
|
||||
isTrendUp: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.trending_up,
|
||||
color: UnionFlowColors.amber,
|
||||
trend: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
isTrendUp: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Événements à venir (données backend)
|
||||
if (dashboardData != null && dashboardData.hasUpcomingEvents) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: const Text(
|
||||
'Événements à Venir',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Répartition actifs / inactifs
|
||||
if (stats != null && stats.totalMembers > 0) ...[
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Column(
|
||||
children: dashboardData.upcomingEvents.take(3).map((event) =>
|
||||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
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: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.warmGradient,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.event,
|
||||
color: Colors.white,
|
||||
size: 26,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (event.hasParticipantInfo)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.gold.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'${event.currentParticipants}/${event.maxParticipants}',
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
|
||||
// Activité récente (données backend)
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 520),
|
||||
child: const Text(
|
||||
'Activité Récente',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 580),
|
||||
child: Column(
|
||||
children: dashboardData.recentActivities.take(4).map((activity) =>
|
||||
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: [
|
||||
CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: UnionFlowColors.gold.withOpacity(0.2),
|
||||
child: Icon(
|
||||
activity.type == 'member' ? Icons.person_add :
|
||||
activity.type == 'event' ? Icons.event :
|
||||
Icons.info_outline,
|
||||
size: 20,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
activity.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
activity.description,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
activity.timeAgo,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
|
||||
// Répartition actifs / inactifs (données backend)
|
||||
if (stats != null && stats.totalMembers > 0)
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: UnionPieChart(
|
||||
title: 'Activité des Membres',
|
||||
subtitle: '${stats.totalMembers} membres',
|
||||
@@ -346,100 +164,112 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Gestion
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 800),
|
||||
child: const Text(
|
||||
'Gestion de l\'Organisation',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
// Événements à venir
|
||||
if (dashboardData != null && dashboardData.hasUpcomingEvents) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: UFSectionHeader(
|
||||
'Événements à Venir',
|
||||
trailing: '${dashboardData.upcomingEvents.length} programmés',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Column(
|
||||
children: dashboardData.upcomingEvents.take(3).map((event) =>
|
||||
DashboardEventRow(
|
||||
title: event.title,
|
||||
date: event.formattedDate,
|
||||
participants: event.hasParticipantInfo
|
||||
? '${event.currentParticipants}/${event.maxParticipants}'
|
||||
: null,
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Activité récente
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity) ...[
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 520),
|
||||
child: const UFSectionHeader('Activité Récente'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 580),
|
||||
child: Column(
|
||||
children: dashboardData.recentActivities.take(4).map((activity) =>
|
||||
DashboardActivityRow(
|
||||
title: activity.title,
|
||||
description: activity.description,
|
||||
timeAgo: activity.timeAgo,
|
||||
icon: DashboardActivityRow.iconFor(activity.type),
|
||||
color: DashboardActivityRow.colorFor(activity.type),
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// Gestion de l'Organisation
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 800),
|
||||
child: const UFSectionHeader('Gestion de l\'Organisation'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 900),
|
||||
child: Row(
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Membres',
|
||||
icon: Icons.people,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const MembersPageWrapper(),
|
||||
),
|
||||
),
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Membres',
|
||||
icon: Icons.people,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const MembersPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Finance',
|
||||
icon: Icons.account_balance,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const CotisationsPageWrapper(),
|
||||
),
|
||||
),
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Finance',
|
||||
icon: Icons.account_balance,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const CotisationsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Événements',
|
||||
icon: Icons.event,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const EventsPageWrapper(),
|
||||
),
|
||||
),
|
||||
backgroundColor: UnionFlowColors.terracotta,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Événements',
|
||||
icon: Icons.event,
|
||||
iconColor: UnionFlowColors.terracotta,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EventsPageWrapper())),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Paramètres Système réservé au super admin (pas affiché pour org admin)
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 1000),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Rapports',
|
||||
icon: Icons.description,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const ReportsPageWrapper(),
|
||||
),
|
||||
),
|
||||
backgroundColor: UnionFlowColors.info,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Rapports',
|
||||
icon: Icons.description,
|
||||
iconColor: UnionFlowColors.info,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ReportsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Historique',
|
||||
icon: Icons.history,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const ReportsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.amber,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Adhésions',
|
||||
icon: Icons.person_add,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const AdhesionsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Historique',
|
||||
icon: Icons.history,
|
||||
iconColor: UnionFlowColors.amber,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ReportsPageWrapper())),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -471,42 +301,22 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'A',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
),
|
||||
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(
|
||||
'Admin Organisation',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
Text('UnionFlow', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
|
||||
Text('Admin Organisation', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w400, color: UnionFlowColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
iconTheme: const IconThemeData(color: UnionFlowColors.textPrimary),
|
||||
actions: [
|
||||
UnionExportButton(
|
||||
onExport: (_) => _handleExport(context),
|
||||
),
|
||||
UnionExportButton(onExport: (_) => _handleExport(context)),
|
||||
const SizedBox(width: 8),
|
||||
UnionNotificationBadge(
|
||||
count: 0,
|
||||
@@ -514,9 +324,7 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
icon: const Icon(Icons.notifications_outlined),
|
||||
color: UnionFlowColors.textPrimary,
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NotificationsPageWrapper(),
|
||||
),
|
||||
MaterialPageRoute(builder: (_) => const NotificationsPageWrapper()),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -525,86 +333,9 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader(dynamic user, dynamic orgContext) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.goldGradient,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.gold, width: 3),
|
||||
),
|
||||
boxShadow: UnionFlowColors.goldGlowShadow,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: Colors.white.withOpacity(0.3),
|
||||
child: Text(
|
||||
user?.initials ?? 'AD',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
user?.fullName ?? 'Administrateur',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
orgContext?.organizationName ?? 'Organisation',
|
||||
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(
|
||||
'ADMIN',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.gold,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatAmount(double amount) {
|
||||
if (amount >= 1000000) {
|
||||
return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
} else if (amount >= 1000) {
|
||||
return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
}
|
||||
if (amount >= 1000000) return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
if (amount >= 1000) return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
return '${amount.toStringAsFixed(0)} FCFA';
|
||||
}
|
||||
|
||||
@@ -629,9 +360,6 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
final orgCtx = user.organizationContexts.first;
|
||||
final orgId = orgCtx.organizationId;
|
||||
final orgName = orgCtx.organizationName;
|
||||
final userId = user.id;
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
@@ -639,10 +367,10 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
);
|
||||
try {
|
||||
final dataSource = sl<DashboardRemoteDataSource>();
|
||||
final data = await dataSource.getDashboardData(orgId, userId);
|
||||
final data = await dataSource.getDashboardData(orgCtx.organizationId, user.id);
|
||||
final path = await DashboardExportService().exportDashboardReport(
|
||||
dashboardData: data,
|
||||
organizationName: orgName,
|
||||
organizationName: orgCtx.organizationName,
|
||||
reportTitle: 'Rapport dashboard - ${DateTime.now().day}/${DateTime.now().month}/${DateTime.now().year}',
|
||||
);
|
||||
if (context.mounted) {
|
||||
|
||||
@@ -19,12 +19,8 @@ class SimpleMemberDashboard extends StatelessWidget {
|
||||
backgroundColor: UnionFlowColors.background,
|
||||
appBar: _buildAppBar(),
|
||||
drawer: DashboardDrawer(
|
||||
onNavigate: (route) {
|
||||
Navigator.of(context).pushNamed(route);
|
||||
},
|
||||
onLogout: () {
|
||||
context.read<AuthBloc>().add(const AuthLogoutRequested());
|
||||
},
|
||||
onNavigate: (route) => Navigator.of(context).pushNamed(route),
|
||||
onLogout: () => context.read<AuthBloc>().add(const AuthLogoutRequested()),
|
||||
),
|
||||
body: AfricanPatternBackground(
|
||||
child: BlocBuilder<AuthBloc, AuthState>(
|
||||
@@ -45,16 +41,24 @@ class SimpleMemberDashboard 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 avec badge de rôle
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildUserHeader(user),
|
||||
child: UserIdentityCard(
|
||||
initials: user?.initials ?? 'M',
|
||||
name: user?.fullName ?? 'Membre',
|
||||
subtitle: 'Membre depuis ${user?.createdAt.year ?? 2024}',
|
||||
badgeLabel: 'MEMBRE',
|
||||
gradient: UnionFlowColors.subtleGradient,
|
||||
accentColor: UnionFlowColors.unionGreen,
|
||||
lightBackground: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Solde personnel
|
||||
AnimatedSlideIn(
|
||||
@@ -63,232 +67,114 @@ class SimpleMemberDashboard extends StatelessWidget {
|
||||
label: 'Mon Solde',
|
||||
amount: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
trend: stats != null && stats.monthlyGrowth != 0
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}% ce mois'
|
||||
: 'Aucune variation',
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendPositive: (stats?.monthlyGrowth ?? 0) >= 0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Ma situation
|
||||
// Ma Situation
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: const Text(
|
||||
'Ma Situation',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
child: const UFSectionHeader('Ma Situation'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: Row(
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: stats != null && stats.totalContributions > 0 ? 'À jour' : 'En retard',
|
||||
icon: Icons.check_circle_outline,
|
||||
color: stats != null && stats.totalContributions > 0
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.warning,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: stats != null && stats.totalContributions > 0 ? 'À jour' : 'En retard',
|
||||
icon: Icons.check_circle_outline,
|
||||
color: stats != null && stats.totalContributions > 0
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.warning,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Actions rapides
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: const Text(
|
||||
'Actions Rapides',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Cotiser',
|
||||
icon: Icons.payment,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const CotisationsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Épargner',
|
||||
icon: Icons.savings_outlined,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const EpargnePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.upcomingEvents ?? 0}',
|
||||
icon: Icons.event_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Actions rapides
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: const UFSectionHeader('Actions Rapides'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
child: Row(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Mes Infos',
|
||||
icon: Icons.person_outline,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const ProfilePageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.indigo,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Cotiser',
|
||||
icon: Icons.payment,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const CotisationsPageWrapper())),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Support',
|
||||
icon: Icons.help_outline,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const HelpSupportPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.terracotta,
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Épargner',
|
||||
icon: Icons.savings_outlined,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const EpargnePage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Mes Infos',
|
||||
icon: Icons.person_outline,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ProfilePageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Support',
|
||||
icon: Icons.help_outline,
|
||||
iconColor: UnionFlowColors.terracotta,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const HelpSupportPage())),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Événements à venir (données backend)
|
||||
// Événements à venir
|
||||
if (dashboardData != null && dashboardData.hasUpcomingEvents) ...[
|
||||
const SizedBox(height: 12),
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 800),
|
||||
child: const Text(
|
||||
child: UFSectionHeader(
|
||||
'Événements à Venir',
|
||||
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: 900),
|
||||
child: Column(
|
||||
children: dashboardData.upcomingEvents.take(2).map((event) =>
|
||||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
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(
|
||||
color: UnionFlowColors.gold.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.event,
|
||||
color: UnionFlowColors.gold,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (event.daysUntilEventInt <= 7)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.warning.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'${event.daysUntilEventInt}j',
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.warning,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
DashboardEventRow(
|
||||
title: event.title,
|
||||
date: event.formattedDate,
|
||||
daysUntil: event.daysUntilEventInt <= 7 ? '${event.daysUntilEventInt}j' : null,
|
||||
),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
@@ -318,35 +204,14 @@ class SimpleMemberDashboard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'U',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
child: const Text('U', 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(
|
||||
'Membre Simple',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
Text('UnionFlow', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
|
||||
Text('Membre Simple', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w400, color: UnionFlowColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -355,82 +220,9 @@ class SimpleMemberDashboard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader(dynamic user) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.subtleGradient,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.unionGreen, width: 3),
|
||||
),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: UnionFlowColors.unionGreen.withOpacity(0.2),
|
||||
child: Text(
|
||||
user?.initials ?? 'M',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
user?.fullName ?? 'Membre',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Membre depuis ${user?.createdAt.year ?? 2024}',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.unionGreen,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Text(
|
||||
'MEMBRE',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatAmount(double amount) {
|
||||
if (amount >= 1000000) {
|
||||
return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
} else if (amount >= 1000) {
|
||||
return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
}
|
||||
if (amount >= 1000000) return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
if (amount >= 1000) return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
return '${amount.toStringAsFixed(0)} FCFA';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../../shared/design_system/unionflow_design_v2.dart';
|
||||
import '../../bloc/dashboard_bloc.dart';
|
||||
import '../../../domain/entities/dashboard_entity.dart';
|
||||
import '../../../../authentication/presentation/bloc/auth_bloc.dart';
|
||||
import '../../../../organizations/presentation/pages/organizations_page_wrapper.dart';
|
||||
import '../../../../admin/presentation/pages/user_management_page.dart';
|
||||
@@ -10,7 +11,7 @@ import '../../../../backup/presentation/pages/backup_page.dart';
|
||||
import '../../../../help/presentation/pages/help_support_page.dart';
|
||||
import '../../widgets/dashboard_drawer.dart';
|
||||
|
||||
/// Dashboard Super Admin - Design UnionFlow Contrôle Système
|
||||
/// Dashboard Super Admin — design fintech compact
|
||||
class SuperAdminDashboard extends StatelessWidget {
|
||||
const SuperAdminDashboard({super.key});
|
||||
|
||||
@@ -18,448 +19,271 @@ class SuperAdminDashboard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: UnionFlowColors.background,
|
||||
appBar: _buildAppBar(),
|
||||
appBar: _buildAppBar(context),
|
||||
drawer: DashboardDrawer(
|
||||
onNavigate: (route) {
|
||||
Navigator.of(context).pushNamed(route);
|
||||
},
|
||||
onLogout: () {
|
||||
context.read<AuthBloc>().add(const AuthLogoutRequested());
|
||||
},
|
||||
onNavigate: (route) => Navigator.of(context).pushNamed(route),
|
||||
onLogout: () => context.read<AuthBloc>().add(const AuthLogoutRequested()),
|
||||
),
|
||||
body: AfricanPatternBackground(
|
||||
child: BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, authState) {
|
||||
final user = (authState is AuthAuthenticated) ? authState.user : null;
|
||||
body: BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, authState) {
|
||||
final user = (authState is AuthAuthenticated) ? authState.user : null;
|
||||
return BlocBuilder<DashboardBloc, DashboardState>(
|
||||
builder: (context, dashboardState) {
|
||||
if (dashboardState is DashboardLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: UnionFlowColors.error,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
final dashboardData = (dashboardState is DashboardLoaded)
|
||||
? dashboardState.dashboardData
|
||||
: null;
|
||||
final stats = dashboardData?.stats;
|
||||
|
||||
return BlocBuilder<DashboardBloc, DashboardState>(
|
||||
builder: (context, dashboardState) {
|
||||
if (dashboardState is DashboardLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: UnionFlowColors.error),
|
||||
);
|
||||
}
|
||||
|
||||
final dashboardData = (dashboardState is DashboardLoaded)
|
||||
? dashboardState.dashboardData
|
||||
: null;
|
||||
final stats = dashboardData?.stats;
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
return RefreshIndicator(
|
||||
color: UnionFlowColors.error,
|
||||
strokeWidth: 2,
|
||||
onRefresh: () async {
|
||||
context.read<DashboardBloc>().add(LoadDashboardData(
|
||||
organizationId: dashboardData?.organizationId ?? '',
|
||||
userId: user?.id ?? '',
|
||||
useGlobalDashboard: true,
|
||||
));
|
||||
await Future.delayed(const Duration(milliseconds: 600));
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// En-tête Root
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildUserHeader(user),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Balance globale
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 200),
|
||||
child: UnionBalanceCard(
|
||||
label: 'Caisse Globale Système',
|
||||
amount: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
trend: stats != null && stats.monthlyGrowth != 0
|
||||
? '${stats.monthlyGrowth > 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}% ce mois'
|
||||
: 'Aucune variation',
|
||||
isTrendPositive: (stats?.monthlyGrowth ?? 0) >= 0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Stats système
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Organisations',
|
||||
value: stats != null ? '${stats.totalOrganizations ?? 0}' : '0',
|
||||
icon: Icons.business_outlined,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Utilisateurs',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.groups_outlined,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats != null && stats.monthlyGrowth > 0
|
||||
? '+${stats.monthlyGrowth.toStringAsFixed(0)}%'
|
||||
: null,
|
||||
isTrendUp: (stats?.monthlyGrowth ?? 0) > 0,
|
||||
),
|
||||
),
|
||||
],
|
||||
// ── Carte identité ───────────────────────────────
|
||||
UserIdentityCard(
|
||||
initials: user?.initials ?? 'SA',
|
||||
name: user?.fullName ?? 'Super Administrateur',
|
||||
subtitle: 'Accès global système',
|
||||
badgeLabel: 'ROOT',
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFFB91C1C), Color(0xFF7F1D1D)],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
accentColor: UnionFlowColors.error,
|
||||
showTopBorder: false,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Projets',
|
||||
value: '${stats?.completedProjects ?? 0}',
|
||||
icon: Icons.account_balance_outlined,
|
||||
color: UnionFlowColors.info,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionStatWidget(
|
||||
label: 'Engagement',
|
||||
value: stats != null
|
||||
? '${(stats.engagementRate * 100).toStringAsFixed(0)}%'
|
||||
: '0%',
|
||||
icon: Icons.trending_up,
|
||||
color: (stats?.engagementRate ?? 0) >= 0.7
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.warning,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Répartition Membres (données réelles)
|
||||
if (stats != null && stats.totalMembers > 0)
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: UnionPieChart(
|
||||
title: 'Activité des Membres',
|
||||
subtitle: '${stats.totalMembers} membres au total',
|
||||
sections: [
|
||||
UnionPieChartSection.create(
|
||||
value: stats.activeMembers.toDouble(),
|
||||
color: UnionFlowColors.success,
|
||||
title: '${((stats.activeMembers / stats.totalMembers) * 100).toStringAsFixed(0)}%\nActifs',
|
||||
),
|
||||
UnionPieChartSection.create(
|
||||
value: (stats.totalMembers - stats.activeMembers).toDouble(),
|
||||
color: UnionFlowColors.warning,
|
||||
title: '${(((stats.totalMembers - stats.activeMembers) / stats.totalMembers) * 100).toStringAsFixed(0)}%\nInactifs',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (stats != null && stats.totalMembers > 0)
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Événements à venir (données réelles)
|
||||
if (dashboardData != null && dashboardData.hasUpcomingEvents)
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Événements à venir',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
...dashboardData.upcomingEvents.take(3).map((event) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border(
|
||||
left: BorderSide(color: UnionFlowColors.unionGreen, width: 3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.event, color: UnionFlowColors.unionGreen, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
event.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
event.daysUntilEvent,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${event.currentParticipants}/${event.maxParticipants}',
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (dashboardData != null && dashboardData.hasUpcomingEvents)
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Activités récentes (données réelles)
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity)
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 650),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Activités Récentes',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
...dashboardData.recentActivities.take(5).map((activity) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 16,
|
||||
backgroundColor: UnionFlowColors.unionGreen.withOpacity(0.2),
|
||||
child: Text(
|
||||
activity.userName[0].toUpperCase(),
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
activity.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
activity.description,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
activity.timeAgo,
|
||||
style: const TextStyle(
|
||||
fontSize: 10,
|
||||
color: UnionFlowColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity)
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Panel Root
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 700),
|
||||
child: const Text(
|
||||
'Panel Root',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 800),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Organisations',
|
||||
icon: Icons.business,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const OrganizationsPageWrapper(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.unionGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Utilisateurs',
|
||||
icon: Icons.people,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const UserManagementPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Système',
|
||||
icon: Icons.settings,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const SystemSettingsPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.indigo,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// ── Balance principale ───────────────────────────
|
||||
UnionBalanceCard(
|
||||
label: 'Caisse Globale Système',
|
||||
amount: _formatAmount(stats?.totalContributionAmount ?? 0),
|
||||
trend: stats != null && stats.totalContributionAmount > 0
|
||||
? '${stats.monthlyGrowth >= 0 ? '+' : ''}${stats.monthlyGrowth.toStringAsFixed(1)}%'
|
||||
: null,
|
||||
isTrendPositive: (stats?.monthlyGrowth ?? 0) >= 0,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 900),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Backup',
|
||||
icon: Icons.backup,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const BackupPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.warning,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Sécurité',
|
||||
icon: Icons.security,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const SystemSettingsPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: UnionActionButton(
|
||||
label: 'Support',
|
||||
icon: Icons.help_outline,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const HelpSupportPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: UnionFlowColors.info,
|
||||
),
|
||||
),
|
||||
],
|
||||
// ── Grille 3×2 KPIs ─────────────────────────────
|
||||
GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.0,
|
||||
children: [
|
||||
UnionStatWidget(
|
||||
label: 'Organisations',
|
||||
value: '${stats?.totalOrganizations ?? 0}',
|
||||
icon: Icons.business_rounded,
|
||||
color: UnionFlowColors.unionGreen,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Utilisateurs',
|
||||
value: '${stats?.totalMembers ?? 0}',
|
||||
icon: Icons.groups_rounded,
|
||||
color: UnionFlowColors.gold,
|
||||
trend: stats != null && stats.monthlyGrowth > 0
|
||||
? '+${stats.monthlyGrowth.toStringAsFixed(0)}%'
|
||||
: null,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Événements',
|
||||
value: '${stats?.totalEvents ?? 0}',
|
||||
icon: Icons.event_rounded,
|
||||
color: UnionFlowColors.info,
|
||||
trend: stats != null && stats.upcomingEvents > 0
|
||||
? '${stats.upcomingEvents} à venir'
|
||||
: null,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Cotisations',
|
||||
value: '${stats?.totalContributions ?? 0}',
|
||||
icon: Icons.payments_rounded,
|
||||
color: UnionFlowColors.amber,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Demandes',
|
||||
value: '${stats?.pendingRequests ?? 0}',
|
||||
icon: Icons.pending_actions_rounded,
|
||||
color: (stats?.pendingRequests ?? 0) > 0
|
||||
? UnionFlowColors.warning
|
||||
: UnionFlowColors.success,
|
||||
),
|
||||
UnionStatWidget(
|
||||
label: 'Engagement',
|
||||
value: stats != null
|
||||
? '${(stats.engagementRate * 100).toStringAsFixed(0)}%'
|
||||
: '—',
|
||||
icon: Icons.trending_up_rounded,
|
||||
color: (stats?.engagementRate ?? 0) >= 0.7
|
||||
? UnionFlowColors.success
|
||||
: UnionFlowColors.warning,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// ── Activité membres (pie compact) ───────────────
|
||||
if (stats != null && stats.totalMembers > 0) ...[
|
||||
_buildMemberActivityRow(stats),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// ── Répartition types d'org ──────────────────────
|
||||
if (stats?.organizationTypeDistribution != null &&
|
||||
stats!.organizationTypeDistribution!.isNotEmpty) ...[
|
||||
_buildOrgTypeRow(stats),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// ── Événements à venir ───────────────────────────
|
||||
if (dashboardData != null && dashboardData.hasUpcomingEvents) ...[
|
||||
UFSectionHeader(
|
||||
'Événements à venir',
|
||||
trailing: '${dashboardData.upcomingEvents.length} programmés',
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
...dashboardData.upcomingEvents.take(3).map(
|
||||
(e) => DashboardEventRow(
|
||||
title: e.title,
|
||||
date: e.formattedDate,
|
||||
daysUntil: e.daysUntilEvent,
|
||||
participants:
|
||||
'${e.currentParticipants}/${e.maxParticipants}',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// ── Activités récentes ───────────────────────────
|
||||
if (dashboardData != null && dashboardData.hasRecentActivity) ...[
|
||||
const UFSectionHeader('Activités récentes',
|
||||
trailing: 'Dernières actions'),
|
||||
const SizedBox(height: 6),
|
||||
...dashboardData.recentActivities.take(5).map(
|
||||
(a) => DashboardActivityRow(
|
||||
title: a.title,
|
||||
description: a.description,
|
||||
timeAgo: a.timeAgo,
|
||||
icon: DashboardActivityRow.iconFor(a.type),
|
||||
color: DashboardActivityRow.colorFor(a.type),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// ── Actions rapides ──────────────────────────────
|
||||
const UFSectionHeader('Actions'),
|
||||
const SizedBox(height: 8),
|
||||
GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 6,
|
||||
crossAxisSpacing: 6,
|
||||
childAspectRatio: 2.8,
|
||||
children: [
|
||||
UnionActionButton(
|
||||
label: 'Organisations',
|
||||
icon: Icons.business_rounded,
|
||||
iconColor: UnionFlowColors.unionGreen,
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (_) => const OrganizationsPageWrapper())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Utilisateurs',
|
||||
icon: Icons.people_rounded,
|
||||
iconColor: UnionFlowColors.gold,
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (_) => const UserManagementPage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Système',
|
||||
icon: Icons.settings_rounded,
|
||||
iconColor: UnionFlowColors.indigo,
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (_) => const SystemSettingsPage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Backup',
|
||||
icon: Icons.backup_rounded,
|
||||
iconColor: UnionFlowColors.warning,
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (_) => const BackupPage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Sécurité',
|
||||
icon: Icons.security_rounded,
|
||||
iconColor: UnionFlowColors.error,
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (_) => const SystemSettingsPage())),
|
||||
),
|
||||
UnionActionButton(
|
||||
label: 'Support',
|
||||
icon: Icons.help_outline_rounded,
|
||||
iconColor: UnionFlowColors.info,
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (_) => const HelpSupportPage())),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar() {
|
||||
// ─── AppBar ────────────────────────────────────────────────────────────────
|
||||
|
||||
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: UnionFlowColors.surface,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 1,
|
||||
shadowColor: UnionFlowColors.border,
|
||||
leading: Builder(
|
||||
builder: (ctx) => IconButton(
|
||||
icon: const Icon(Icons.menu, size: 22, color: UnionFlowColors.textPrimary),
|
||||
onPressed: () => Scaffold.of(ctx).openDrawer(),
|
||||
),
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [UnionFlowColors.error, Colors.red.shade900],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: UnionFlowColors.error,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
@@ -467,27 +291,26 @@ class SuperAdminDashboard extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: 8),
|
||||
const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'UnionFlow',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Super Admin (Root)',
|
||||
'Super Admin',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 10,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
@@ -495,102 +318,173 @@ class SuperAdminDashboard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
iconTheme: const IconThemeData(color: UnionFlowColors.textPrimary),
|
||||
actions: [
|
||||
UnionExportButton(
|
||||
onExport: (exportType) {},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
UnionExportButton(onExport: (_) {}),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader(dynamic user) {
|
||||
// ─── Activité membres ─────────────────────────────────────────────────────
|
||||
|
||||
Widget _buildMemberActivityRow(DashboardStatsEntity stats) {
|
||||
final total = stats.totalMembers;
|
||||
final active = stats.activeMembers;
|
||||
final inactive = total - active;
|
||||
final pct = total > 0 ? active / total : 0.0;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [UnionFlowColors.error, Colors.red.shade900],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.error, width: 3),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: UnionFlowColors.error.withOpacity(0.4),
|
||||
blurRadius: 16,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: UnionFlowColors.border),
|
||||
),
|
||||
child: Row(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28,
|
||||
backgroundColor: Colors.white.withOpacity(0.3),
|
||||
child: Text(
|
||||
user?.initials ?? 'SA',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'Activité membres',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'$total membres',
|
||||
style: const TextStyle(fontSize: 10, color: UnionFlowColors.textTertiary),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: LinearProgressIndicator(
|
||||
value: pct,
|
||||
minHeight: 6,
|
||||
backgroundColor: UnionFlowColors.border,
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(UnionFlowColors.success),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
user?.fullName ?? 'Super Administrateur',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Global System Root Access',
|
||||
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(
|
||||
'ROOT',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.error,
|
||||
letterSpacing: 0.5,
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
_dot(UnionFlowColors.success),
|
||||
const SizedBox(width: 4),
|
||||
const Text('Actifs', style: TextStyle(fontSize: 10, color: UnionFlowColors.textSecondary)),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$active (${(pct * 100).toStringAsFixed(0)}%)',
|
||||
style: const TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
_dot(UnionFlowColors.border),
|
||||
const SizedBox(width: 4),
|
||||
const Text('Inactifs', style: TextStyle(fontSize: 10, color: UnionFlowColors.textSecondary)),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$inactive (${total > 0 ? ((inactive / total) * 100).toStringAsFixed(0) : 0}%)',
|
||||
style: const TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Répartition types d'org ──────────────────────────────────────────────
|
||||
|
||||
Widget _buildOrgTypeRow(DashboardStatsEntity stats) {
|
||||
final dist = stats.organizationTypeDistribution!;
|
||||
final total = dist.values.fold(0, (s, v) => s + v);
|
||||
const colors = [
|
||||
UnionFlowColors.unionGreen,
|
||||
UnionFlowColors.gold,
|
||||
UnionFlowColors.info,
|
||||
UnionFlowColors.warning,
|
||||
UnionFlowColors.error,
|
||||
];
|
||||
final entries = dist.entries.toList();
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: UnionFlowColors.border),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'Types d\'organisation',
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary),
|
||||
),
|
||||
const Spacer(),
|
||||
Text('$total org.', style: const TextStyle(fontSize: 10, color: UnionFlowColors.textTertiary)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: Row(
|
||||
children: entries.asMap().entries.map((e) {
|
||||
final frac = total > 0 ? e.value.value / total : 0.0;
|
||||
return Flexible(
|
||||
flex: (frac * 100).round(),
|
||||
child: Container(height: 6, color: colors[e.key % colors.length]),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
...entries.asMap().entries.map((e) {
|
||||
final color = colors[e.key % colors.length];
|
||||
final pct = total > 0 ? (e.value.value / total * 100).toStringAsFixed(0) : '0';
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
_dot(color),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
e.value.key,
|
||||
style: const TextStyle(fontSize: 10, color: UnionFlowColors.textSecondary),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$pct% · ${e.value.value}',
|
||||
style: const TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _dot(Color color) => Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
|
||||
);
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────
|
||||
|
||||
String _formatAmount(double amount) {
|
||||
if (amount >= 1000000) {
|
||||
return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
} else if (amount >= 1000) {
|
||||
return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
}
|
||||
if (amount >= 1000000) return '${(amount / 1000000).toStringAsFixed(1)}M FCFA';
|
||||
if (amount >= 1000) return '${(amount / 1000).toStringAsFixed(0)}K FCFA';
|
||||
return '${amount.toStringAsFixed(0)} FCFA';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class VisitorDashboard extends StatelessWidget {
|
||||
),
|
||||
body: AfricanPatternBackground(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -32,7 +32,7 @@ class VisitorDashboard extends StatelessWidget {
|
||||
delay: const Duration(milliseconds: 100),
|
||||
child: _buildWelcomeCard(),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Fonctionnalités UnionFlow
|
||||
AnimatedSlideIn(
|
||||
@@ -40,13 +40,13 @@ class VisitorDashboard extends StatelessWidget {
|
||||
child: const Text(
|
||||
'Découvrez UnionFlow',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
@@ -98,7 +98,7 @@ class VisitorDashboard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Avantages
|
||||
AnimatedSlideIn(
|
||||
@@ -106,13 +106,13 @@ class VisitorDashboard extends StatelessWidget {
|
||||
child: const Text(
|
||||
'Nos Avantages',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
AnimatedFadeIn(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
@@ -156,45 +156,44 @@ class VisitorDashboard extends StatelessWidget {
|
||||
UnionFlowColors.gold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Call to Action
|
||||
AnimatedSlideIn(
|
||||
delay: const Duration(milliseconds: 1000),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.primaryGradient,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: UnionFlowColors.greenGlowShadow,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.rocket_launch,
|
||||
size: 48,
|
||||
size: 24,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Prêt à Commencer ?',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Rejoignez des milliers d\'organisations qui nous font confiance',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontSize: 11,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
@@ -204,22 +203,22 @@ class VisitorDashboard extends StatelessWidget {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: UnionFlowColors.unionGreen,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: const Text(
|
||||
'Créer un Compte',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 6),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed('/login');
|
||||
@@ -227,7 +226,7 @@ class VisitorDashboard extends StatelessWidget {
|
||||
child: Text(
|
||||
'Déjà membre ? Se connecter',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
),
|
||||
@@ -300,10 +299,10 @@ class VisitorDashboard extends StatelessWidget {
|
||||
|
||||
Widget _buildWelcomeCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.subtleGradient,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: const Border(
|
||||
top: BorderSide(color: UnionFlowColors.unionGreen, width: 3),
|
||||
),
|
||||
@@ -315,15 +314,15 @@ class VisitorDashboard extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
gradient: UnionFlowColors.primaryGradient,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.waving_hand,
|
||||
color: Colors.white,
|
||||
size: 28,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
@@ -334,7 +333,7 @@ class VisitorDashboard extends StatelessWidget {
|
||||
Text(
|
||||
'Bienvenue sur UnionFlow',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: UnionFlowColors.textPrimary,
|
||||
),
|
||||
@@ -343,7 +342,7 @@ class VisitorDashboard extends StatelessWidget {
|
||||
Text(
|
||||
'Votre plateforme de gestion mutualiste et associative',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontSize: 11,
|
||||
color: UnionFlowColors.textSecondary,
|
||||
),
|
||||
),
|
||||
@@ -352,11 +351,11 @@ class VisitorDashboard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Gérez vos mutuelles, tontines, coopératives et associations en toute simplicité. UnionFlow est la solution complète pour la solidarité africaine.',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontSize: 12,
|
||||
height: 1.5,
|
||||
color: UnionFlowColors.textPrimary.withOpacity(0.8),
|
||||
),
|
||||
@@ -368,24 +367,23 @@ class VisitorDashboard extends StatelessWidget {
|
||||
|
||||
Widget _buildFeature(String title, String description, IconData icon, Color color) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border(
|
||||
left: BorderSide(color: color, width: 4),
|
||||
left: BorderSide(color: color, width: 3),
|
||||
),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 24),
|
||||
child: Icon(icon, color: color, size: 15),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
|
||||
@@ -183,7 +183,7 @@ class ActivityItem extends StatelessWidget {
|
||||
children: [
|
||||
if (showStatusIndicator) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: effectiveColor.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
@@ -191,7 +191,7 @@ class ActivityItem extends StatelessWidget {
|
||||
child: Icon(
|
||||
effectiveIcon,
|
||||
color: effectiveColor,
|
||||
size: 16,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -242,15 +242,15 @@ class ActivityItem extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: effectiveColor.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
effectiveIcon,
|
||||
color: effectiveColor,
|
||||
size: 18,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -258,7 +258,7 @@ class ActivityItem extends StatelessWidget {
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
),
|
||||
@@ -409,26 +409,12 @@ class ActivityItem extends StatelessWidget {
|
||||
case ActivityItemStyle.normal:
|
||||
return BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.02),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
);
|
||||
case ActivityItemStyle.detailed:
|
||||
return BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
);
|
||||
case ActivityItemStyle.alert:
|
||||
return BoxDecoration(
|
||||
|
||||
@@ -52,9 +52,9 @@ class SectionHeader extends StatelessWidget {
|
||||
this.action,
|
||||
this.icon,
|
||||
}) : color = ColorTokens.primary,
|
||||
fontSize = 20,
|
||||
fontSize = 16,
|
||||
style = SectionHeaderStyle.primary,
|
||||
bottomSpacing = 16;
|
||||
bottomSpacing = 10;
|
||||
|
||||
/// Constructeur pour un en-tête de section
|
||||
const SectionHeader.section({
|
||||
@@ -64,9 +64,9 @@ class SectionHeader extends StatelessWidget {
|
||||
this.action,
|
||||
this.icon,
|
||||
}) : color = ColorTokens.primary,
|
||||
fontSize = 16,
|
||||
fontSize = 13,
|
||||
style = SectionHeaderStyle.normal,
|
||||
bottomSpacing = 12;
|
||||
bottomSpacing = 8;
|
||||
|
||||
/// Constructeur pour un en-tête de sous-section
|
||||
const SectionHeader.subsection({
|
||||
@@ -106,7 +106,7 @@ class SectionHeader extends StatelessWidget {
|
||||
final effectiveColor = color ?? ColorTokens.primary;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(SpacingTokens.lg),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
@@ -117,21 +117,20 @@ class SectionHeader extends StatelessWidget {
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.radiusLg),
|
||||
boxShadow: ShadowTokens.primary,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -143,7 +142,7 @@ class SectionHeader extends StatelessWidget {
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize ?? 20,
|
||||
fontSize: fontSize ?? 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
@@ -186,7 +185,7 @@ class SectionHeader extends StatelessWidget {
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize ?? 16,
|
||||
fontSize: fontSize ?? 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color ?? ColorTokens.primary,
|
||||
),
|
||||
@@ -239,17 +238,10 @@ class SectionHeader extends StatelessWidget {
|
||||
/// En-tête avec fond de carte
|
||||
Widget _buildCardHeader() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -268,7 +260,7 @@ class SectionHeader extends StatelessWidget {
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize ?? 16,
|
||||
fontSize: fontSize ?? 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color ?? ColorTokens.primary,
|
||||
),
|
||||
|
||||
@@ -136,12 +136,12 @@ class StatCard extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 20),
|
||||
child: Icon(icon, color: color, size: 16),
|
||||
),
|
||||
const Spacer(),
|
||||
Column(
|
||||
@@ -152,7 +152,7 @@ class StatCard extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color,
|
||||
fontSize: 20,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
if (subtitle.isNotEmpty)
|
||||
@@ -167,13 +167,13 @@ class StatCard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
fontSize: 14,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -188,12 +188,12 @@ class StatCard extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 24),
|
||||
child: Icon(icon, color: color, size: 16),
|
||||
),
|
||||
const Spacer(),
|
||||
Column(
|
||||
@@ -204,7 +204,7 @@ class StatCard extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color,
|
||||
fontSize: 24,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
if (subtitle.isNotEmpty)
|
||||
@@ -219,13 +219,13 @@ class StatCard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
fontSize: 16,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -240,7 +240,7 @@ class StatCard extends StatelessWidget {
|
||||
case StatCardSize.normal:
|
||||
return const EdgeInsets.all(12);
|
||||
case StatCardSize.large:
|
||||
return const EdgeInsets.all(16);
|
||||
return const EdgeInsets.all(10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,13 +256,6 @@ class StatCard extends StatelessWidget {
|
||||
return BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
);
|
||||
case StatCardStyle.outlined:
|
||||
return BoxDecoration(
|
||||
|
||||
@@ -24,12 +24,12 @@ class ConnectedRecentActivities extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CoreCard(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildHeader(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
BlocBuilder<DashboardBloc, DashboardState>(
|
||||
builder: (context, state) {
|
||||
if (state is DashboardLoading) {
|
||||
@@ -204,11 +204,11 @@ class ConnectedRecentActivities extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.lightBorder,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
@@ -50,14 +50,14 @@ class ConnectedStatsCard extends StatelessWidget {
|
||||
|
||||
return CoreCard(
|
||||
onTap: onTap,
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -65,10 +65,10 @@ class ConnectedStatsCard extends StatelessWidget {
|
||||
child: Icon(
|
||||
icon,
|
||||
color: color,
|
||||
size: 20,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title.toUpperCase(),
|
||||
@@ -83,12 +83,13 @@ class ConnectedStatsCard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
value,
|
||||
style: AppTypography.headerSmall.copyWith(
|
||||
color: color,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
@@ -105,7 +106,7 @@ class ConnectedStatsCard extends StatelessWidget {
|
||||
|
||||
Widget _buildLoadingCard() {
|
||||
return const CoreCard(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -118,7 +119,7 @@ class ConnectedStatsCard extends StatelessWidget {
|
||||
|
||||
Widget _buildErrorCard(String message) {
|
||||
return CoreCard(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -19,12 +19,12 @@ class ConnectedUpcomingEvents extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CoreCard(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildHeader(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
BlocBuilder<DashboardBloc, DashboardState>(
|
||||
builder: (ctx, state) {
|
||||
if (state is DashboardLoading) {
|
||||
@@ -103,29 +103,29 @@ class ConnectedUpcomingEvents extends StatelessWidget {
|
||||
|
||||
return CoreCard(
|
||||
backgroundColor: Theme.of(context).cardColor,
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: event.imageUrl != null
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Image.network(
|
||||
event.imageUrl!,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) => Icon(Icons.event_outlined, color: statusColor, size: 20),
|
||||
errorBuilder: (context, error, stackTrace) => Icon(Icons.event_outlined, color: statusColor, size: 16),
|
||||
),
|
||||
)
|
||||
: Icon(Icons.event_outlined, color: statusColor, size: 20),
|
||||
: Icon(Icons.event_outlined, color: statusColor, size: 16),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
@@ -168,7 +168,7 @@ class ConnectedUpcomingEvents extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// Widget de menu latéral (drawer) du dashboard
|
||||
/// Navigation principale de l'application
|
||||
library dashboard_drawer;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -10,59 +9,39 @@ import '../../../../shared/widgets/core_card.dart';
|
||||
import '../../../../shared/widgets/mini_avatar.dart';
|
||||
|
||||
import '../../../authentication/presentation/bloc/auth_bloc.dart';
|
||||
|
||||
import '../../../profile/presentation/pages/profile_page_wrapper.dart';
|
||||
import '../../../notifications/presentation/pages/notifications_page_wrapper.dart';
|
||||
import '../../../help/presentation/pages/help_support_page.dart';
|
||||
import '../../../about/presentation/pages/about_page.dart';
|
||||
|
||||
/// Widget de menu latéral (Drawer / Hamburger)
|
||||
///
|
||||
/// Accessible via le bouton hamburger de l'AppBar.
|
||||
/// Contient uniquement les menus « Mon Espace » :
|
||||
/// - Mon Profil
|
||||
/// - Notifications
|
||||
/// - Aide & Support
|
||||
/// - À propos
|
||||
/// - Déconnexion
|
||||
/// Drawer principal — Mon Espace
|
||||
/// Profil · Notifications · Aide · À propos · Déconnexion
|
||||
class DashboardDrawer extends StatelessWidget {
|
||||
/// Callback pour les actions de navigation nommée (optionnel, non utilisé en interne)
|
||||
final Function(String route)? onNavigate;
|
||||
|
||||
/// Callback pour la déconnexion
|
||||
final VoidCallback? onLogout;
|
||||
|
||||
const DashboardDrawer({
|
||||
super.key,
|
||||
this.onNavigate,
|
||||
this.onLogout,
|
||||
});
|
||||
const DashboardDrawer({super.key, this.onNavigate, this.onLogout});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
return BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, authState) {
|
||||
if (authState is! AuthAuthenticated) {
|
||||
return const Drawer();
|
||||
}
|
||||
|
||||
final state = authState;
|
||||
if (authState is! AuthAuthenticated) return const Drawer();
|
||||
|
||||
return Drawer(
|
||||
backgroundColor: ColorTokens.background,
|
||||
backgroundColor:
|
||||
isDark ? AppColors.darkSurface : AppColors.lightBackground,
|
||||
child: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// ── En-tête utilisateur (même style que MorePage) ──────────────
|
||||
_buildUserProfile(state),
|
||||
_buildUserProfile(context, authState),
|
||||
const SizedBox(height: SpacingTokens.md),
|
||||
|
||||
// ── Section Mon Espace ─────────────────────────────────────────
|
||||
_buildSectionTitle('Mon Espace'),
|
||||
|
||||
_buildSectionTitle(context, 'Mon Espace'),
|
||||
_buildOptionTile(
|
||||
context: context,
|
||||
icon: Icons.person,
|
||||
@@ -78,7 +57,8 @@ class DashboardDrawer extends StatelessWidget {
|
||||
title: 'Notifications',
|
||||
subtitle: 'Gérer les notifications',
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => const NotificationsPageWrapper()),
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NotificationsPageWrapper()),
|
||||
),
|
||||
),
|
||||
_buildOptionTile(
|
||||
@@ -99,16 +79,13 @@ class DashboardDrawer extends StatelessWidget {
|
||||
MaterialPageRoute(builder: (_) => const AboutPage()),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: SpacingTokens.md),
|
||||
|
||||
// ── Déconnexion ───────────────────────────────────────────────
|
||||
_buildOptionTile(
|
||||
context: context,
|
||||
icon: Icons.logout,
|
||||
title: 'Déconnexion',
|
||||
subtitle: 'Se déconnecter de l\'application',
|
||||
color: ColorTokens.error,
|
||||
accentColor: AppColors.error,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
context.read<AuthBloc>().add(const AuthLogoutRequested());
|
||||
@@ -123,36 +100,44 @@ class DashboardDrawer extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// ── Profil utilisateur (idem MorePage._buildUserProfile) ──────────────────
|
||||
Widget _buildUserProfile(AuthAuthenticated state) {
|
||||
Widget _buildUserProfile(BuildContext context, AuthAuthenticated state) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final nameColor =
|
||||
isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final emailColor =
|
||||
isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final roleColor =
|
||||
isDark ? AppColors.brandGreenLight : AppColors.primaryGreen;
|
||||
|
||||
return CoreCard(
|
||||
child: Row(
|
||||
children: [
|
||||
MiniAvatar(
|
||||
fallbackText:
|
||||
state.user.firstName.isNotEmpty ? state.user.firstName[0].toUpperCase() : 'U',
|
||||
size: 40,
|
||||
fallbackText: state.user.firstName.isNotEmpty
|
||||
? state.user.firstName[0].toUpperCase()
|
||||
: 'U',
|
||||
size: 32,
|
||||
imageUrl: state.user.avatar,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${state.user.firstName} ${state.user.lastName}',
|
||||
style: AppTypography.actionText,
|
||||
style: AppTypography.actionText.copyWith(color: nameColor),
|
||||
),
|
||||
Text(
|
||||
state.effectiveRole.displayName.toUpperCase(),
|
||||
style: AppTypography.badgeText.copyWith(
|
||||
color: AppColors.primaryGreen,
|
||||
color: roleColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state.user.email,
|
||||
style: AppTypography.subtitleSmall,
|
||||
style: AppTypography.subtitleSmall.copyWith(color: emailColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -162,31 +147,38 @@ class DashboardDrawer extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// ── Titre de section (idem MorePage._buildSectionTitle) ───────────────────
|
||||
Widget _buildSectionTitle(String title) {
|
||||
Widget _buildSectionTitle(BuildContext context, String title) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 24, bottom: 8, left: 4),
|
||||
padding: const EdgeInsets.only(top: 10, bottom: 6, left: 4),
|
||||
child: Text(
|
||||
title.toUpperCase(),
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 1.1,
|
||||
color: AppColors.textSecondaryLight,
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ── Tuile d'option (idem MorePage._buildOptionTile) ───────────────────────
|
||||
Widget _buildOptionTile({
|
||||
required BuildContext context,
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required String subtitle,
|
||||
required VoidCallback onTap,
|
||||
Color? color,
|
||||
Color? accentColor,
|
||||
}) {
|
||||
final effectiveColor = color ?? AppColors.primaryGreen;
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final accent = accentColor ?? AppColors.primaryGreen;
|
||||
final titleColor = accentColor != null
|
||||
? accentColor
|
||||
: (isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight);
|
||||
final subtitleColor =
|
||||
isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final chevronColor =
|
||||
isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
|
||||
return CoreCard(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
@@ -194,40 +186,30 @@ class DashboardDrawer extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: effectiveColor.withOpacity(0.1),
|
||||
color: accent.withOpacity(isDark ? 0.2 : 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: effectiveColor,
|
||||
size: 20,
|
||||
),
|
||||
child: Icon(icon, color: accent, size: 16),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: AppTypography.actionText.copyWith(
|
||||
color: color ?? AppColors.textPrimaryLight,
|
||||
),
|
||||
style: AppTypography.actionText.copyWith(color: titleColor),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
style: AppTypography.subtitleSmall,
|
||||
style: AppTypography.subtitleSmall.copyWith(color: subtitleColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: AppColors.textSecondaryLight,
|
||||
size: 16,
|
||||
),
|
||||
Icon(Icons.chevron_right, color: chevronColor, size: 16),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -239,12 +239,17 @@ class DashboardActivity extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
time,
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
color: AppColors.textSecondaryLight,
|
||||
fontSize: 9,
|
||||
),
|
||||
Builder(
|
||||
builder: (ctx) {
|
||||
final isDark = Theme.of(ctx).brightness == Brightness.dark;
|
||||
return Text(
|
||||
time,
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight,
|
||||
fontSize: 9,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -88,21 +88,14 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
end: Alignment.bottomRight,
|
||||
colors: [AppColors.brandGreen, AppColors.primaryGreen],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.primaryGreen.withOpacity(0.3),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
padding: const EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildHeader(),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 10),
|
||||
BlocConsumer<DashboardBloc, DashboardState>(
|
||||
listener: (context, state) {
|
||||
if (state is DashboardLoaded) {
|
||||
@@ -137,7 +130,7 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
return Transform.scale(
|
||||
scale: _pulseAnimation.value,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
@@ -145,7 +138,7 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
child: const Icon(
|
||||
Icons.speed_outlined,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -248,7 +241,7 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -297,10 +290,10 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
),
|
||||
@@ -313,9 +306,9 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
Icon(
|
||||
icon,
|
||||
color: color,
|
||||
size: 16,
|
||||
size: 14,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label.toUpperCase(),
|
||||
@@ -327,13 +320,13 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
displayValue,
|
||||
style: AppTypography.headerSmall.copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
if (maxValue != null) ...[
|
||||
@@ -357,15 +350,15 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: _buildLoadingMetricItem()),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: _buildLoadingMetricItem()),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: _buildLoadingMetricItem()),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: _buildLoadingMetricItem()),
|
||||
],
|
||||
),
|
||||
@@ -375,11 +368,11 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
|
||||
Widget _buildLoadingMetricItem() {
|
||||
return Container(
|
||||
height: 100,
|
||||
padding: const EdgeInsets.all(16),
|
||||
height: 72,
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(
|
||||
@@ -392,10 +385,10 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
|
||||
Widget _buildErrorMetrics() {
|
||||
return Container(
|
||||
height: 200,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.error.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
@@ -421,10 +414,10 @@ class _RealTimeMetricsWidgetState extends State<RealTimeMetricsWidget>
|
||||
|
||||
Widget _buildEmptyMetrics() {
|
||||
return Container(
|
||||
height: 200,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user