VButtonVariant enum
A versatile button component with multiple variants, sizes, and interaction states.
VButton provides a wrapper around FButton with support for different visual styles, sizes, and optional icons. It automatically switches to icon-only mode when only a prefix is provided without child content. Supports optional tooltips for accessibility.
The widget uses two enums for configuration:
- VButtonVariant: Controls button style (primary, secondary, destructive, outline, ghost)
- VButtonSize: Controls button size (xs, sm, md, lg)
Parameters:
onPress: Callback when button is pressed (optional)variant: Button style variant (defaults to primary for text buttons, outline for icon-only)size: Button size (defaults to md)prefix: Icon or widget to display before textsuffix: Icon or widget to display after textchild: Button text contenttooltip: Optional tooltip text shown on hoverfullwidth: Whether button should expand to fill available width (defaults to false)disabled: Whether button is disabled (defaults to false)selected: Whether button is in selected state (defaults to false)autofocus: Whether button should request focus (defaults to false)focusNode: Custom focus node for the buttonmainAxisAlignment: Horizontal alignment of button content (defaults to center)crossAxisAlignment: Vertical alignment of button content (defaults to center)
Example:
// Primary button with text and icon
VButton(
onPress: () => handleSubmit(),
variant: VButtonVariant.primary,
size: VButtonSize.md,
prefix: Icon(Icons.save),
child: Text('Save Changes'),
tooltip: 'Save your changes',
)
// Icon-only button
VButton(
onPress: () => handleDelete(),
variant: VButtonVariant.destructive,
size: VButtonSize.sm,
prefix: Icon(Icons.delete),
)
// Full-width secondary button
VButton(
onPress: () => handleCancel(),
variant: VButtonVariant.secondary,
fullwidth: true,
child: Text('Cancel'),
)
Values
- primary → const VButtonVariant
- secondary → const VButtonVariant
- destructive → const VButtonVariant
- outline → const VButtonVariant
- ghost → const VButtonVariant
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
VButtonVariant> - A constant List of the values in this enum, in order of their declaration.