import 'package:flutter/material.dart'; import '../design_system/tokens/app_colors.dart'; import '../design_system/tokens/app_typography.dart'; /// UnionFlow Mobile - Composant DRY : DynamicFAB /// Bouton Flottant "Twitter Style" paramétrable pour les actions principales. class DynamicFAB extends StatelessWidget { final VoidCallback onPressed; final IconData icon; final String? label; // Si null, c'est juste un bouton rond. Si texte, c'est un "extended" FAB. const DynamicFAB({ Key? key, required this.onPressed, required this.icon, this.label, }) : super(key: key); @override Widget build(BuildContext context) { if (label != null) { return FloatingActionButton.extended( onPressed: onPressed, backgroundColor: AppColors.primaryGreen, foregroundColor: Colors.white, elevation: 4, icon: Icon(icon, size: 20), label: Text( label!, style: AppTypography.actionText, ), ); } return FloatingActionButton( onPressed: onPressed, backgroundColor: AppColors.primaryGreen, foregroundColor: Colors.white, elevation: 4, child: Icon(icon, size: 24), ); } }