feat(features): refontes onboarding/organizations/profile/reports/settings/solidarity

- onboarding : datasource souscription, models formule/status, bloc complet
- organizations : bloc orgs + switcher + types bloc, models, pages edit/create
- profile : bloc complet avec change password, delete account, preferences
- reports : bloc avec DashboardReports + ScheduleReports + GenerateReport
- settings : language, privacy, feedback pages
- solidarity : bloc complet demandes d'aide (CRUD, approuver, rejeter)
This commit is contained in:
dahoud
2026-04-15 20:27:12 +00:00
parent dbf6a972ba
commit 744faa3a9c
17 changed files with 711 additions and 403 deletions

View File

@@ -1,8 +1,11 @@
/// Dialogue de création d'organisation (mutuelle)
/// Formulaire complet pour créer une nouvelle mutuelle
/// Dialogue de création d'organisation
/// Formulaire complet pour créer une nouvelle organisation
library create_organisation_dialog;
import 'package:flutter/material.dart';
import '../../../../shared/design_system/tokens/module_colors.dart';
import '../../../../shared/design_system/tokens/color_tokens.dart';
import '../../../../shared/design_system/tokens/app_colors.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/organizations_bloc.dart';
import '../../bloc/organizations_event.dart';
@@ -79,7 +82,7 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
Container(
padding: const EdgeInsets.all(16),
decoration: const BoxDecoration(
color: Color(0xFF8B5CF6),
color: ModuleColors.organisations,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(4),
topRight: Radius.circular(4),
@@ -90,7 +93,7 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
const Icon(Icons.business, color: Colors.white),
const SizedBox(width: 12),
const Text(
'Créer une mutuelle',
'Nouvelle organisation',
style: TextStyle(
color: Colors.white,
fontSize: 18,
@@ -122,7 +125,7 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
TextFormField(
controller: _nomController,
decoration: const InputDecoration(
labelText: 'Nom de la mutuelle *',
labelText: 'Nom de l\'organisation *',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.business),
),
@@ -141,7 +144,7 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
labelText: 'Nom court / Sigle',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.short_text),
hintText: 'Ex: MUTEC, MUPROCI',
hintText: 'Ex: LIONS, CEADP',
),
),
const SizedBox(height: 12),
@@ -176,8 +179,13 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
child: LinearProgressIndicator(),
);
}
final scheme = Theme.of(context).colorScheme;
return DropdownButtonFormField<String>(
value: types.any((t) => t.code == _selectedTypeCode) ? _selectedTypeCode : null,
isExpanded: true,
menuMaxHeight: 220,
dropdownColor: scheme.surface,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: scheme.onSurface),
decoration: const InputDecoration(
labelText: 'Type d\'organisation *',
border: OutlineInputBorder(),
@@ -185,7 +193,11 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
),
items: types.map((type) => DropdownMenuItem<String>(
value: type.code,
child: Text(type.libelle),
child: Text(
type.libelle,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: scheme.onSurface),
),
)).toList(),
onChanged: (value) => setState(() => _selectedTypeCode = value),
validator: (value) => value == null ? 'Le type est obligatoire' : null,
@@ -349,8 +361,8 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey[100],
border: Border(top: BorderSide(color: Colors.grey[300]!)),
color: Theme.of(context).colorScheme.surfaceContainerHighest,
border: Border(top: BorderSide(color: Theme.of(context).colorScheme.outline)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -363,10 +375,10 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
ElevatedButton(
onPressed: _submitForm,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF8B5CF6),
foregroundColor: Colors.white,
backgroundColor: ModuleColors.organisations,
foregroundColor: AppColors.onPrimary,
),
child: const Text('Créer la mutuelle'),
child: const Text('Créer l\'organisation'),
),
],
),
@@ -383,7 +395,7 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF8B5CF6),
color: ModuleColors.organisations,
),
);
}
@@ -419,8 +431,8 @@ class _CreateOrganizationDialogState extends State<CreateOrganizationDialog> {
// Afficher un message de succès
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Mutuelle créée avec succès'),
backgroundColor: Colors.green,
content: Text('Organisation créée avec succès'),
backgroundColor: ColorTokens.success,
),
);
}

View File

