Refactoring

This commit is contained in:
DahoudG
2025-09-17 17:54:06 +00:00
parent 12d514d866
commit 63fe107f98
165 changed files with 54220 additions and 276 deletions

View File

@@ -0,0 +1,430 @@
import 'package:flutter/material.dart';
import '../../../../core/widgets/unified_card.dart';
import '../../../../core/theme/app_colors.dart';
import '../../../../core/theme/app_text_styles.dart';
import '../../../../core/utils/date_formatter.dart';
import '../../domain/entities/notification.dart';
/// Widget de carte pour afficher une notification
class NotificationCardWidget extends StatelessWidget {
final NotificationEntity notification;
final VoidCallback? onTap;
final VoidCallback? onMarkAsRead;
final VoidCallback? onMarkAsImportant;
final VoidCallback? onArchive;
final VoidCallback? onDelete;
final Function(ActionNotification)? onActionTap;
const NotificationCardWidget({
super.key,
required this.notification,
this.onTap,
this.onMarkAsRead,
this.onMarkAsImportant,
this.onArchive,
this.onDelete,
this.onActionTap,
});
@override
Widget build(BuildContext context) {
final isUnread = !notification.estLue;
final isImportant = notification.estImportante;
final isExpired = notification.isExpiree;
return UnifiedCard(
variant: isUnread ? UnifiedCardVariant.elevated : UnifiedCardVariant.outlined,
onTap: onTap,
child: Container(
decoration: BoxDecoration(
border: isUnread
? Border.left(
color: _getTypeColor(),
width: 4,
)
: null,
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// En-tête avec icône, titre et actions
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Icône du type de notification
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: _getTypeColor().withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(
_getTypeIcon(),
color: _getTypeColor(),
size: 20,
),
),
const SizedBox(width: 12),
// Titre et métadonnées
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
notification.titre,
style: AppTextStyles.titleSmall.copyWith(
fontWeight: isUnread ? FontWeight.w600 : FontWeight.w500,
color: isExpired
? AppColors.onSurface.withOpacity(0.6)
: AppColors.onSurface,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
// Badges de statut
if (isImportant) ...[
const SizedBox(width: 8),
Icon(
Icons.star,
color: AppColors.warning,
size: 16,
),
],
if (isUnread) ...[
const SizedBox(width: 8),
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: AppColors.primary,
shape: BoxShape.circle,
),
),
],
],
),
const SizedBox(height: 4),
// Métadonnées (expéditeur, date)
Row(
children: [
if (notification.expediteurNom != null) ...[
Text(
notification.expediteurNom!,
style: AppTextStyles.bodySmall.copyWith(
color: AppColors.onSurface.withOpacity(0.7),
fontWeight: FontWeight.w500,
),
),
Text(
'',
style: AppTextStyles.bodySmall.copyWith(
color: AppColors.onSurface.withOpacity(0.5),
),
),
],
Text(
notification.tempsEcoule,
style: AppTextStyles.bodySmall.copyWith(
color: AppColors.onSurface.withOpacity(0.7),
),
),
if (isExpired) ...[
Text(
' • Expirée',
style: AppTextStyles.bodySmall.copyWith(
color: AppColors.error,
fontWeight: FontWeight.w500,
),
),
],
],
),
],
),
),
// Menu d'actions
PopupMenuButton<String>(
icon: Icon(
Icons.more_vert,
color: AppColors.onSurface.withOpacity(0.6),
size: 20,
),
onSelected: (value) => _handleMenuAction(value),
itemBuilder: (context) => [
if (!notification.estLue)
const PopupMenuItem(
value: 'mark_read',
child: ListTile(
leading: Icon(Icons.mark_email_read, size: 20),
title: Text('Marquer comme lu'),
contentPadding: EdgeInsets.zero,
),
),
PopupMenuItem(
value: 'mark_important',
child: ListTile(
leading: Icon(
notification.estImportante ? Icons.star : Icons.star_border,
size: 20,
),
title: Text(
notification.estImportante
? 'Retirer des importantes'
: 'Marquer comme importante',
),
contentPadding: EdgeInsets.zero,
),
),
if (!notification.estArchivee)
const PopupMenuItem(
value: 'archive',
child: ListTile(
leading: Icon(Icons.archive, size: 20),
title: Text('Archiver'),
contentPadding: EdgeInsets.zero,
),
),
const PopupMenuDivider(),
const PopupMenuItem(
value: 'delete',
child: ListTile(
leading: Icon(Icons.delete, size: 20, color: Colors.red),
title: Text('Supprimer', style: TextStyle(color: Colors.red)),
contentPadding: EdgeInsets.zero,
),
),
],
),
],
),
const SizedBox(height: 12),
// Message de la notification
Text(
notification.messageAffichage,
style: AppTextStyles.bodyMedium.copyWith(
color: isExpired
? AppColors.onSurface.withOpacity(0.6)
: AppColors.onSurface.withOpacity(0.8),
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
// Image de la notification (si présente)
if (notification.imageUrl != null) ...[
const SizedBox(height: 12),
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.network(
notification.imageUrl!,
height: 120,
width: double.infinity,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container(
height: 120,
decoration: BoxDecoration(
color: AppColors.surface,
borderRadius: BorderRadius.circular(8),
),
child: Icon(
Icons.image_not_supported,
color: AppColors.onSurface.withOpacity(0.5),
),
),
),
),
],
// Actions rapides
if (notification.hasActionsRapides) ...[
const SizedBox(height: 16),
Wrap(
spacing: 8,
runSpacing: 8,
children: notification.actionsRapidesActives
.take(3) // Limite à 3 actions pour éviter l'encombrement
.map((action) => _buildActionButton(action))
.toList(),
),
],
// Tags (si présents)
if (notification.tags != null && notification.tags!.isNotEmpty) ...[
const SizedBox(height: 12),
Wrap(
spacing: 6,
runSpacing: 6,
children: notification.tags!
.take(3) // Limite à 3 tags
.map((tag) => Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: AppColors.surfaceVariant,
borderRadius: BorderRadius.circular(12),
),
child: Text(
tag,
style: AppTextStyles.labelSmall.copyWith(
color: AppColors.onSurfaceVariant,
),
),
))
.toList(),
),
],
],
),
),
),
);
}
Widget _buildActionButton(ActionNotification action) {
return OutlinedButton.icon(
onPressed: () => onActionTap?.call(action),
icon: Icon(
_getActionIcon(action.icone),
size: 16,
),
label: Text(
action.libelle,
style: AppTextStyles.labelMedium,
),
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
foregroundColor: action.couleur != null
? Color(int.parse(action.couleur!.replaceFirst('#', '0xFF')))
: AppColors.primary,
side: BorderSide(
color: action.couleur != null
? Color(int.parse(action.couleur!.replaceFirst('#', '0xFF')))
: AppColors.primary,
),
),
);
}
Color _getTypeColor() {
try {
return Color(int.parse(notification.couleurType.replaceFirst('#', '0xFF')));
} catch (e) {
return AppColors.primary;
}
}
IconData _getTypeIcon() {
switch (notification.typeNotification.icone) {
case 'event':
return Icons.event;
case 'payment':
return Icons.payment;
case 'help':
return Icons.help;
case 'person_add':
return Icons.person_add;
case 'cake':
return Icons.cake;
case 'campaign':
return Icons.campaign;
case 'mail':
return Icons.mail;
case 'system_update':
return Icons.system_update;
case 'build':
return Icons.build;
case 'schedule':
return Icons.schedule;
case 'event_busy':
return Icons.event_busy;
case 'check_circle':
return Icons.check_circle;
case 'paid':
return Icons.paid;
case 'error':
return Icons.error;
case 'thumb_up':
return Icons.thumb_up;
case 'volunteer_activism':
return Icons.volunteer_activism;
case 'groups':
return Icons.groups;
case 'alternate_email':
return Icons.alternate_email;
default:
return Icons.notifications;
}
}
IconData _getActionIcon(String? iconeName) {
if (iconeName == null) return Icons.touch_app;
switch (iconeName) {
case 'visibility':
return Icons.visibility;
case 'event_available':
return Icons.event_available;
case 'directions':
return Icons.directions;
case 'payment':
return Icons.payment;
case 'schedule':
return Icons.schedule;
case 'receipt':
return Icons.receipt;
case 'person':
return Icons.person;
case 'message':
return Icons.message;
case 'phone':
return Icons.phone;
case 'reply':
return Icons.reply;
default:
return Icons.touch_app;
}
}
void _handleMenuAction(String action) {
switch (action) {
case 'mark_read':
onMarkAsRead?.call();
break;
case 'mark_important':
onMarkAsImportant?.call();
break;
case 'archive':
onArchive?.call();
break;
case 'delete':
onDelete?.call();
break;
}
}
}

