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

@@ -21,94 +21,146 @@ class FriendRequestCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final displayName = isSentRequest
? (request.friendFullName.isNotEmpty
? request.friendFullName
: 'Utilisateur inconnu')
: (request.userFullName.isNotEmpty
? request.userFullName
: 'Utilisateur inconnu');
final initial = displayName.isNotEmpty ? displayName[0].toUpperCase() : '?';
return Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Padding(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(12),
child: Row(
children: [
// Avatar
CircleAvatar(
radius: 28,
radius: 24,
backgroundColor: theme.colorScheme.primaryContainer,
child: Text(
(isSentRequest ? request.friendFullName : request.userFullName).isNotEmpty
? (isSentRequest ? request.friendFullName : request.userFullName)[0].toUpperCase()
: '?',
initial,
style: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontSize: 20,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(width: 16),
const SizedBox(width: 12),
// Informations
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
isSentRequest
? (request.friendFullName.isNotEmpty
? request.friendFullName
: 'Utilisateur inconnu')
: (request.userFullName.isNotEmpty
? request.userFullName
: 'Utilisateur inconnu'),
displayName,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w600,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 4),
const SizedBox(height: 2),
Text(
isSentRequest
? 'Demande envoyée'
: 'Demande d\'amitié',
isSentRequest ? 'Demande envoyée' : 'Demande d\'amitié',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurface.withOpacity(0.6),
fontSize: 12,
),
),
],
),
),
// Boutons d'action
if (isSentRequest)
// Pour les demandes envoyées : seulement bouton Annuler
IconButton(
icon: const Icon(Icons.close),
color: Colors.orange,
onPressed: onReject,
tooltip: 'Annuler la demande',
)
_buildCancelButton(theme)
else
// Pour les demandes reçues : Accepter et Rejeter
Row(
mainAxisSize: MainAxisSize.min,
children: [
// Bouton Accepter
IconButton(
icon: const Icon(Icons.check_circle),
color: Colors.green,
onPressed: onAccept,
tooltip: 'Accepter',
),
// Bouton Rejeter
IconButton(
icon: const Icon(Icons.cancel),
color: Colors.red,
onPressed: onReject,
tooltip: 'Rejeter',
),
],
),
_buildActionButtons(theme),
],
),
),
);
}
/// Construit le bouton d'annulation pour les demandes envoyées.
Widget _buildCancelButton(ThemeData theme) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: onReject,
borderRadius: BorderRadius.circular(20),
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.orange.withOpacity(0.1),
borderRadius: BorderRadius.circular(20),
),
child: const Icon(
Icons.close,
color: Colors.orange,
size: 20,
),
),
),
);
}
/// Construit les boutons d'action pour les demandes reçues.
Widget _buildActionButtons(ThemeData theme) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
// Bouton Accepter
Material(
color: Colors.transparent,
child: InkWell(
onTap: onAccept,
borderRadius: BorderRadius.circular(20),
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.green.withOpacity(0.1),
borderRadius: BorderRadius.circular(20),
),
child: const Icon(
Icons.check_circle,
color: Colors.green,
size: 20,
),
),
),
),
const SizedBox(width: 8),
// Bouton Rejeter
Material(
color: Colors.transparent,
child: InkWell(
onTap: onReject,
borderRadius: BorderRadius.circular(20),
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.red.withOpacity(0.1),
borderRadius: BorderRadius.circular(20),
),
child: const Icon(
Icons.cancel,
color: Colors.red,
size: 20,
),
),
),
),
],
);
}
}