## 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
109 lines
3.5 KiB
Dart
109 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/utils/calculate_time_ago.dart';
|
|
import 'animated_action_button.dart';
|
|
import 'story_video_player.dart';
|
|
|
|
class StoryDetail extends StatefulWidget {
|
|
|
|
const StoryDetail({
|
|
required this.username, required this.publicationDate, required this.mediaUrl, required this.userImage, required this.isVideo, super.key,
|
|
});
|
|
final String username;
|
|
final DateTime publicationDate;
|
|
final String mediaUrl;
|
|
final String userImage;
|
|
final bool isVideo;
|
|
|
|
@override
|
|
StoryDetailState createState() => StoryDetailState();
|
|
}
|
|
|
|
class StoryDetailState extends State<StoryDetail> {
|
|
late Offset _startDragOffset;
|
|
late Offset _currentDragOffset;
|
|
bool _isDragging = false;
|
|
|
|
// Gestion du swipe vertical pour fermer la story
|
|
void _onVerticalDragStart(DragStartDetails details) {
|
|
_startDragOffset = details.globalPosition;
|
|
}
|
|
|
|
void _onVerticalDragUpdate(DragUpdateDetails details) {
|
|
_currentDragOffset = details.globalPosition;
|
|
if (_currentDragOffset.dy - _startDragOffset.dy > 100) {
|
|
setState(() {
|
|
_isDragging = true;
|
|
});
|
|
Navigator.pop(context);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.black,
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0,
|
|
iconTheme: const IconThemeData(color: Colors.white),
|
|
),
|
|
body: GestureDetector(
|
|
onVerticalDragStart: _onVerticalDragStart,
|
|
onVerticalDragUpdate: _onVerticalDragUpdate,
|
|
child: Stack(
|
|
children: [
|
|
Positioned.fill(
|
|
child: AnimatedOpacity(
|
|
opacity: _isDragging ? 0.5 : 1.0,
|
|
duration: const Duration(milliseconds: 300),
|
|
child: widget.isVideo
|
|
? StoryVideoPlayer(mediaUrl: widget.mediaUrl)
|
|
: Image.asset(widget.mediaUrl, fit: BoxFit.cover),
|
|
),
|
|
),
|
|
// Informations sur l'utilisateur
|
|
Positioned(
|
|
top: 40,
|
|
left: 20,
|
|
child: Row(
|
|
children: [
|
|
CircleAvatar(radius: 32, backgroundImage: AssetImage(widget.userImage)),
|
|
const SizedBox(width: 12),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
widget.username,
|
|
style: const TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold),
|
|
),
|
|
Text(
|
|
'Il y a ${calculateTimeAgo(widget.publicationDate)}',
|
|
style: const TextStyle(color: Colors.white70, fontSize: 14),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// Boutons d'actions flottants à droite
|
|
const Positioned(
|
|
right: 20,
|
|
bottom: 100,
|
|
child: Column(
|
|
children: [
|
|
AnimatedActionButton(icon: Icons.favorite_border, label: 'J\'aime'),
|
|
SizedBox(height: 20),
|
|
AnimatedActionButton(icon: Icons.comment, label: 'Commenter'),
|
|
SizedBox(height: 20),
|
|
AnimatedActionButton(icon: Icons.share, label: 'Partager'),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|