View File

@@ -0,0 +1,389 @@
import 'package:flutter/material.dart';
import '../../../../core/widgets/unified_card.dart';
import '../../../../core/theme/app_colors.dart';
import '../../../../core/theme/app_text_styles.dart';
import '../../domain/entities/notification.dart';
/// Widget de recherche et filtrage des notifications
class NotificationSearchWidget extends StatefulWidget {
final Function(String) onSearchChanged;
final Function({
Set<TypeNotification>? types,
Set<StatutNotification>? statuts,
}) onFiltersChanged;
final Set<TypeNotification> selectedTypes;
final Set<StatutNotification> selectedStatuts;
const NotificationSearchWidget({
super.key,
required this.onSearchChanged,
required this.onFiltersChanged,
required this.selectedTypes,
required this.selectedStatuts,
});
@override
State<NotificationSearchWidget> createState() => _NotificationSearchWidgetState();
}
class _NotificationSearchWidgetState extends State<NotificationSearchWidget> {
final TextEditingController _searchController = TextEditingController();
bool _showFilters = false;
@override
void dispose() {
_searchController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return UnifiedCard(
variant: UnifiedCardVariant.outlined,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Barre de recherche
Row(
children: [
Expanded(
child: TextField(
controller: _searchController,
decoration: InputDecoration(
hintText: 'Rechercher dans les notifications...',
hintStyle: AppTextStyles.bodyMedium.copyWith(
color: AppColors.onSurface.withOpacity(0.6),
),
prefixIcon: Icon(
Icons.search,
color: AppColors.onSurface.withOpacity(0.6),
),
suffixIcon: _searchController.text.isNotEmpty
? IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
_searchController.clear();
widget.onSearchChanged('');
},
)
: null,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppColors.outline.withOpacity(0.3),
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppColors.outline.withOpacity(0.3),
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppColors.primary,
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
onChanged: widget.onSearchChanged,
),
),
const SizedBox(width: 12),
// Bouton de filtres
IconButton(
onPressed: () {
setState(() {
_showFilters = !_showFilters;
});
},
icon: Icon(
Icons.filter_list,
color: _hasActiveFilters()
? AppColors.primary
: AppColors.onSurface.withOpacity(0.6),
),
style: IconButton.styleFrom(
backgroundColor: _hasActiveFilters()
? AppColors.primary.withOpacity(0.1)
: AppColors.surface,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: _hasActiveFilters()
? AppColors.primary
: AppColors.outline.withOpacity(0.3),
),
),
),
),
],
),
// Panneau de filtres (conditionnel)
if (_showFilters) ...[
const SizedBox(height: 16),
_buildFiltersPanel(),
],
],
),
),
);
}
Widget _buildFiltersPanel() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// En-tête des filtres
Row(
children: [
Text(
'Filtres',
style: AppTextStyles.titleSmall.copyWith(
fontWeight: FontWeight.w600,
),
),
const Spacer(),
if (_hasActiveFilters())
TextButton(
onPressed: _clearAllFilters,
child: Text(
'Tout effacer',
style: AppTextStyles.labelMedium.copyWith(
color: AppColors.primary,
),
),
),
],
),
const SizedBox(height: 12),
// Filtres par type
Text(
'Types de notification',
style: AppTextStyles.labelLarge.copyWith(
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
Wrap(
spacing: 8,
runSpacing: 8,
children: _getPopularTypes()
.map((type) => _buildTypeChip(type))
.toList(),
),
const SizedBox(height: 16),
// Filtres par statut
Text(
'Statuts',
style: AppTextStyles.labelLarge.copyWith(
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
Wrap(
spacing: 8,
runSpacing: 8,
children: _getPopularStatuts()
.map((statut) => _buildStatutChip(statut))
.toList(),
),
const SizedBox(height: 16),
// Boutons d'action
Row(
children: [
Expanded(
child: OutlinedButton(
onPressed: () {
setState(() {
_showFilters = false;
});
},
child: const Text('Fermer'),
),
),
const SizedBox(width: 12),
Expanded(
child: ElevatedButton(
onPressed: () {
setState(() {
_showFilters = false;
});
// Les filtres sont déjà appliqués en temps réel
},
child: const Text('Appliquer'),
),
),
],
),
],
);
}
Widget _buildTypeChip(TypeNotification type) {
final isSelected = widget.selectedTypes.contains(type);
return FilterChip(
label: Text(
type.libelle,
style: AppTextStyles.labelMedium.copyWith(
color: isSelected ? AppColors.onPrimary : AppColors.onSurface,
),
),
selected: isSelected,
onSelected: (selected) {
final newTypes = Set<TypeNotification>.from(widget.selectedTypes);
if (selected) {
newTypes.add(type);
} else {
newTypes.remove(type);
}
widget.onFiltersChanged(types: newTypes);
},
selectedColor: AppColors.primary,
backgroundColor: AppColors.surface,
side: BorderSide(
color: isSelected
? AppColors.primary
: AppColors.outline.withOpacity(0.3),
),
avatar: isSelected
? null
: Icon(
_getTypeIcon(type),
size: 16,
color: _getTypeColor(type),
),
);
}
Widget _buildStatutChip(StatutNotification statut) {
final isSelected = widget.selectedStatuts.contains(statut);
return FilterChip(
label: Text(
statut.libelle,
style: AppTextStyles.labelMedium.copyWith(
color: isSelected ? AppColors.onPrimary : AppColors.onSurface,
),
),
selected: isSelected,
onSelected: (selected) {
final newStatuts = Set<StatutNotification>.from(widget.selectedStatuts);
if (selected) {
newStatuts.add(statut);
} else {
newStatuts.remove(statut);
}
widget.onFiltersChanged(statuts: newStatuts);
},
selectedColor: AppColors.primary,
backgroundColor: AppColors.surface,
side: BorderSide(
color: isSelected
? AppColors.primary
: AppColors.outline.withOpacity(0.3),
),
avatar: isSelected
? null
: Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: _getStatutColor(statut),
shape: BoxShape.circle,
),
),
);
}
List<TypeNotification> _getPopularTypes() {
return [
TypeNotification.nouvelEvenement,
TypeNotification.cotisationDue,
TypeNotification.nouvelleDemandeAide,
TypeNotification.nouveauMembre,
TypeNotification.annonceGenerale,
TypeNotification.messagePrive,
];
}
List<StatutNotification> _getPopularStatuts() {
return [
StatutNotification.nonLue,
StatutNotification.lue,
StatutNotification.marqueeImportante,
StatutNotification.archivee,
];
}
IconData _getTypeIcon(TypeNotification type) {
switch (type.icone) {
case 'event':
return Icons.event;
case 'payment':
return Icons.payment;
case 'help':
return Icons.help;
case 'person_add':
return Icons.person_add;
case 'campaign':
return Icons.campaign;
case 'mail':
return Icons.mail;
default:
return Icons.notifications;
}
}
Color _getTypeColor(TypeNotification type) {
try {
return Color(int.parse(type.couleur.replaceFirst('#', '0xFF')));
} catch (e) {
return AppColors.primary;
}
}
Color _getStatutColor(StatutNotification statut) {
try {
return Color(int.parse(statut.couleur.replaceFirst('#', '0xFF')));
} catch (e) {
return AppColors.primary;
}
}
bool _hasActiveFilters() {
return widget.selectedTypes.isNotEmpty || widget.selectedStatuts.isNotEmpty;
}
void _clearAllFilters() {
widget.onFiltersChanged(
types: <TypeNotification>{},
statuts: <StatutNotification>{},
);
}
}

