- 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
81 lines
2.4 KiB
Dart
81 lines
2.4 KiB
Dart
/// UnionFlow Secondary Button - Bouton secondaire
|
|
///
|
|
/// Bouton secondaire Vert Menthe (#4CAF50)
|
|
/// Utilisé pour les actions secondaires (annuler, retour, etc.)
|
|
library uf_secondary_button;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import '../../unionflow_design_system.dart';
|
|
|
|
/// Bouton secondaire UnionFlow
|
|
class UFSecondaryButton extends StatelessWidget {
|
|
final String label;
|
|
final VoidCallback? onPressed;
|
|
final bool isLoading;
|
|
final IconData? icon;
|
|
final bool isFullWidth;
|
|
final double? height;
|
|
|
|
const UFSecondaryButton({
|
|
super.key,
|
|
required this.label,
|
|
this.onPressed,
|
|
this.isLoading = false,
|
|
this.icon,
|
|
this.isFullWidth = false,
|
|
this.height,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: isFullWidth ? double.infinity : null,
|
|
height: height ?? SpacingTokens.buttonHeightMedium,
|
|
child: ElevatedButton(
|
|
onPressed: isLoading ? null : onPressed,
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: AppColors.primaryDark,
|
|
foregroundColor: Colors.white,
|
|
disabledBackgroundColor: AppColors.primaryDark.withOpacity(0.5),
|
|
disabledForegroundColor: Colors.white.withOpacity(0.7),
|
|
elevation: SpacingTokens.elevationSm,
|
|
shadowColor: AppColors.borderDark.withOpacity(0.1),
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: SpacingTokens.buttonPaddingHorizontal,
|
|
vertical: 10,
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(SpacingTokens.radiusMd),
|
|
),
|
|
),
|
|
child: isLoading
|
|
? const SizedBox(
|
|
height: 20,
|
|
width: 20,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 2,
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
Colors.white,
|
|
),
|
|
),
|
|
)
|
|
: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
if (icon != null) ...[
|
|
Icon(icon, size: 20),
|
|
const SizedBox(width: SpacingTokens.md),
|
|
],
|
|
Text(
|
|
label,
|
|
style: AppTypography.actionText,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|