import 'package:flutter/material.dart'; import '../../core/constants/design_system.dart'; import '../../core/utils/date_formatter.dart'; /// Widget pour afficher un séparateur de date entre groupes de messages. /// /// Ce widget affiche une date formatée de manière intelligente /// (ex: "Aujourd'hui", "Hier", "Lundi", "12 janvier") pour séparer /// visuellement les groupes de messages par jour. class DateSeparator extends StatelessWidget { const DateSeparator({ required this.date, super.key, }); final DateTime date; @override Widget build(BuildContext context) { final theme = Theme.of(context); return Center( child: Container( margin: const EdgeInsets.symmetric(vertical: DesignSystem.spacingMd), padding: const EdgeInsets.symmetric( horizontal: DesignSystem.spacingLg, vertical: DesignSystem.spacingSm, ), decoration: BoxDecoration( color: theme.colorScheme.surfaceVariant.withOpacity(0.5), borderRadius: BorderRadius.circular(DesignSystem.radiusLg), ), child: Text( ChatDateFormatter.formatDateSeparator(date), style: theme.textTheme.bodySmall?.copyWith( fontSize: 12, color: theme.colorScheme.onSurfaceVariant, fontWeight: FontWeight.w500, ), ), ), ); } }