import 'package:flutter/material.dart'; import '../design_system/tokens/app_colors.dart'; import '../design_system/tokens/app_typography.dart'; /// UnionFlow Mobile - Composant DRY : InfoBadge /// Indicateur compact pour les statuts ("PayƩ", "Admin", etc). class InfoBadge extends StatelessWidget { final String text; final Color backgroundColor; final Color textColor; final IconData? icon; const InfoBadge({ Key? key, required this.text, this.backgroundColor = AppColors.primaryLight, this.textColor = Colors.white, this.icon, }) : super(key: key); // Factory methods pour les statuts courants factory InfoBadge.success(String text) { return InfoBadge( text: text, backgroundColor: AppColors.success.withOpacity(0.15), textColor: AppColors.success, icon: Icons.check_circle_outline, ); } factory InfoBadge.error(String text) { return InfoBadge( text: text, backgroundColor: AppColors.error.withOpacity(0.15), textColor: AppColors.error, icon: Icons.error_outline, ); } factory InfoBadge.neutral(String text) { return InfoBadge( text: text, backgroundColor: AppColors.info.withOpacity(0.15), textColor: AppColors.info, ); } @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( color: backgroundColor, borderRadius: BorderRadius.circular(4), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ if (icon != null) ...[ Icon(icon, size: 10, color: textColor), const SizedBox(width: 2), ], Text( text, style: AppTypography.badgeText.copyWith(color: textColor), ), ], ), ); } }