CardButton constructor
const
CardButton({
- Key? key,
- required Widget child,
- VoidCallback? onPressed,
- bool? enabled,
- Widget? leading,
- Widget? trailing,
- AlignmentGeometry? alignment,
- ButtonSize size = ButtonSize.normal,
- ButtonDensity density = ButtonDensity.normal,
- ButtonShape shape = ButtonShape.rectangle,
- FocusNode? focusNode,
- bool disableTransition = false,
- ValueChanged<
bool> ? onHover, - ValueChanged<
bool> ? onFocus, - bool? enableFeedback,
- GestureTapDownCallback? onTapDown,
- GestureTapUpCallback? onTapUp,
- GestureTapCancelCallback? onTapCancel,
- GestureTapDownCallback? onSecondaryTapDown,
- GestureTapUpCallback? onSecondaryTapUp,
- GestureTapCancelCallback? onSecondaryTapCancel,
- GestureTapDownCallback? onTertiaryTapDown,
- GestureTapUpCallback? onTertiaryTapUp,
- GestureTapCancelCallback? onTertiaryTapCancel,
- GestureLongPressStartCallback? onLongPressStart,
- GestureLongPressUpCallback? onLongPressUp,
- GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate,
- GestureLongPressEndCallback? onLongPressEnd,
- GestureLongPressUpCallback? onSecondaryLongPress,
- GestureLongPressUpCallback? onTertiaryLongPress,
Creates a CardButton with card-styled appearance and comprehensive interaction support.
The child
parameter is required and provides the button's main content.
The button uses card styling with elevated appearance for visual prominence.
Extensive gesture support enables complex interactions beyond simple taps.
Parameters include standard button properties (onPressed, enabled, leading, trailing) along with size, density, and shape customization options. Gesture callbacks support primary, secondary, tertiary taps and long presses.
Parameters:
child
(Widget, required): The main content displayed in the buttononPressed
(VoidCallback?, optional): Primary action when button is pressedenabled
(bool?, optional): Whether button accepts input (null uses onPressed)size
(ButtonSize, default: normal): Size variant for button dimensionsdensity
(ButtonDensity, default: normal): Spacing density settingshape
(ButtonShape, default: rectangle): Border radius and corner styling
Example:
CardButton(
size: ButtonSize.large,
leading: Icon(Icons.star),
onPressed: () => _handleFavorite(),
child: Text('Add to Favorites'),
)
Implementation
const CardButton({
super.key,
required this.child,
this.onPressed,
this.enabled,
this.leading,
this.trailing,
this.alignment,
this.size = ButtonSize.normal,
this.density = ButtonDensity.normal,
this.shape = ButtonShape.rectangle,
this.focusNode,
this.disableTransition = false,
this.onHover,
this.onFocus,
this.enableFeedback,
this.onTapDown,
this.onTapUp,
this.onTapCancel,
this.onSecondaryTapDown,
this.onSecondaryTapUp,
this.onSecondaryTapCancel,
this.onTertiaryTapDown,
this.onTertiaryTapUp,
this.onTertiaryTapCancel,
this.onLongPressStart,
this.onLongPressUp,
this.onLongPressMoveUpdate,
this.onLongPressEnd,
this.onSecondaryLongPress,
this.onTertiaryLongPress,
});