Files
afterwork/lib/presentation/widgets/section_header.dart
dahoud 92612abbd7 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
2026-01-10 10:43:17 +00:00

97 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
/// En-tête de section avec icône et support du thème.
///
/// Ce widget fournit un en-tête cohérent pour les sections de l'application,
/// utilisant automatiquement les couleurs du thème actif.
///
/// **Usage:**
/// ```dart
/// SectionHeader(
/// title: 'Événements',
/// icon: Icons.event,
/// )
/// ```
class SectionHeader extends StatelessWidget {
/// Crée un nouveau [SectionHeader].
///
/// [title] Le titre de la section
/// [icon] L'icône à afficher
/// [textStyle] Style de texte personnalisé (optionnel)
/// [iconColor] Couleur de l'icône (optionnel)
/// [onTap] Fonction à exécuter lors du clic (optionnel)
/// [trailing] Widget optionnel à afficher à droite
const SectionHeader({
required this.title,
required this.icon,
super.key,
this.textStyle,
this.iconColor,
this.onTap,
this.trailing,
});
/// Le titre de la section
final String title;
/// L'icône à afficher
final IconData icon;
/// Style de texte personnalisé (optionnel)
final TextStyle? textStyle;
/// Couleur de l'icône (optionnel)
final Color? iconColor;
/// Fonction à exécuter lors du clic (optionnel)
final VoidCallback? onTap;
/// Widget optionnel à afficher à droite
final Widget? trailing;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final defaultTextStyle = theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.onSurface,
);
Widget headerContent = Row(
children: [
Icon(
icon,
color: iconColor ?? theme.colorScheme.primary,
size: 24,
),
const SizedBox(width: 12),
Expanded(
child: Text(
title,
style: textStyle ?? defaultTextStyle,
),
),
if (trailing != null) trailing!,
],
);
if (onTap != null) {
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 4),
child: headerContent,
),
);
}
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 4),
child: headerContent,
);
}
}