Initial commit: unionflow-mobile-apps
Application Flutter complète (sans build artifacts). Signed-off-by: lions dev Team
This commit is contained in:
71
lib/shared/widgets/info_badge.dart
Normal file
71
lib/shared/widgets/info_badge.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
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.brandGreenLight,
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user