303 lines
6.8 KiB
Dart
303 lines
6.8 KiB
Dart
// Export all sophisticated button components
|
|
export 'sophisticated_button.dart';
|
|
export 'floating_action_button.dart';
|
|
export 'icon_button.dart';
|
|
export 'button_group.dart';
|
|
|
|
// Predefined button styles for quick usage
|
|
import 'package:flutter/material.dart';
|
|
import 'sophisticated_button.dart';
|
|
import 'floating_action_button.dart';
|
|
import 'icon_button.dart';
|
|
import '../../theme/app_theme.dart';
|
|
|
|
// Quick button factory methods
|
|
class QuickButtons {
|
|
// Primary buttons
|
|
static Widget primary({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
bool loading = false,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.primary,
|
|
size: size,
|
|
loading: loading,
|
|
);
|
|
}
|
|
|
|
static Widget secondary({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
bool loading = false,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.secondary,
|
|
size: size,
|
|
loading: loading,
|
|
);
|
|
}
|
|
|
|
static Widget outline({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
Color? color,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.outline,
|
|
size: size,
|
|
backgroundColor: color,
|
|
);
|
|
}
|
|
|
|
static Widget ghost({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
Color? color,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.ghost,
|
|
size: size,
|
|
backgroundColor: color,
|
|
);
|
|
}
|
|
|
|
static Widget gradient({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
Gradient? gradient,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.gradient,
|
|
size: size,
|
|
gradient: gradient,
|
|
);
|
|
}
|
|
|
|
static Widget glass({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.glass,
|
|
size: size,
|
|
);
|
|
}
|
|
|
|
static Widget danger({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.danger,
|
|
size: size,
|
|
);
|
|
}
|
|
|
|
static Widget success({
|
|
required String text,
|
|
required VoidCallback onPressed,
|
|
IconData? icon,
|
|
ButtonSize size = ButtonSize.medium,
|
|
}) {
|
|
return SophisticatedButton(
|
|
text: text,
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: ButtonVariant.success,
|
|
size: size,
|
|
);
|
|
}
|
|
|
|
// Icon buttons
|
|
static Widget iconPrimary({
|
|
required IconData icon,
|
|
required VoidCallback onPressed,
|
|
double? size,
|
|
String? tooltip,
|
|
int? notificationCount,
|
|
}) {
|
|
return SophisticatedIconButton(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: IconButtonVariant.filled,
|
|
backgroundColor: AppTheme.primaryColor,
|
|
size: size,
|
|
tooltip: tooltip,
|
|
notificationCount: notificationCount,
|
|
);
|
|
}
|
|
|
|
static Widget iconSecondary({
|
|
required IconData icon,
|
|
required VoidCallback onPressed,
|
|
double? size,
|
|
String? tooltip,
|
|
int? notificationCount,
|
|
}) {
|
|
return SophisticatedIconButton(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: IconButtonVariant.filled,
|
|
backgroundColor: AppTheme.secondaryColor,
|
|
size: size,
|
|
tooltip: tooltip,
|
|
notificationCount: notificationCount,
|
|
);
|
|
}
|
|
|
|
static Widget iconOutline({
|
|
required IconData icon,
|
|
required VoidCallback onPressed,
|
|
double? size,
|
|
String? tooltip,
|
|
Color? color,
|
|
}) {
|
|
return SophisticatedIconButton(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: IconButtonVariant.outlined,
|
|
foregroundColor: color ?? AppTheme.primaryColor,
|
|
borderColor: color ?? AppTheme.primaryColor,
|
|
size: size,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
|
|
static Widget iconGhost({
|
|
required IconData icon,
|
|
required VoidCallback onPressed,
|
|
double? size,
|
|
String? tooltip,
|
|
Color? color,
|
|
}) {
|
|
return SophisticatedIconButton(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: IconButtonVariant.ghost,
|
|
backgroundColor: color ?? AppTheme.primaryColor,
|
|
size: size,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
|
|
static Widget iconGradient({
|
|
required IconData icon,
|
|
required VoidCallback onPressed,
|
|
double? size,
|
|
String? tooltip,
|
|
Gradient? gradient,
|
|
}) {
|
|
return SophisticatedIconButton(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: IconButtonVariant.gradient,
|
|
gradient: gradient,
|
|
size: size,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
|
|
// FAB buttons
|
|
static Widget fab({
|
|
required VoidCallback onPressed,
|
|
IconData icon = Icons.add,
|
|
FABVariant variant = FABVariant.primary,
|
|
FABSize size = FABSize.regular,
|
|
String? tooltip,
|
|
}) {
|
|
return SophisticatedFAB(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: variant,
|
|
size: size,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
|
|
static Widget fabExtended({
|
|
required String label,
|
|
required VoidCallback onPressed,
|
|
IconData icon = Icons.add,
|
|
FABVariant variant = FABVariant.primary,
|
|
String? tooltip,
|
|
}) {
|
|
return SophisticatedFAB(
|
|
icon: icon,
|
|
label: label,
|
|
onPressed: onPressed,
|
|
variant: variant,
|
|
size: FABSize.extended,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
|
|
static Widget fabGradient({
|
|
required VoidCallback onPressed,
|
|
IconData icon = Icons.add,
|
|
FABSize size = FABSize.regular,
|
|
Gradient? gradient,
|
|
String? tooltip,
|
|
}) {
|
|
return SophisticatedFAB(
|
|
icon: icon,
|
|
onPressed: onPressed,
|
|
variant: FABVariant.gradient,
|
|
size: size,
|
|
gradient: gradient,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
|
|
static Widget fabMorphing({
|
|
required VoidCallback onPressed,
|
|
required List<IconData> icons,
|
|
FABSize size = FABSize.regular,
|
|
Duration morphingDuration = const Duration(seconds: 2),
|
|
String? tooltip,
|
|
}) {
|
|
return SophisticatedFAB(
|
|
onPressed: onPressed,
|
|
variant: FABVariant.morphing,
|
|
size: size,
|
|
morphingIcons: icons,
|
|
morphingDuration: morphingDuration,
|
|
tooltip: tooltip,
|
|
);
|
|
}
|
|
} |