@@ -1,7 +1,10 @@
/// Dialogue de modification d'organisation (mutuelle)
/// Dialogue de modification d'organisation
library edit_organisation_dialog;
import 'package:flutter/material.dart';
import '../../../../shared/design_system/tokens/module_colors.dart';
import '../../../../shared/design_system/tokens/color_tokens.dart';
import '../../../../shared/design_system/tokens/app_colors.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/organizations_bloc.dart';
import '../../bloc/organizations_event.dart';
@@ -200,7 +203,7 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
return Container(
padding: const EdgeInsets.all(16),
decoration: const BoxDecoration(
color: Color(0xFF8B5CF6),
color: ModuleColors.organisations,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(4),
topRight: Radius.circular(4),
@@ -211,7 +214,7 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
const Icon(Icons.edit, color: Colors.white),
const SizedBox(width: 12),
const Text(
'Modifier la mutuelle',
'Modifier l\'organisation',
style: TextStyle(
color: Colors.white,
fontSize: 18,
@@ -234,7 +237,7 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF8B5CF6),
color: ModuleColors.organisations,
),
);
}
@@ -243,7 +246,7 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
return TextFormField(
controller: _nomController,
decoration: const InputDecoration(
labelText: 'Nom de la mutuelle *',
labelText: 'Nom de l\'organisation *',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.business),
),
@@ -263,7 +266,7 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
labelText: 'Nom court / Sigle',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.short_text),
hintText: 'Ex: MUTEC, MUPROCI',
hintText: 'Ex: LIONS, CEADP',
),
);
}
@@ -299,8 +302,13 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
child: LinearProgressIndicator(),
);
}
final scheme = Theme.of(context).colorScheme;
return DropdownButtonFormField<String>(
value: types.any((t) => t.code == _selectedTypeCode) ? _selectedTypeCode : null,
isExpanded: true,
menuMaxHeight: 220,
dropdownColor: scheme.surface,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: scheme.onSurface),
decoration: const InputDecoration(
labelText: 'Type d\'organisation *',
border: OutlineInputBorder(),
@@ -308,7 +316,11 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
),
items: types.map((type) => DropdownMenuItem<String>(
value: type.code,
child: Text(type.libelle),
child: Text(
type.libelle,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: scheme.onSurface),
),
)).toList(),
onChanged: (value) {
if (value != null) setState(() => _selectedTypeCode = value);
@@ -320,8 +332,12 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
}
Widget _buildStatutDropdown() {
final scheme = Theme.of(context).colorScheme;
return DropdownButtonFormField<StatutOrganization>(
value: _selectedStatut,
isExpanded: true,
dropdownColor: scheme.surface,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: scheme.onSurface),
decoration: const InputDecoration(
labelText: 'Statut *',
border: OutlineInputBorder(),
@@ -330,7 +346,7 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
items: StatutOrganization.values.map((statut) {
return DropdownMenuItem(
value: statut,
child: Text(statut.displayName),
child: Text(statut.displayName, style: TextStyle(color: scheme.onSurface)),
);
}).toList(),
onChanged: (value) {
@@ -475,8 +491,8 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey[100],
border: Border(top: BorderSide(color: Colors.grey[300]!)),
color: Theme.of(context).colorScheme.surfaceContainerHighest,
border: Border(top: BorderSide(color: Theme.of(context).colorScheme.outline)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -489,8 +505,8 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
ElevatedButton(
onPressed: _submitForm,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF8B5CF6),
foregroundColor: Colors.white,
backgroundColor: ModuleColors.organisations,
foregroundColor: AppColors.onPrimary,
),
child: const Text('Enregistrer'),
),
@@ -525,8 +541,8 @@ class _EditOrganizationDialogState extends State<EditOrganizationDialog> {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Mutuelle modifiée avec succès'),
backgroundColor: Colors.green,
content: Text('Organisation modifiée avec succès'),
backgroundColor: ColorTokens.success,
),
);
}

View File

