## 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
181 lines
6.6 KiB
Dart
181 lines
6.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../../../core/constants/colors.dart';
|
|
import '../../../core/theme/theme_provider.dart';
|
|
import '../../../core/utils/app_logger.dart';
|
|
import '../../widgets/friend_suggestions.dart';
|
|
import '../../widgets/group_list.dart';
|
|
import '../../widgets/popular_activity_list.dart';
|
|
import '../../widgets/recommended_event_list.dart';
|
|
import '../../widgets/section_header.dart';
|
|
import '../../widgets/story_section.dart';
|
|
|
|
/// Écran principal du contenu d'accueil, affichant diverses sections telles que
|
|
/// les suggestions d'amis, les activités populaires, les groupes, etc.
|
|
/// Les couleurs s'adaptent dynamiquement au thème sélectionné (clair ou sombre).
|
|
class HomeContentScreen extends StatelessWidget {
|
|
const HomeContentScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Récupération du fournisseur de thème pour appliquer le mode jour/nuit
|
|
final themeProvider = Provider.of<ThemeProvider>(context);
|
|
// Obtention des dimensions de l'écran pour adapter la mise en page
|
|
final size = MediaQuery.of(context).size;
|
|
AppLogger.d('Chargement de HomeContentScreen avec le thème actuel', tag: 'HomeContentScreen');
|
|
|
|
return SingleChildScrollView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 15),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Carte de bienvenue avec couleurs dynamiques
|
|
_buildWelcomeCard(themeProvider),
|
|
const SizedBox(height: 15), // Espacement entre les sections
|
|
|
|
// Section des "Moments populaires"
|
|
_buildCard(
|
|
context: context,
|
|
themeProvider: themeProvider, // Fournit le thème
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SectionHeader(
|
|
title: 'Moments populaires',
|
|
icon: Icons.camera_alt,
|
|
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
|
),
|
|
const SizedBox(height: 10),
|
|
StorySection(size: size),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 15),
|
|
|
|
// Section des "Événements recommandés"
|
|
_buildCard(
|
|
context: context,
|
|
themeProvider: themeProvider,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SectionHeader(
|
|
title: 'Événements recommandés',
|
|
icon: Icons.star,
|
|
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
|
),
|
|
const SizedBox(height: 10),
|
|
RecommendedEventList(size: size),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 15),
|
|
|
|
// Section des "Activités populaires"
|
|
_buildCard(
|
|
context: context,
|
|
themeProvider: themeProvider,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SectionHeader(
|
|
title: 'Activités populaires',
|
|
icon: Icons.local_activity,
|
|
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
|
),
|
|
const SizedBox(height: 10),
|
|
PopularActivityList(size: size),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 15),
|
|
|
|
// Section "Groupes à rejoindre"
|
|
_buildCard(
|
|
context: context,
|
|
themeProvider: themeProvider,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SectionHeader(
|
|
title: 'Groupes à rejoindre',
|
|
icon: Icons.group_add,
|
|
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
|
),
|
|
const SizedBox(height: 10),
|
|
GroupList(size: size),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 15),
|
|
|
|
// Section des "Suggestions d'amis"
|
|
_buildCard(
|
|
context: context,
|
|
themeProvider: themeProvider,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SectionHeader(
|
|
title: 'Suggestions d\'amis',
|
|
icon: Icons.person_add,
|
|
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
|
),
|
|
const SizedBox(height: 10),
|
|
const FriendSuggestions(maxSuggestions: 5),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Crée la carte de bienvenue, en utilisant les couleurs dynamiques en fonction du thème sélectionné.
|
|
/// [themeProvider] fournit l'état actuel du thème pour adapter les couleurs.
|
|
Widget _buildWelcomeCard(ThemeProvider themeProvider) {
|
|
AppLogger.d('Création de la carte de bienvenue avec le thème actuel', tag: 'HomeContentScreen');
|
|
return Card(
|
|
elevation: 5,
|
|
color: themeProvider.isDarkMode ? AppColors.darkSurface : AppColors.lightSurface,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'Bienvenue, Dahoud!',
|
|
style: TextStyle(
|
|
color: themeProvider.isDarkMode ? AppColors.darkOnPrimary : AppColors.lightPrimary,
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
Icon(Icons.waving_hand, color: Colors.orange.shade300, size: 24),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Crée une carte générique pour afficher des sections avec un style uniforme.
|
|
/// [themeProvider] est utilisé pour ajuster les couleurs de la carte selon le mode jour/nuit.
|
|
Widget _buildCard({
|
|
required BuildContext context,
|
|
required ThemeProvider themeProvider,
|
|
required Widget child,
|
|
}) {
|
|
AppLogger.d("Création d'une carte de section avec le thème actuel", tag: 'HomeContentScreen');
|
|
return Card(
|
|
elevation: 3,
|
|
color: themeProvider.isDarkMode ? AppColors.darkSurface : AppColors.lightSurface,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: child,
|
|
),
|
|
);
|
|
}
|
|
}
|