Files
unionflow-mobile-apps/lib/shared/widgets/info_badge.dart
dahoud 7cd7c6fc9e feat(shared): legacy presentation/ + shared design system + widgets
- lib/presentation : pages legacy (explore/network, notifications) avec BLoC
- lib/shared/design_system : UnionFlow Design System v2 (tokens, components)
  + MD3 tokens + module_colors par feature
- lib/shared/widgets : widgets transversaux (core_card, core_shimmer,
  error_widget, loading_widget, powered_by_lions_dev, etc.)
- lib/shared/constants + utils
2026-04-15 20:27:23 +00:00

72 lines
1.9 KiB
Dart

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),
),
],
),
);
}
}