import 'package:flutter/material.dart'; /// Bulle de message /// /// Ce widget affiche un message dans une conversation /// avec les informations associƩes class MessageBubble extends StatelessWidget { final dynamic message; // TODO: Remplacer par MessageModel final bool showSenderInfo; final bool showTimestamp; final bool showStatus; final bool isAnnouncement; final double maxWidth; const MessageBubble({ super.key, required this.message, this.showSenderInfo = true, this.showTimestamp = true, this.showStatus = true, this.isAnnouncement = false, this.maxWidth = 300, }); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ if (showSenderInfo) const CircleAvatar(child: Text('S')), Expanded( child: Container( constraints: BoxConstraints(maxWidth: maxWidth), margin: const EdgeInsets.only(left: 8), padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: isAnnouncement ? Colors.orange.shade100 : Colors.blue.shade100, borderRadius: BorderRadius.circular(16), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ if (showSenderInfo) const Text( 'ExpƩditeur', style: TextStyle(fontWeight: FontWeight.bold), ), const Text('Contenu du message...'), if (showTimestamp || showStatus) Row( mainAxisAlignment: MainAxisAlignment.end, children: [ if (showTimestamp) const Text('12:34', style: TextStyle(fontSize: 12)), if (showStatus) const SizedBox(width: 4), if (showStatus) const Icon(Icons.check, size: 16), ], ), ], ), ), ), ], ), ); } }