Files
unionflow-mobile-apps/lib/shared/widgets/dynamic_fab.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

44 lines
1.2 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 : 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.primary,
foregroundColor: Colors.white,
elevation: 4,
icon: Icon(icon, size: 20),
label: Text(
label!,
style: AppTypography.actionText,
),
);
}
return FloatingActionButton(
onPressed: onPressed,
backgroundColor: AppColors.primary,
foregroundColor: Colors.white,
elevation: 4,
child: Icon(icon, size: 24),
);
}
}