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

@@ -0,0 +1,129 @@
import 'package:flutter/material.dart';
import '../../../core/constants/design_system.dart';
import '../animated_widgets.dart';
/// Bouton d'action tout petit et réutilisable pour les posts sociaux.
///
/// Design compact et uniforme pour les actions (like, comment, share, etc.)
class SocialActionButton extends StatelessWidget {
const SocialActionButton({
required this.icon,
required this.onTap,
this.color,
this.size = 22,
this.padding,
this.tooltip,
super.key,
});
final IconData icon;
final VoidCallback onTap;
final Color? color;
final double size;
final EdgeInsets? padding;
final String? tooltip;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final effectiveColor =
color ?? theme.colorScheme.onSurface.withOpacity(0.7);
final button = AnimatedScaleButton(
onTap: onTap,
scaleFactor: 0.85,
child: Padding(
padding: padding ??
const EdgeInsets.all(DesignSystem.spacingSm),
child: Icon(
icon,
size: size,
color: effectiveColor,
),
),
);
if (tooltip != null) {
return Tooltip(
message: tooltip!,
child: button,
);
}
return button;
}
}
/// Bouton d'action avec compteur pour les posts sociaux.
class SocialActionButtonWithCount extends StatelessWidget {
const SocialActionButtonWithCount({
required this.icon,
required this.count,
required this.onTap,
this.color,
this.activeColor,
this.isActive = false,
this.size = 22,
this.showCount = true,
super.key,
});
final IconData icon;
final int count;
final VoidCallback onTap;
final Color? color;
final Color? activeColor;
final bool isActive;
final double size;
final bool showCount;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final effectiveColor = isActive
? (activeColor ?? theme.colorScheme.primary)
: (color ?? theme.colorScheme.onSurface.withOpacity(0.7));
return AnimatedScaleButton(
onTap: onTap,
scaleFactor: 0.85,
child: Padding(
padding: const EdgeInsets.all(DesignSystem.spacingSm),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
size: size,
color: effectiveColor,
),
if (showCount && count > 0) ...[
const SizedBox(width: 4),
Text(
_formatCount(count),
style: theme.textTheme.bodySmall?.copyWith(
fontSize: 12,
fontWeight: FontWeight.w600,
color: effectiveColor,
letterSpacing: -0.2,
),
),
],
],
),
),
);
}
String _formatCount(int count) {
if (count >= 1000000) {
final value = count / 1000000;
return value % 1 == 0 ? '${value.toInt()}M' : '${value.toStringAsFixed(1)}M';
} else if (count >= 1000) {
final value = count / 1000;
return value % 1 == 0 ? '${value.toInt()}K' : '${value.toStringAsFixed(1)}K';
}
return count.toString();
}
}