feat: WebSocket temps réel + Finance Workflow + corrections

- Task #6: WebSocket /ws/dashboard + Kafka events (5 topics)
  * Backend: KafkaEventProducer, KafkaEventConsumer
  * Mobile: WebSocketService (reconnection, heartbeat, typed events)
  * DashboardBloc: Auto-refresh depuis WebSocket events

- Finance Workflow: approbations + budgets (backend + mobile)
  * Backend: entities, services, resources, migrations Flyway V6
  * Mobile: features finance_workflow complète avec BLoC

- Corrections DI: interfaces IRepository partout
  * IProfileRepository, IOrganizationRepository, IMembreRepository
  * GetIt configuré avec @injectable

- Spec-Kit: constitution + templates mis à jour
  * .specify/memory/constitution.md enrichie
  * Templates agent, plan, spec, tasks, checklist

- Nettoyage: fichiers temporaires supprimés

Signed-off-by: lions dev Team
This commit is contained in:
dahoud
2026-03-15 02:12:17 +00:00
parent bbc409de9d
commit e8ad874015
635 changed files with 58160 additions and 20674 deletions

View File

@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fl_chart/fl_chart.dart';
import '../../../domain/entities/dashboard_entity.dart';
import '../../bloc/dashboard_bloc.dart';
import '../../../../../shared/design_system/dashboard_theme.dart';
import '../../../../../shared/design_system/unionflow_design_system.dart';
import '../../../../../shared/widgets/core_card.dart';
/// Widget de graphique pour le dashboard
class DashboardChartWidget extends StatelessWidget {
@@ -20,14 +21,13 @@ class DashboardChartWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
decoration: DashboardTheme.cardDecoration,
padding: const EdgeInsets.all(DashboardTheme.spacing16),
return CoreCard(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeader(),
const SizedBox(height: DashboardTheme.spacing16),
const SizedBox(height: 16),
SizedBox(
height: height,
child: BlocBuilder<DashboardBloc, DashboardState>(
@@ -54,23 +54,16 @@ class DashboardChartWidget extends StatelessWidget {
Widget _buildHeader() {
return Row(
children: [
Container(
padding: const EdgeInsets.all(DashboardTheme.spacing8),
decoration: BoxDecoration(
color: DashboardTheme.royalBlue.withOpacity(0.1),
borderRadius: BorderRadius.circular(DashboardTheme.borderRadiusSmall),
),
child: Icon(
_getChartIcon(),
color: DashboardTheme.royalBlue,
size: 20,
),
Icon(
_getChartIcon(),
color: AppColors.primaryGreen,
size: 18,
),
const SizedBox(width: DashboardTheme.spacing12),
const SizedBox(width: 8),
Expanded(
child: Text(
title,
style: DashboardTheme.titleMedium,
title.toUpperCase(),
style: AppTypography.subtitleSmall.copyWith(fontWeight: FontWeight.bold, letterSpacing: 1.1),
),
),
],
@@ -97,22 +90,22 @@ class DashboardChartWidget extends StatelessWidget {
centerSpaceRadius: 40,
sections: [
PieChartSectionData(
color: DashboardTheme.success,
color: AppColors.success,
value: stats.activeMembers.toDouble(),
title: '${stats.activeMembers}',
radius: 50,
titleStyle: DashboardTheme.bodySmall.copyWith(
color: DashboardTheme.white,
titleStyle: AppTypography.badgeText.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
PieChartSectionData(
color: DashboardTheme.grey300,
color: AppColors.lightBorder,
value: (stats.totalMembers - stats.activeMembers).toDouble(),
title: '${stats.totalMembers - stats.activeMembers}',
radius: 45,
titleStyle: DashboardTheme.bodySmall.copyWith(
color: DashboardTheme.grey700,
titleStyle: AppTypography.badgeText.copyWith(
color: AppColors.textSecondaryLight,
fontWeight: FontWeight.bold,
),
),
@@ -130,7 +123,7 @@ class DashboardChartWidget extends StatelessWidget {
horizontalInterval: stats.totalContributionAmount / 4,
getDrawingHorizontalLine: (value) {
return const FlLine(
color: DashboardTheme.grey200,
color: AppColors.lightBorder,
strokeWidth: 1,
);
},
@@ -149,7 +142,7 @@ class DashboardChartWidget extends StatelessWidget {
if (value.toInt() >= 0 && value.toInt() < months.length) {
return Text(
months[value.toInt()],
style: DashboardTheme.bodySmall,
style: AppTypography.subtitleSmall.copyWith(fontSize: 8),
);
}
return const Text('');
@@ -164,7 +157,7 @@ class DashboardChartWidget extends StatelessWidget {
getTitlesWidget: (double value, TitleMeta meta) {
return Text(
'${(value / 1000).toStringAsFixed(0)}K',
style: DashboardTheme.bodySmall,
style: AppTypography.subtitleSmall.copyWith(fontSize: 8),
);
},
),
@@ -181,8 +174,8 @@ class DashboardChartWidget extends StatelessWidget {
isCurved: true,
gradient: const LinearGradient(
colors: [
DashboardTheme.tealBlue,
DashboardTheme.royalBlue,
AppColors.brandGreen,
AppColors.primaryGreen,
],
),
barWidth: 3,
@@ -192,8 +185,8 @@ class DashboardChartWidget extends StatelessWidget {
show: true,
gradient: LinearGradient(
colors: [
DashboardTheme.tealBlue.withOpacity(0.3),
DashboardTheme.royalBlue.withOpacity(0.1),
AppColors.brandGreen.withOpacity(0.3),
AppColors.primaryGreen.withOpacity(0.1),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
@@ -228,7 +221,7 @@ class DashboardChartWidget extends StatelessWidget {
events[value.toInt()].title.length > 8
? '${events[value.toInt()].title.substring(0, 8)}...'
: events[value.toInt()].title,
style: DashboardTheme.bodySmall,
style: AppTypography.subtitleSmall.copyWith(fontSize: 8),
textAlign: TextAlign.center,
),
);
@@ -252,10 +245,10 @@ class DashboardChartWidget extends StatelessWidget {
BarChartRodData(
toY: event.currentParticipants.toDouble(),
color: event.isFull
? DashboardTheme.error
? AppColors.error
: event.isAlmostFull
? DashboardTheme.warning
: DashboardTheme.success,
? AppColors.warning
: AppColors.success,
width: 16,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(4),
@@ -283,13 +276,13 @@ class DashboardChartWidget extends StatelessWidget {
LineChartBarData(
spots: _generateGrowthSpots(stats.monthlyGrowth),
isCurved: true,
color: stats.hasGrowth ? DashboardTheme.success : DashboardTheme.error,
color: stats.hasGrowth ? AppColors.success : AppColors.error,
barWidth: 3,
isStrokeCapRound: true,
dotData: const FlDotData(show: false),
belowBarData: BarAreaData(
show: true,
color: (stats.hasGrowth ? DashboardTheme.success : DashboardTheme.error)
color: (stats.hasGrowth ? AppColors.success : AppColors.error)
.withOpacity(0.2),
),
),
@@ -321,12 +314,13 @@ class DashboardChartWidget extends StatelessWidget {
Widget _buildLoadingChart() {
return Container(
decoration: BoxDecoration(
color: DashboardTheme.grey100,
borderRadius: BorderRadius.circular(DashboardTheme.borderRadius),
color: AppColors.lightBorder.withOpacity(0.5),
borderRadius: BorderRadius.circular(12),
),
child: const Center(
child: CircularProgressIndicator(
color: DashboardTheme.royalBlue,
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(AppColors.primaryGreen),
),
),
);
@@ -335,8 +329,8 @@ class DashboardChartWidget extends StatelessWidget {
Widget _buildErrorChart() {
return Container(
decoration: BoxDecoration(
color: DashboardTheme.error.withOpacity(0.1),
borderRadius: BorderRadius.circular(DashboardTheme.borderRadius),
color: AppColors.error.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
),
child: Center(
child: Column(
@@ -344,14 +338,16 @@ class DashboardChartWidget extends StatelessWidget {
children: [
const Icon(
Icons.error_outline,
color: DashboardTheme.error,
size: 32,
color: AppColors.error,
size: 24,
),
const SizedBox(height: DashboardTheme.spacing8),
const SizedBox(height: 8),
Text(
'Erreur de chargement',
style: DashboardTheme.bodyMedium.copyWith(
color: DashboardTheme.error,
'ERREUR',
style: AppTypography.subtitleSmall.copyWith(
color: AppColors.error,
fontWeight: FontWeight.bold,
fontSize: 10,
),
),
],
@@ -363,23 +359,24 @@ class DashboardChartWidget extends StatelessWidget {
Widget _buildEmptyChart() {
return Container(
decoration: BoxDecoration(
color: DashboardTheme.grey50,
borderRadius: BorderRadius.circular(DashboardTheme.borderRadius),
color: AppColors.lightBorder.withOpacity(0.2),
borderRadius: BorderRadius.circular(12),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.bar_chart,
color: DashboardTheme.grey400,
size: 32,
Icons.bar_chart_outlined,
color: AppColors.textSecondaryLight,
size: 24,
),
const SizedBox(height: DashboardTheme.spacing8),
const SizedBox(height: 8),
Text(
'Aucune donnée',
style: DashboardTheme.bodyMedium.copyWith(
color: DashboardTheme.grey500,
'AUCUNE DONNÉE',
style: AppTypography.subtitleSmall.copyWith(
fontWeight: FontWeight.bold,
fontSize: 10,
),
),
],
@@ -391,13 +388,13 @@ class DashboardChartWidget extends StatelessWidget {
IconData _getChartIcon() {
switch (chartType) {
case DashboardChartType.memberActivity:
return Icons.pie_chart;
return Icons.pie_chart_outline;
case DashboardChartType.contributionTrend:
return Icons.trending_up;
return Icons.trending_up_outlined;
case DashboardChartType.eventParticipation:
return Icons.bar_chart;
return Icons.bar_chart_outlined;
case DashboardChartType.monthlyGrowth:
return Icons.show_chart;
return Icons.show_chart_outlined;
}
}
}