import 'package:flutter/material.dart'; import '../tokens/app_colors.dart'; import '../tokens/unionflow_colors.dart'; /// Ligne d'activité récente — style fintech compact /// Adaptatif dark/light via AppColors class DashboardActivityRow extends StatelessWidget { final String title; final String description; final String timeAgo; final IconData icon; final Color color; const DashboardActivityRow({ super.key, required this.title, required this.description, required this.timeAgo, required this.icon, required this.color, }); @override Widget build(BuildContext context) { final isDark = Theme.of(context).brightness == Brightness.dark; final bgColor = isDark ? AppColors.surfaceDark : AppColors.surface; final borderColor = isDark ? AppColors.borderDark : AppColors.border; final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary; final textSecondary = isDark ? AppColors.textSecondaryDark: AppColors.textSecondary; final textTertiary = isDark ? AppColors.textSecondaryDark: AppColors.textTertiary; return Container( margin: const EdgeInsets.only(bottom: 6), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 9), decoration: BoxDecoration( color: bgColor, borderRadius: BorderRadius.circular(8), border: Border.all(color: borderColor), ), child: Row( children: [ Container( width: 28, height: 28, decoration: BoxDecoration( color: color.withOpacity(isDark ? 0.2 : 0.12), borderRadius: BorderRadius.circular(6), ), child: Icon(icon, size: 14, color: color), ), const SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: textPrimary), maxLines: 1, overflow: TextOverflow.ellipsis, ), Text( description, style: TextStyle(fontSize: 10, color: textSecondary), maxLines: 1, overflow: TextOverflow.ellipsis, ), ], ), ), const SizedBox(width: 8), Text(timeAgo, style: TextStyle(fontSize: 10, color: textTertiary)), ], ), ); } /// Icône selon le type d'activité static IconData iconFor(String type) { switch (type) { case 'member': return Icons.person_add_rounded; case 'event': return Icons.event_rounded; case 'contribution': return Icons.payments_rounded; default: return Icons.circle_notifications_rounded; } } /// Couleur selon le type d'activité static Color colorFor(String type) { switch (type) { case 'member': return UnionFlowColors.unionGreen; case 'event': return UnionFlowColors.info; case 'contribution': return UnionFlowColors.gold; default: return AppColors.textSecondary; } } }