@@ -4,8 +4,10 @@ library organization_card;
import 'package:flutter/material.dart';
import '../../data/models/organization_model.dart';
import '../../../../shared/design_system/tokens/module_colors.dart';
import '../../../../shared/design_system/tokens/app_colors.dart';
/// Carte d'organisation avec design cohérent
/// Carte d'organisation avec design cohérent — theme-aware (mode jour/nuit)
class OrganizationCard extends StatelessWidget {
final OrganizationModel organization;
final VoidCallback? onTap;
@@ -24,14 +26,16 @@ class OrganizationCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Container(
margin: const EdgeInsets.only(bottom: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8), // RadiusTokens cohérent
color: scheme.surface,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: scheme.outline.withOpacity(0.5)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
color: scheme.shadow.withOpacity(0.05),
blurRadius: 4,
offset: const Offset(0, 2),
),
@@ -41,15 +45,15 @@ class OrganizationCard extends StatelessWidget {
onTap: onTap,
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.all(12), // SpacingTokens cohérent
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeader(),
_buildHeader(context),
const SizedBox(height: 8),
_buildContent(),
_buildContent(context),
const SizedBox(height: 8),
_buildFooter(),
_buildFooter(context),
],
),
),
@@ -58,30 +62,29 @@ class OrganizationCard extends StatelessWidget {
}
/// Header avec nom et statut
Widget _buildHeader() {
Widget _buildHeader(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Row(
children: [
// Icône du type d'organisation
Container(
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: const Color(0xFF6C5CE7).withOpacity(0.1), // ColorTokens cohérent
color: ModuleColors.organisations.withOpacity(0.1),
borderRadius: BorderRadius.circular(6),
),
child: const Icon(Icons.business_outlined, size: 18, color: Color(0xFF6C5CE7)),
),
const SizedBox(width: 12),
// Nom et nom court
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
organization.nom,
style: const TextStyle(
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF374151), // ColorTokens cohérent
color: scheme.onSurface,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -90,16 +93,15 @@ class OrganizationCard extends StatelessWidget {
const SizedBox(height: 2),
Text(
organization.nomCourt!,
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: Color(0xFF6B7280),
color: scheme.onSurfaceVariant,
),
),
],
],
),
),
// Badge de statut
_buildStatusBadge(),
],
);
@@ -108,7 +110,6 @@ class OrganizationCard extends StatelessWidget {
/// Badge de statut
Widget _buildStatusBadge() {
final color = Color(int.parse(organization.statut.color.substring(1), radix: 16) + 0xFF000000);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
@@ -127,46 +128,31 @@ class OrganizationCard extends StatelessWidget {
}
/// Contenu principal
Widget _buildContent() {
Widget _buildContent(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Type d'organisation
Row(
children: [
const Icon(
Icons.category_outlined,
size: 14,
color: Color(0xFF6B7280),
),
Icon(Icons.category_outlined, size: 14, color: scheme.onSurfaceVariant),
const SizedBox(width: 6),
Text(
organization.typeOrganisation,
style: const TextStyle(
fontSize: 12,
color: Color(0xFF6B7280),
),
style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant),
),
],
),
const SizedBox(height: 4),
// Localisation
if (organization.ville?.isNotEmpty == true || organization.region?.isNotEmpty == true)
Row(
children: [
const Icon(
Icons.location_on_outlined,
size: 14,
color: Color(0xFF6B7280),
),
Icon(Icons.location_on_outlined, size: 14, color: scheme.onSurfaceVariant),
const SizedBox(width: 6),
Expanded(
child: Text(
_buildLocationText(),
style: const TextStyle(
fontSize: 12,
color: Color(0xFF6B7280),
),
style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -174,14 +160,10 @@ class OrganizationCard extends StatelessWidget {
],
),
const SizedBox(height: 4),
// Description si disponible
if (organization.description?.isNotEmpty == true) ...[
Text(
organization.description!,
style: const TextStyle(
fontSize: 12,
color: Color(0xFF6B7280),
),
style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
@@ -192,14 +174,14 @@ class OrganizationCard extends StatelessWidget {
}
/// Footer avec statistiques et actions
Widget _buildFooter() {
Widget _buildFooter(BuildContext context) {
return Row(
children: [
// Statistiques
Expanded(
child: Row(
children: [
_buildStatItem(
context: context,
icon: Icons.people_outline,
value: organization.nombreMembres.toString(),
label: 'membres',
@@ -207,6 +189,7 @@ class OrganizationCard extends StatelessWidget {
const SizedBox(width: 16),
if (organization.ancienneteAnnees > 0)
_buildStatItem(
context: context,
icon: Icons.access_time,
value: organization.ancienneteAnnees.toString(),
label: 'ans',
@@ -214,7 +197,6 @@ class OrganizationCard extends StatelessWidget {
],
),
),
// Actions
if (showActions) _buildActions(),
],
);
@@ -222,25 +204,23 @@ class OrganizationCard extends StatelessWidget {
/// Item de statistique
Widget _buildStatItem({
required BuildContext context,
required IconData icon,
required String value,
required String label,
}) {
final scheme = Theme.of(context).colorScheme;
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
size: 14,
color: const Color(0xFF6C5CE7),
),
Icon(icon, size: 14, color: ModuleColors.organisations),
const SizedBox(width: 4),
Text(
'$value $label',
style: const TextStyle(
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xFF374151),
color: scheme.onSurface,
),
),
],
@@ -255,31 +235,17 @@ class OrganizationCard extends StatelessWidget {
if (onEdit != null)
IconButton(
onPressed: onEdit,
icon: const Icon(
Icons.edit_outlined,
size: 18,
color: Color(0xFF6C5CE7),
),
icon: const Icon(Icons.edit_outlined, size: 18, color: Color(0xFF6C5CE7)),
padding: const EdgeInsets.all(4),
constraints: const BoxConstraints(
minWidth: 32,
minHeight: 32,
),
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
tooltip: 'Modifier',
),
if (onDelete != null)
IconButton(
onPressed: onDelete,
icon: Icon(
Icons.delete_outline,
size: 18,
color: Colors.red.shade400,
),
icon: const Icon(Icons.delete_outline, size: 18, color: AppColors.error),
padding: const EdgeInsets.all(4),
constraints: const BoxConstraints(
minWidth: 32,
minHeight: 32,
),
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
tooltip: 'Supprimer',
),
],
@@ -289,15 +255,9 @@ class OrganizationCard extends StatelessWidget {
/// Construit le texte de localisation
String _buildLocationText() {
final parts = <String>[];
if (organization.ville?.isNotEmpty == true) {
parts.add(organization.ville!);
}
if (organization.region?.isNotEmpty == true) {
parts.add(organization.region!);
}
if (organization.pays?.isNotEmpty == true) {
parts.add(organization.pays!);
}
if (organization.ville?.isNotEmpty == true) parts.add(organization.ville!);
if (organization.region?.isNotEmpty == true) parts.add(organization.region!);
if (organization.pays?.isNotEmpty == true) parts.add(organization.pays!);
return parts.join(', ');
}
}

View File

@@ -3,6 +3,8 @@
library organization_filter_widget;
import 'package:flutter/material.dart';
import '../../../../../shared/design_system/tokens/app_colors.dart';
import '../../../../../shared/design_system/tokens/color_tokens.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/organizations_bloc.dart';
import '../../bloc/organizations_event.dart';
@@ -24,11 +26,11 @@ class OrganizationFilterWidget extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(8), // RadiusTokens cohérent
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
color: AppColors.shadow,
blurRadius: 4,
offset: const Offset(0, 2),
),
@@ -50,7 +52,7 @@ class OrganizationFilterWidget extends StatelessWidget {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xFF374151),
color: Theme.of(context).colorScheme.onSurface,
),
),
const Spacer(),
@@ -119,9 +121,9 @@ class OrganizationFilterWidget extends StatelessWidget {
),
isExpanded: true,
padding: const EdgeInsets.symmetric(horizontal: 8),
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: Color(0xFF374151),
color: Theme.of(context).colorScheme.onSurface,
),
items: [
const DropdownMenuItem<StatutOrganization?>(
@@ -180,9 +182,9 @@ class OrganizationFilterWidget extends StatelessWidget {
),
isExpanded: true,
padding: const EdgeInsets.symmetric(horizontal: 8),
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: Color(0xFF374151),
color: Theme.of(context).colorScheme.onSurface,
),
items: [
const DropdownMenuItem<String?>(

View File

@@ -3,6 +3,8 @@
library organisation_search_bar;
import 'package:flutter/material.dart';
import '../../../../../shared/design_system/tokens/app_colors.dart';
import '../../../../../shared/design_system/tokens/color_tokens.dart';
/// Barre de recherche avec design cohérent
class OrganisationSearchBar extends StatefulWidget {
@@ -54,11 +56,11 @@ class _OrganisationSearchBarState extends State<OrganisationSearchBar> {
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(8), // RadiusTokens cohérent
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
color: AppColors.shadow,
blurRadius: 4,
offset: const Offset(0, 2),
),
@@ -102,9 +104,9 @@ class _OrganisationSearchBarState extends State<OrganisationSearchBar> {
vertical: 12,
),
),
style: const TextStyle(
style: TextStyle(
fontSize: 14,
color: Color(0xFF374151),
color: Theme.of(context).colorScheme.onSurface,
),
),
),

View File

@@ -3,6 +3,8 @@
library organisation_stats_widget;
import 'package:flutter/material.dart';
import '../../../../shared/design_system/tokens/app_colors.dart';
import '../../../../shared/design_system/tokens/color_tokens.dart';
/// Widget des statistiques avec design cohérent
class OrganisationStatsWidget extends StatelessWidget {
@@ -20,11 +22,11 @@ class OrganisationStatsWidget extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(8), // RadiusTokens cohérent
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
color: AppColors.shadow,
blurRadius: 4,
offset: const Offset(0, 2),
),
@@ -59,7 +61,7 @@ class OrganisationStatsWidget extends StatelessWidget {
title: 'Actives',
value: stats['actives']?.toString() ?? '0',
icon: Icons.check_circle,
color: const Color(0xFF10B981),
color: ColorTokens.successLight,
onTap: () => onStatTap?.call('actives'),
),
),