## 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
76 lines
1.9 KiB
Dart
76 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:video_player/video_player.dart'; // Pour la lecture des vidéos
|
|
|
|
class StoryVideoPlayer extends StatefulWidget {
|
|
|
|
const StoryVideoPlayer({required this.mediaUrl, super.key});
|
|
final String mediaUrl;
|
|
|
|
@override
|
|
StoryVideoPlayerState createState() => StoryVideoPlayerState(); // Classe publique
|
|
}
|
|
|
|
class StoryVideoPlayerState extends State<StoryVideoPlayer> {
|
|
VideoPlayerController? _videoPlayerController;
|
|
bool _loadingError = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_initializeVideoPlayer();
|
|
}
|
|
|
|
Future<void> _initializeVideoPlayer() async {
|
|
_videoPlayerController = VideoPlayerController.networkUrl(Uri.parse(widget.mediaUrl));
|
|
|
|
try {
|
|
await _videoPlayerController!.initialize();
|
|
setState(() {
|
|
_loadingError = false;
|
|
_videoPlayerController!.play();
|
|
});
|
|
} catch (e) {
|
|
setState(() {
|
|
_loadingError = true;
|
|
});
|
|
}
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_videoPlayerController?.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (_loadingError) {
|
|
return _buildRetryUI();
|
|
} else if (_videoPlayerController != null && _videoPlayerController!.value.isInitialized) {
|
|
return VideoPlayer(_videoPlayerController!);
|
|
} else {
|
|
return const Center(child: CircularProgressIndicator());
|
|
}
|
|
}
|
|
|
|
Widget _buildRetryUI() {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Text('Problème de connexion ou de chargement', style: TextStyle(color: Colors.white)),
|
|
const SizedBox(height: 20),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
setState(() {
|
|
_initializeVideoPlayer();
|
|
});
|
|
},
|
|
child: const Text('Réessayer'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|