Files
afterwork/lib/presentation/widgets/custom_list_tile.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

106 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
/// Widget de liste personnalisé avec support du thème et animations.
///
/// Ce widget fournit un élément de liste cohérent avec le design system,
/// utilisant automatiquement les couleurs du thème actif.
///
/// **Usage:**
/// ```dart
/// CustomListTile(
/// icon: Icons.settings,
/// label: 'Paramètres',
/// onTap: () {
/// // Action
/// },
/// )
/// ```
class CustomListTile extends StatelessWidget {
/// Crée un nouveau [CustomListTile].
///
/// [icon] L'icône à afficher à gauche
/// [label] Le texte à afficher
/// [onTap] La fonction à exécuter lors du clic
/// [trailing] Un widget optionnel à afficher à droite
/// [subtitle] Un sous-titre optionnel
/// [iconColor] Couleur personnalisée pour l'icône (optionnel)
const CustomListTile({
required this.icon,
required this.label,
required this.onTap,
super.key,
this.trailing,
this.subtitle,
this.iconColor,
});
/// L'icône à afficher à gauche
final IconData icon;
/// Le texte à afficher
final String label;
/// La fonction à exécuter lors du clic
final VoidCallback? onTap;
/// Un widget optionnel à afficher à droite
final Widget? trailing;
/// Un sous-titre optionnel
final String? subtitle;
/// Couleur personnalisée pour l'icône (optionnel)
final Color? iconColor;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isEnabled = onTap != null;
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(12),
child: ListTile(
leading: CircleAvatar(
backgroundColor: (iconColor ?? theme.colorScheme.primary)
.withOpacity(0.1),
child: Icon(
icon,
color: iconColor ?? theme.colorScheme.primary,
size: 20,
),
),
title: Text(
label,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
color: isEnabled
? theme.colorScheme.onSurface
: theme.colorScheme.onSurface.withOpacity(0.38),
),
),
subtitle: subtitle != null
? Text(
subtitle!,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurface.withOpacity(0.6),
),
)
: null,
trailing: trailing ??
(isEnabled
? Icon(
Icons.chevron_right,
color: theme.colorScheme.onSurface.withOpacity(0.5),
)
: null),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
),
);
}
}