feat(features): refontes adhesions/admin/auth/backup/contributions/dashboard/epargne/events

- adhesions : bloc complet avec events/states/model, dialogs paiement/rejet
- admin : users bloc, user management list/detail pages
- authentication : bloc + keycloak auth service + webview
- backup : bloc complet, repository, models
- contributions : bloc + widgets + export
- dashboard : widgets connectés (activities, events, notifications, search)
  + charts + monitoring + shortcuts
- epargne : repository, transactions, dialogs
- events : bloc complet, pages (detail, connected, wrapper), models
This commit is contained in:
dahoud
2026-04-15 20:26:48 +00:00
parent 45dcd2171e
commit 120434aba0
36 changed files with 903 additions and 1411 deletions

View File

@@ -10,28 +10,28 @@ import '../../../../../shared/design_system/unionflow_design_system.dart';
class ActivityItem extends StatelessWidget {
/// Titre principal de l'activité
final String title;
/// Description ou détails de l'activité
final String? description;
/// Horodatage de l'activité
final String timestamp;
/// Icône représentative de l'activité
final IconData? icon;
/// Couleur thématique de l'activité
final Color? color;
/// Type d'activité pour le style automatique
final ActivityType? type;
/// Callback lors du tap sur l'élément
final VoidCallback? onTap;
/// Style de l'élément d'activité
final ActivityItemStyle style;
/// Afficher ou non l'indicateur de statut
final bool showStatusIndicator;
@@ -95,7 +95,7 @@ class ActivityItem extends StatelessWidget {
required this.timestamp,
this.onTap,
}) : icon = Icons.error,
color = Colors.red,
color = ColorTokens.error,
type = ActivityType.error,
style = ActivityItemStyle.alert,
showStatusIndicator = true;
@@ -108,7 +108,7 @@ class ActivityItem extends StatelessWidget {
required this.timestamp,
this.onTap,
}) : icon = Icons.check_circle,
color = const Color(0xFF00B894),
color = ColorTokens.successLight,
type = ActivityType.success,
style = ActivityItemStyle.normal,
showStatusIndicator = true;
@@ -123,28 +123,29 @@ class ActivityItem extends StatelessWidget {
child: Container(
margin: const EdgeInsets.only(bottom: 8),
padding: _getPadding(),
decoration: _getDecoration(effectiveColor),
child: _buildContent(effectiveColor, effectiveIcon),
decoration: _getDecoration(context, effectiveColor),
child: _buildContent(context, effectiveColor, effectiveIcon),
),
);
}
/// Contenu principal de l'élément
Widget _buildContent(Color effectiveColor, IconData effectiveIcon) {
Widget _buildContent(BuildContext context, Color effectiveColor, IconData effectiveIcon) {
switch (style) {
case ActivityItemStyle.minimal:
return _buildMinimalContent(effectiveColor, effectiveIcon);
return _buildMinimalContent(context, effectiveColor, effectiveIcon);
case ActivityItemStyle.normal:
return _buildNormalContent(effectiveColor, effectiveIcon);
return _buildNormalContent(context, effectiveColor, effectiveIcon);
case ActivityItemStyle.detailed:
return _buildDetailedContent(effectiveColor, effectiveIcon);
return _buildDetailedContent(context, effectiveColor, effectiveIcon);
case ActivityItemStyle.alert:
return _buildAlertContent(effectiveColor, effectiveIcon);
return _buildAlertContent(context, effectiveColor, effectiveIcon);
}
}
/// Contenu minimal (ligne simple)
Widget _buildMinimalContent(Color effectiveColor, IconData effectiveIcon) {
Widget _buildMinimalContent(BuildContext context, Color effectiveColor, IconData effectiveIcon) {
final scheme = Theme.of(context).colorScheme;
return Row(
children: [
if (showStatusIndicator)
@@ -160,16 +161,17 @@ class ActivityItem extends StatelessWidget {
Expanded(
child: Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: scheme.onSurface,
),
),
),
Text(
timestamp,
style: const TextStyle(
color: Colors.grey,
style: TextStyle(
color: scheme.onSurfaceVariant,
fontSize: 10,
),
),
@@ -178,7 +180,8 @@ class ActivityItem extends StatelessWidget {
}
/// Contenu normal avec icône
Widget _buildNormalContent(Color effectiveColor, IconData effectiveIcon) {
Widget _buildNormalContent(BuildContext context, Color effectiveColor, IconData effectiveIcon) {
final scheme = Theme.of(context).colorScheme;
return Row(
children: [
if (showStatusIndicator) ...[
@@ -202,10 +205,10 @@ class ActivityItem extends StatelessWidget {
children: [
Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xFF1F2937),
color: scheme.onSurface,
),
),
if (description != null) ...[
@@ -214,7 +217,7 @@ class ActivityItem extends StatelessWidget {
description!,
style: TextStyle(
fontSize: 12,
color: Colors.grey[600],
color: scheme.onSurfaceVariant,
),
),
],
@@ -225,7 +228,7 @@ class ActivityItem extends StatelessWidget {
Text(
timestamp,
style: TextStyle(
color: Colors.grey[500],
color: scheme.onSurfaceVariant,
fontSize: 11,
fontWeight: FontWeight.w500,
),
@@ -235,7 +238,8 @@ class ActivityItem extends StatelessWidget {
}
/// Contenu détaillé avec plus d'informations
Widget _buildDetailedContent(Color effectiveColor, IconData effectiveIcon) {
Widget _buildDetailedContent(BuildContext context, Color effectiveColor, IconData effectiveIcon) {
final scheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -257,17 +261,17 @@ class ActivityItem extends StatelessWidget {
Expanded(
child: Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: Color(0xFF1F2937),
color: scheme.onSurface,
),
),
),
Text(
timestamp,
style: TextStyle(
color: Colors.grey[500],
color: scheme.onSurfaceVariant,
fontSize: 12,
fontWeight: FontWeight.w500,
),
@@ -282,7 +286,7 @@ class ActivityItem extends StatelessWidget {
description!,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
color: scheme.onSurfaceVariant,
height: 1.4,
),
),
@@ -293,7 +297,8 @@ class ActivityItem extends StatelessWidget {
}
/// Contenu pour les alertes avec style spécial
Widget _buildAlertContent(Color effectiveColor, IconData effectiveIcon) {
Widget _buildAlertContent(BuildContext context, Color effectiveColor, IconData effectiveIcon) {
final scheme = Theme.of(context).colorScheme;
return Row(
children: [
Icon(
@@ -320,7 +325,7 @@ class ActivityItem extends StatelessWidget {
description!,
style: TextStyle(
fontSize: 12,
color: Colors.grey[600],
color: scheme.onSurfaceVariant,
),
),
],
@@ -331,7 +336,7 @@ class ActivityItem extends StatelessWidget {
Text(
timestamp,
style: TextStyle(
color: Colors.grey[500],
color: scheme.onSurfaceVariant,
fontSize: 11,
),
),
@@ -366,7 +371,7 @@ class ActivityItem extends StatelessWidget {
/// Icône effective selon le type
IconData _getEffectiveIcon() {
if (icon != null) return icon!;
switch (type) {
case ActivityType.system:
return Icons.settings;
@@ -401,19 +406,20 @@ class ActivityItem extends StatelessWidget {
}
}
/// Décoration selon le style
BoxDecoration _getDecoration(Color effectiveColor) {
/// Décoration selon le style — toujours theme-aware
BoxDecoration _getDecoration(BuildContext context, Color effectiveColor) {
final scheme = Theme.of(context).colorScheme;
switch (style) {
case ActivityItemStyle.minimal:
return const BoxDecoration();
case ActivityItemStyle.normal:
return BoxDecoration(
color: Colors.white,
color: scheme.surface,
borderRadius: BorderRadius.circular(6),
);
case ActivityItemStyle.detailed:
return BoxDecoration(
color: Colors.white,
color: scheme.surface,
borderRadius: BorderRadius.circular(8),
);
case ActivityItemStyle.alert:

View File

@@ -10,25 +10,25 @@ import '../../../../../shared/design_system/unionflow_design_system.dart';
class SectionHeader extends StatelessWidget {
/// Titre principal de la section
final String title;
/// Sous-titre optionnel
final String? subtitle;
/// Widget d'action à droite (bouton, icône, etc.)
final Widget? action;
/// Icône optionnelle à gauche du titre
final IconData? icon;
/// Couleur du titre et de l'icône
/// Couleur du titre et de l'icône (null = adaptatif selon le thème)
final Color? color;
/// Taille du titre
final double? fontSize;
/// Style de l'en-tête
final SectionHeaderStyle style;
/// Espacement en bas de l'en-tête
final double bottomSpacing;
@@ -68,14 +68,14 @@ class SectionHeader extends StatelessWidget {
style = SectionHeaderStyle.normal,
bottomSpacing = 8;
/// Constructeur pour un en-tête de sous-section
/// Constructeur pour un en-tête de sous-section (couleur adaptative)
const SectionHeader.subsection({
super.key,
required this.title,
this.subtitle,
this.action,
this.icon,
}) : color = const Color(0xFF374151),
}) : color = null, // null → adaptatif via Theme.of(context).colorScheme.onSurface
fontSize = 14,
style = SectionHeaderStyle.minimal,
bottomSpacing = 8;
@@ -84,25 +84,26 @@ class SectionHeader extends StatelessWidget {
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: bottomSpacing),
child: _buildContent(),
child: _buildContent(context),
);
}
Widget _buildContent() {
Widget _buildContent(BuildContext context) {
switch (style) {
case SectionHeaderStyle.primary:
return _buildPrimaryHeader();
return _buildPrimaryHeader(context);
case SectionHeaderStyle.normal:
return _buildNormalHeader();
return _buildNormalHeader(context);
case SectionHeaderStyle.minimal:
return _buildMinimalHeader();
return _buildMinimalHeader(context);
case SectionHeaderStyle.card:
return _buildCardHeader();
return _buildCardHeader(context);
}
}
/// En-tête principal avec fond coloré
Widget _buildPrimaryHeader() {
/// En-tête principal avec fond coloré (gradient sur couleur thématique)
/// Colors.white est correct ici : texte sur fond coloré opaque
Widget _buildPrimaryHeader(BuildContext context) {
final effectiveColor = color ?? ColorTokens.primary;
return Container(
@@ -167,13 +168,15 @@ class SectionHeader extends StatelessWidget {
}
/// En-tête normal avec icône et action
Widget _buildNormalHeader() {
Widget _buildNormalHeader(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final effectiveColor = color ?? scheme.primary;
return Row(
children: [
if (icon != null) ...[
Icon(
icon,
color: color ?? ColorTokens.primary,
color: effectiveColor,
size: 20,
),
const SizedBox(width: SpacingTokens.md),
@@ -187,7 +190,7 @@ class SectionHeader extends StatelessWidget {
style: TextStyle(
fontSize: fontSize ?? 13,
fontWeight: FontWeight.bold,
color: color ?? ColorTokens.primary,
color: effectiveColor,
),
),
if (subtitle != null) ...[
@@ -196,7 +199,7 @@ class SectionHeader extends StatelessWidget {
subtitle!,
style: TextStyle(
fontSize: 12,
color: Colors.grey[600],
color: scheme.onSurfaceVariant,
),
),
],
@@ -208,14 +211,16 @@ class SectionHeader extends StatelessWidget {
);
}
/// En-tête minimal simple
Widget _buildMinimalHeader() {
/// En-tête minimal simple — couleur totalement adaptative
Widget _buildMinimalHeader(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final effectiveColor = color ?? scheme.onSurface;
return Row(
children: [
if (icon != null) ...[
Icon(
icon,
color: color ?? const Color(0xFF374151),
color: effectiveColor,
size: 16,
),
const SizedBox(width: 6),
@@ -226,7 +231,7 @@ class SectionHeader extends StatelessWidget {
style: TextStyle(
fontSize: fontSize ?? 14,
fontWeight: FontWeight.w600,
color: color ?? const Color(0xFF374151),
color: effectiveColor,
),
),
),
@@ -235,20 +240,23 @@ class SectionHeader extends StatelessWidget {
);
}
/// En-tête avec fond de carte
Widget _buildCardHeader() {
/// En-tête avec fond de carte — surface theme-aware
Widget _buildCardHeader(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final effectiveColor = color ?? scheme.primary;
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.white,
color: scheme.surface,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: scheme.outline, width: 0.5),
),
child: Row(
children: [
if (icon != null) ...[
Icon(
icon,
color: color ?? ColorTokens.primary,
color: effectiveColor,
size: 20,
),
const SizedBox(width: SpacingTokens.md),
@@ -262,7 +270,7 @@ class SectionHeader extends StatelessWidget {
style: TextStyle(
fontSize: fontSize ?? 13,
fontWeight: FontWeight.bold,
color: color ?? ColorTokens.primary,
color: effectiveColor,
),
),
if (subtitle != null) ...[
@@ -271,7 +279,7 @@ class SectionHeader extends StatelessWidget {
subtitle!,
style: TextStyle(
fontSize: 12,
color: Colors.grey[600],
color: scheme.onSurfaceVariant,
),
),
],

View File

@@ -1,31 +1,31 @@
import 'package:flutter/material.dart';
/// Widget réutilisable pour afficher une carte de statistique
///
///
/// Composant générique utilisé dans tous les dashboards pour afficher
/// des métriques avec icône, valeur, titre et sous-titre.
class StatCard extends StatelessWidget {
/// Titre principal de la statistique
final String title;
/// Valeur numérique ou textuelle à afficher
final String value;
/// Sous-titre ou description complémentaire
final String subtitle;
/// Icône représentative de la métrique
final IconData icon;
/// Couleur thématique de la carte
final Color color;
/// Callback optionnel lors du tap sur la carte
final VoidCallback? onTap;
/// Taille de la carte (compact, normal, large)
final StatCardSize size;
/// Style de la carte (minimal, elevated, outlined)
final StatCardStyle style;
@@ -71,26 +71,27 @@ class StatCard extends StatelessWidget {
onTap: onTap,
child: Container(
padding: _getPadding(),
decoration: _getDecoration(),
child: _buildContent(),
decoration: _getDecoration(context),
child: _buildContent(context),
),
);
}
/// Contenu principal de la carte
Widget _buildContent() {
Widget _buildContent(BuildContext context) {
switch (size) {
case StatCardSize.compact:
return _buildCompactContent();
return _buildCompactContent(context);
case StatCardSize.normal:
return _buildNormalContent();
return _buildNormalContent(context);
case StatCardSize.large:
return _buildLargeContent();
return _buildLargeContent(context);
}
}
/// Contenu compact pour les KPIs
Widget _buildCompactContent() {
Widget _buildCompactContent(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -111,16 +112,16 @@ class StatCard extends StatelessWidget {
const SizedBox(height: 4),
Text(
title,
style: const TextStyle(
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.black87,
color: scheme.onSurface,
fontSize: 12,
),
),
Text(
subtitle,
style: const TextStyle(
color: Colors.grey,
style: TextStyle(
color: scheme.onSurfaceVariant,
fontSize: 10,
),
),
@@ -129,7 +130,8 @@ class StatCard extends StatelessWidget {
}
/// Contenu normal pour les métriques
Widget _buildNormalContent() {
Widget _buildNormalContent(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -159,7 +161,7 @@ class StatCard extends StatelessWidget {
Text(
subtitle,
style: TextStyle(
color: Colors.grey[600],
color: scheme.onSurfaceVariant,
fontSize: 10,
),
),
@@ -170,9 +172,9 @@ class StatCard extends StatelessWidget {
const SizedBox(height: 8),
Text(
title,
style: const TextStyle(
style: TextStyle(
fontWeight: FontWeight.w600,
color: Color(0xFF1F2937),
color: scheme.onSurface,
fontSize: 13,
),
),
@@ -181,7 +183,8 @@ class StatCard extends StatelessWidget {
}
/// Contenu large pour les dashboards principaux
Widget _buildLargeContent() {
Widget _buildLargeContent(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -211,7 +214,7 @@ class StatCard extends StatelessWidget {
Text(
subtitle,
style: TextStyle(
color: Colors.grey[600],
color: scheme.onSurfaceVariant,
fontSize: 12,
),
),
@@ -222,9 +225,9 @@ class StatCard extends StatelessWidget {
const SizedBox(height: 8),
Text(
title,
style: const TextStyle(
style: TextStyle(
fontWeight: FontWeight.w600,
color: Color(0xFF1F2937),
color: scheme.onSurface,
fontSize: 13,
),
),
@@ -244,22 +247,19 @@ class StatCard extends StatelessWidget {
}
}
/// Décoration selon le style
BoxDecoration _getDecoration() {
/// Décoration selon le style — toujours theme-aware
BoxDecoration _getDecoration(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
switch (style) {
case StatCardStyle.minimal:
return BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
);
case StatCardStyle.elevated:
return BoxDecoration(
color: Colors.white,
color: scheme.surface,
borderRadius: BorderRadius.circular(8),
);
case StatCardStyle.outlined:
return BoxDecoration(
color: Colors.white,
color: scheme.surface,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: color.withOpacity(0.2),