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:
@@ -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(', ');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user