View File

@@ -0,0 +1,400 @@
import 'package:flutter/material.dart';
import '../../../../core/widgets/unified_card.dart';
import '../../../../core/theme/app_colors.dart';
import '../../../../core/theme/app_text_styles.dart';
/// Widget d'affichage des statistiques de notifications
class NotificationStatsWidget extends StatelessWidget {
final int totalCount;
final int unreadCount;
final int importantCount;
const NotificationStatsWidget({
super.key,
required this.totalCount,
required this.unreadCount,
required this.importantCount,
});
@override
Widget build(BuildContext context) {
return UnifiedCard(
variant: UnifiedCardVariant.filled,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
// Statistique principale - Non lues
Expanded(
child: _buildStatItem(
icon: Icons.mark_email_unread,
label: 'Non lues',
value: unreadCount.toString(),
color: unreadCount > 0 ? AppColors.primary : AppColors.onSurface.withOpacity(0.6),
isHighlighted: unreadCount > 0,
),
),
// Séparateur
Container(
width: 1,
height: 40,
color: AppColors.outline.withOpacity(0.2),
),
// Statistique secondaire - Importantes
Expanded(
child: _buildStatItem(
icon: Icons.star,
label: 'Importantes',
value: importantCount.toString(),
color: importantCount > 0 ? AppColors.warning : AppColors.onSurface.withOpacity(0.6),
isHighlighted: importantCount > 0,
),
),
// Séparateur
Container(
width: 1,
height: 40,
color: AppColors.outline.withOpacity(0.2),
),
// Statistique tertiaire - Total
Expanded(
child: _buildStatItem(
icon: Icons.notifications,
label: 'Total',
value: totalCount.toString(),
color: AppColors.onSurface.withOpacity(0.8),
isHighlighted: false,
),
),
],
),
),
);
}
Widget _buildStatItem({
required IconData icon,
required String label,
required String value,
required Color color,
required bool isHighlighted,
}) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
// Icône avec badge si mis en évidence
Stack(
clipBehavior: Clip.none,
children: [
Container(
width: 32,
height: 32,
decoration: BoxDecoration(
color: color.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(
icon,
color: color,
size: 18,
),
),
if (isHighlighted && value != '0')
Positioned(
right: -4,
top: -4,
child: Container(
width: 12,
height: 12,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
border: Border.all(
color: AppColors.surface,
width: 2,
),
),
),
),
],
),
const SizedBox(height: 8),
// Valeur
Text(
value,
style: AppTextStyles.titleMedium.copyWith(
color: color,
fontWeight: isHighlighted ? FontWeight.w700 : FontWeight.w600,
),
),
const SizedBox(height: 2),
// Label
Text(
label,
style: AppTextStyles.labelSmall.copyWith(
color: AppColors.onSurface.withOpacity(0.7),
),
textAlign: TextAlign.center,
),
],
);
}
}
/// Widget d'affichage des statistiques détaillées
class DetailedNotificationStatsWidget extends StatelessWidget {
final Map<String, dynamic> stats;
const DetailedNotificationStatsWidget({
super.key,
required this.stats,
});
@override
Widget build(BuildContext context) {
final totalNotifications = stats['total'] ?? 0;
final unreadNotifications = stats['unread'] ?? 0;
final importantNotifications = stats['important'] ?? 0;
final archivedNotifications = stats['archived'] ?? 0;
final todayNotifications = stats['today'] ?? 0;
final weekNotifications = stats['week'] ?? 0;
final engagementRate = stats['engagement_rate'] ?? 0.0;
return UnifiedCard(
variant: UnifiedCardVariant.outlined,
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// En-tête
Row(
children: [
Icon(
Icons.analytics,
color: AppColors.primary,
size: 24,
),
const SizedBox(width: 12),
Text(
'Statistiques détaillées',
style: AppTextStyles.titleMedium.copyWith(
fontWeight: FontWeight.w600,
),
),
],
),
const SizedBox(height: 20),
// Grille de statistiques
GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
childAspectRatio: 2.5,
mainAxisSpacing: 16,
crossAxisSpacing: 16,
children: [
_buildDetailedStatCard(
'Total',
totalNotifications.toString(),
Icons.notifications,
AppColors.primary,
),
_buildDetailedStatCard(
'Non lues',
unreadNotifications.toString(),
Icons.mark_email_unread,
AppColors.warning,
),
_buildDetailedStatCard(
'Importantes',
importantNotifications.toString(),
Icons.star,
AppColors.error,
),
_buildDetailedStatCard(
'Archivées',
archivedNotifications.toString(),
Icons.archive,
AppColors.onSurface.withOpacity(0.6),
),
],
),
const SizedBox(height: 20),
// Statistiques temporelles
Row(
children: [
Expanded(
child: _buildTimeStatCard(
'Aujourd\'hui',
todayNotifications.toString(),
Icons.today,
),
),
const SizedBox(width: 16),
Expanded(
child: _buildTimeStatCard(
'Cette semaine',
weekNotifications.toString(),
Icons.date_range,
),
),
],
),
const SizedBox(height: 20),
// Taux d'engagement
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.primaryContainer.withOpacity(0.3),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.primary.withOpacity(0.2),
),
),
child: Row(
children: [
Icon(
Icons.trending_up,
color: AppColors.primary,
size: 20,
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Taux d\'engagement',
style: AppTextStyles.labelMedium.copyWith(
color: AppColors.primary,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
Text(
'Pourcentage de notifications ouvertes',
style: AppTextStyles.bodySmall.copyWith(
color: AppColors.onSurface.withOpacity(0.7),
),
),
],
),
),
Text(
'${engagementRate.toStringAsFixed(1)}%',
style: AppTextStyles.titleMedium.copyWith(
color: AppColors.primary,
fontWeight: FontWeight.w700,
),
),
],
),
),
],
),
),
);
}
Widget _buildDetailedStatCard(
String label,
String value,
IconData icon,
Color color,
) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: color.withOpacity(0.05),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: color.withOpacity(0.2),
),
),
child: Row(
children: [
Icon(
icon,
color: color,
size: 20,
),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
value,
style: AppTextStyles.titleSmall.copyWith(
color: color,
fontWeight: FontWeight.w700,
),
),
Text(
label,
style: AppTextStyles.labelSmall.copyWith(
color: AppColors.onSurface.withOpacity(0.7),
),
),
],
),
),
],
),
);
}
Widget _buildTimeStatCard(String label, String value, IconData icon) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: AppColors.surfaceVariant.withOpacity(0.5),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: AppColors.outline.withOpacity(0.2),
),
),
child: Column(
children: [
Icon(
icon,
color: AppColors.onSurfaceVariant,
size: 20,
),
const SizedBox(height: 8),
Text(
value,
style: AppTextStyles.titleSmall.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 2),
Text(
label,
style: AppTextStyles.labelSmall.copyWith(
color: AppColors.onSurface.withOpacity(0.7),
),
textAlign: TextAlign.center,
),
],
),
);
}
}