fix(chat): Correction race condition + Implémentation TODOs

## Corrections Critiques

### Race Condition - Statuts de Messages
- Fix : Les icônes de statut (✓, ✓✓, ✓✓ bleu) ne s'affichaient pas
- Cause : WebSocket delivery confirmations arrivaient avant messages locaux
- Solution : Pattern Optimistic UI dans chat_bloc.dart
  - Création message temporaire immédiate
  - Ajout à la liste AVANT requête HTTP
  - Remplacement par message serveur à la réponse
- Fichier : lib/presentation/state_management/chat_bloc.dart

## Implémentation TODOs (13/21)

### Social (social_header_widget.dart)
-  Copier lien du post dans presse-papiers
-  Partage natif via Share.share()
-  Dialogue de signalement avec 5 raisons

### Partage (share_post_dialog.dart)
-  Interface sélection d'amis avec checkboxes
-  Partage externe via Share API

### Média (media_upload_service.dart)
-  Parsing JSON réponse backend
-  Méthode deleteMedia() pour suppression
-  Génération miniature vidéo

### Posts (create_post_dialog.dart, edit_post_dialog.dart)
-  Extraction URL depuis uploads
-  Documentation chargement médias

### Chat (conversations_screen.dart)
-  Navigation vers notifications
-  ConversationSearchDelegate pour recherche

## Nouveaux Fichiers

### Configuration
- build-prod.ps1 : Script build production avec dart-define
- lib/core/constants/env_config.dart : Gestion environnements

### Documentation
- TODOS_IMPLEMENTED.md : Documentation complète TODOs

## Améliorations

### Architecture
- Refactoring injection de dépendances
- Amélioration routing et navigation
- Optimisation providers (UserProvider, FriendsProvider)

### UI/UX
- Amélioration thème et couleurs
- Optimisation animations
- Meilleure gestion erreurs

### Services
- Configuration API avec env_config
- Amélioration datasources (events, users)
- Optimisation modèles de données
This commit is contained in:
dahoud
2026-01-10 10:43:17 +00:00
parent 06031b01f2
commit 92612abbd7
321 changed files with 43137 additions and 4285 deletions

View File

@@ -1,38 +1,80 @@
import 'package:flutter/material.dart';
/// Badge de statut d'événement avec design moderne et compact.
///
/// Ce widget affiche le statut d'un événement (ouvert, fermé, annulé)
/// avec une couleur et une icône appropriées.
///
/// **Usage:**
/// ```dart
/// EventStatusBadge(status: 'ouvert')
/// EventStatusBadge(status: 'fermé')
/// ```
class EventStatusBadge extends StatelessWidget {
const EventStatusBadge({
required this.status,
super.key,
});
/// Le statut de l'événement ('ouvert', 'fermé', 'annulé')
final String status;
const EventStatusBadge({Key? key, required this.status}) : super(key: key);
/// Retourne les propriétés du statut.
_StatusProperties get _properties {
final lowerStatus = status.toLowerCase();
switch (lowerStatus) {
case 'fermé':
return _StatusProperties(
color: Colors.red,
icon: Icons.lock,
label: 'Fermé',
);
case 'annulé':
return _StatusProperties(
color: Colors.orange,
icon: Icons.cancel,
label: 'Annulé',
);
case 'ouvert':
default:
return _StatusProperties(
color: Colors.green,
icon: Icons.lock_open,
label: 'Ouvert',
);
}
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final props = _properties;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: status == 'fermé' ? Colors.red.withOpacity(0.2) : Colors.green.withOpacity(0.2),
borderRadius: BorderRadius.circular(12.0),
color: props.color.withOpacity(0.15),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: status == 'fermé' ? Colors.red : Colors.green,
width: 1.0,
color: props.color.withOpacity(0.5),
width: 1,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
status == 'fermé' ? Icons.lock : Icons.lock_open,
color: status == 'fermé' ? Colors.red : Colors.green,
size: 10.0,
props.icon,
color: props.color,
size: 12,
),
const SizedBox(width: 5),
const SizedBox(width: 4),
Text(
status == 'fermé' ? 'Fermé' : 'Ouvert',
style: TextStyle(
color: status == 'fermé' ? Colors.red : Colors.green,
fontSize: 10,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
props.label,
style: theme.textTheme.bodySmall?.copyWith(
color: props.color,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
],
@@ -40,3 +82,16 @@ class EventStatusBadge extends StatelessWidget {
);
}
}
/// Propriétés d'un statut d'événement.
class _StatusProperties {
const _StatusProperties({
required this.color,
required this.icon,
required this.label,
});
final Color color;
final IconData icon;
final String label;
}