Button class
A versatile, customizable button widget with comprehensive styling and interaction support.
Button is the foundational interactive widget in the shadcn_flutter design system, providing a consistent and accessible button implementation with extensive customization options. It supports multiple visual variants, sizes, shapes, and interaction patterns while maintaining design system consistency.
Key Features
- Multiple Variants: Primary, secondary, outline, ghost, link, text, destructive, and more
- Flexible Sizing: From extra small to extra large with custom scaling
- Shape Options: Rectangle and circle shapes with customizable borders
- Rich Interactions: Hover, focus, press, and long press support
- Accessibility: Full keyboard navigation and screen reader support
- Theming: Deep integration with the design system theme
- Form Integration: Works seamlessly with form validation and state management
Visual Variants
The button supports various visual styles through named constructors:
- Button.primary: Prominent primary actions with filled background
- Button.secondary: Secondary actions with muted background
- Button.outline: Actions with outline border and transparent background
- Button.ghost: Subtle actions with minimal visual weight
- Button.link: Text-only actions that appear as links
- Button.text: Plain text actions with hover effects
- Button.destructive: Dangerous actions with destructive styling
- Button.card: Card-like appearance for container buttons
Layout and Content
Buttons can contain text, icons, or a combination of both using leading and trailing widgets. The child widget is automatically aligned and sized according to the button's style and density settings.
Interaction Handling
The button provides comprehensive gesture support including tap, long press, secondary clicks, and tertiary clicks. All interactions respect the enabled state and provide appropriate visual and haptic feedback.
Example:
Button.primary(
onPressed: () => print('Primary action'),
leading: Icon(Icons.add),
trailing: Icon(Icons.arrow_forward),
child: Text('Create New'),
);
- Inheritance
- Available extensions
Constructors
-
Button({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, required AbstractButtonStyle style, bool? enabled, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a Button with custom styling.
const
-
Button.card({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.card, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a card-style button with elevated appearance.
const
-
Button.destructive({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.destructive, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a destructive button for actions that delete or destroy data.
const
-
Button.fixed({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.fixed, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a fixed-style button with consistent dimensions.
const
-
Button.ghost({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.ghost, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a ghost button with minimal styling for subtle actions.
const
-
Button.link({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.link, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a link-styled button with underline decoration.
const
-
Button.outline({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.outline, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates an outline button with a border and transparent background.
const
-
Button.primary({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.primary, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a primary button with prominent styling for main actions.
const
-
Button.secondary({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.secondary, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a secondary button with muted styling for supporting actions.
const
-
Button.text({Key? key, WidgetStatesController? statesController, Widget? leading, Widget? trailing, double? leadingGap, double? trailingGap, required Widget child, VoidCallback? onPressed, FocusNode? focusNode, AlignmentGeometry? alignment, bool? enabled, AbstractButtonStyle style = ButtonVariance.text, bool disableTransition = false, ValueChanged<
bool> ? onFocus, ValueChanged<bool> ? onHover, bool disableHoverEffect = false, 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, AlignmentGeometry? marginAlignment, bool disableFocusOutline = false}) -
Creates a text-only button with no background or border.
const
Properties
- alignment → AlignmentGeometry?
-
Alignment of the child content within the button.
final
- asBuilder → NeverWidgetBuilder
-
Available on Widget, provided by the WidgetExtension extension
Converts this widget to a builder function.no setter - base → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies base (default) font size.no setter - black → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies black font weight (900).no setter - blockQuote → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies block quote style with left border.no setter - bold → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies bold font weight (700).no setter - child → Widget
-
The primary content displayed in the button.
final
- disableFocusOutline → bool
-
Whether to disable the focus outline.
final
- disableHoverEffect → bool
-
Whether to disable hover visual effects.
final
- disableTransition → bool
-
Whether to disable visual state transition animations.
final
- ellipsis → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies ellipsis overflow to text.no setter - enabled → bool?
-
Whether the button is interactive.
final
- enableFeedback → bool?
-
Whether to enable haptic feedback on press.
final
- extraBold → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies extra-bold font weight (800).no setter - extraLight → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies extra-light font weight (200).no setter - firstP → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies paragraph style for the first paragraph (no top spacing).no setter - focusNode → FocusNode?
-
Focus node for keyboard navigation and focus management.
final
- foreground → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies standard foreground color.no setter - h1 → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies heading 1 style.no setter - h2 → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies heading 2 style with bottom border.no setter - h3 → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies heading 3 style.no setter - h4 → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies heading 4 style.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- iconDestructiveForeground → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with destructive foreground color.no setter - iconLarge → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with large size theme.no setter - iconMedium → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with medium size theme.no setter - iconMutedForeground → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with muted foreground color.no setter - iconPrimary → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with primary color.no setter - iconPrimaryForeground → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with primary foreground color.no setter - iconSecondary → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with secondary color.no setter - iconSecondaryForeground → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with secondary foreground color.no setter - iconSmall → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with small size theme.no setter - iconX2Large → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra-extra large size theme.no setter - iconX2Small → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra-extra small size theme.no setter - iconX3Large → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra-extra-extra large size theme.no setter - iconX3Small → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra-extra-extra small size theme.no setter - iconX4Large → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra-extra-extra-extra large size theme.no setter - iconX4Small → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra-extra-extra-extra small size theme.no setter - iconXLarge → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra large size theme.no setter - iconXSmall → WrappedIcon
-
Available on Widget, provided by the IconExtension extension
Wraps the icon with extra small size theme.no setter - inlineCode → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies inline code style with background and padding.no setter - italic → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies italic font style.no setter - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies large font size.no setter - lead → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies lead paragraph style with muted color.no setter - leading → Widget?
-
Widget displayed to the left of the main child content.
final
- leadingGap → double?
-
Custom gap between leading and child.
final
- li → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies list item style with bullet point.no setter - light → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies light font weight (300).no setter - marginAlignment → AlignmentGeometry?
-
Alignment for the button's margin within its allocated space.
final
- medium → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies medium font weight (500).no setter - modify → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies primary foreground color modifier.no setter - mono → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies monospace font family.no setter - muted → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies muted foreground color.no setter - normal → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies normal font weight (400).no setter -
onFocus
→ ValueChanged<
bool> ? -
Callback invoked when the button's focus state changes.
final
-
onHover
→ ValueChanged<
bool> ? -
Callback invoked when the button's hover state changes.
final
- onLongPressEnd → GestureLongPressEndCallback?
-
Callback invoked when a long press gesture ends.
final
- onLongPressMoveUpdate → GestureLongPressMoveUpdateCallback?
-
Callback invoked when a long press gesture moves.
final
- onLongPressStart → GestureLongPressStartCallback?
-
Callback invoked when a long press gesture begins.
final
- onLongPressUp → GestureLongPressUpCallback?
-
Callback invoked when a long press gesture completes.
final
- onPressed → VoidCallback?
-
Callback invoked when the button is pressed.
final
- onSecondaryLongPress → GestureLongPressUpCallback?
-
Callback invoked when a secondary button long press completes.
final
- onSecondaryTapCancel → GestureTapCancelCallback?
-
Callback invoked when a secondary button tap is canceled.
final
- onSecondaryTapDown → GestureTapDownCallback?
-
Callback invoked when a secondary button (right-click) tap down begins.
final
- onSecondaryTapUp → GestureTapUpCallback?
-
Callback invoked when a secondary button tap up completes.
final
- onTapCancel → GestureTapCancelCallback?
-
Callback invoked when a tap gesture is canceled.
final
- onTapDown → GestureTapDownCallback?
-
Callback invoked when a tap down gesture begins.
final
- onTapUp → GestureTapUpCallback?
-
Callback invoked when a tap up gesture completes.
final
- onTertiaryLongPress → GestureLongPressUpCallback?
-
Callback invoked when a tertiary button long press completes.
final
- onTertiaryTapCancel → GestureTapCancelCallback?
-
Callback invoked when a tertiary button tap is canceled.
final
- onTertiaryTapDown → GestureTapDownCallback?
-
Callback invoked when a tertiary button (middle-click) tap down begins.
final
- onTertiaryTapUp → GestureTapUpCallback?
-
Callback invoked when a tertiary button tap up completes.
final
- p → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies paragraph style with top spacing.no setter - primaryForeground → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies primary foreground color.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sans → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies sans-serif font family.no setter - secondaryForeground → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies secondary foreground color.no setter - semiBold → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies semi-bold font weight (600).no setter - singleLine → TextModifier
-
Available on Widget, provided by the TextExtension extension
Constrains text to a single line without wrapping.no setter - small → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies small font size.no setter - statesController → WidgetStatesController?
-
Controller for managing button widget states externally.
final
- style → AbstractButtonStyle
-
Visual styling configuration for the button.
final
- textCenter → TextModifier
-
Available on Widget, provided by the TextExtension extension
Centers text horizontally.no setter - textEnd → TextModifier
-
Available on Widget, provided by the TextExtension extension
Aligns text to the end (right in LTR, left in RTL).no setter - textJustify → TextModifier
-
Available on Widget, provided by the TextExtension extension
Justifies text alignment.no setter - textLarge → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies large text style.no setter - textLeft → TextModifier
-
Available on Widget, provided by the TextExtension extension
Left-aligns text.no setter - textMuted → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies muted text style with muted color.no setter - textRight → TextModifier
-
Available on Widget, provided by the TextExtension extension
Right-aligns text.no setter - textSmall → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies small text style.no setter - textStart → TextModifier
-
Available on Widget, provided by the TextExtension extension
Aligns text to the start (left in LTR, right in RTL).no setter - thin → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies thin font weight (100).no setter - trailing → Widget?
-
Widget displayed to the right of the main child content.
final
- trailingGap → double?
-
Custom gap between child and trailing.
final
- underline → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies underline text decoration.no setter - x2Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 2x large font size.no setter - x3Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 3x large font size.no setter - x4Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 4x large font size.no setter - x5Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 5x large font size.no setter - x6Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 6x large font size.no setter - x7Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 7x large font size.no setter - x8Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 8x large font size.no setter - x9Large → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies 9x large font size.no setter - xLarge → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies extra-large font size.no setter - xSmall → TextModifier
-
Available on Widget, provided by the TextExtension extension
Applies extra-small font size.no setter
Methods
-
asSkeleton(
{bool enabled = true, bool leaf = false, Widget? replacement, bool unite = false, AsyncSnapshot? snapshot}) → Widget -
Available on Widget, provided by the SkeletonExtension extension
Converts the widget to a skeleton with advanced configuration options. -
asSkeletonSliver(
{bool enabled = true}) → Widget -
Available on Widget, provided by the SkeletonExtension extension
Converts the widget to a skeleton suitable for sliver layouts. -
center(
{Key? key}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Centers this widget horizontally and vertically. -
clip(
{Clip clipBehavior = Clip.hardEdge}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Clips this widget to a rectangle. -
clipOval(
{Clip clipBehavior = Clip.antiAlias}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Clips this widget to an oval shape. -
clipPath(
{Clip clipBehavior = Clip.antiAlias, required CustomClipper< Path> clipper}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Clips this widget to a custom path. -
clipRRect(
{BorderRadiusGeometry borderRadius = BorderRadius.zero, Clip clipBehavior = Clip.antiAlias}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Clips this widget to a rounded rectangle. -
constrained(
{double? minWidth, double? maxWidth, double? minHeight, double? maxHeight, double? width, double? height}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps this widget in a ConstrainedBox with specified constraints. -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → ButtonState< Button> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
excludeSkeleton(
{bool exclude = true}) → Widget -
Available on Widget, provided by the SkeletonExtension extension
Controls whether the widget should be preserved in skeleton mode. -
expanded(
{int flex = 1}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Makes this widget expanded within a Flex parent (Row/Column). -
ignoreSkeleton(
) → Widget -
Available on Widget, provided by the SkeletonExtension extension
Excludes the widget from skeleton effects in its parent skeleton context. -
intrinsic(
{double? stepWidth, double? stepHeight}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sizes this widget to both intrinsic width and height. -
intrinsicHeight(
) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sizes this widget to its intrinsic height. -
intrinsicWidth(
{double? stepWidth, double? stepHeight}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sizes this widget to its intrinsic width. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
positioned(
{Key? key, double? left, double? top, double? right, double? bottom}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Positions this widget absolutely within a Stack. -
sized(
{double? width, double? height, double? size}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps this widget in a SizedBox with specified dimensions. -
then(
InlineSpan span) → Widget -
Available on Widget, provided by the TextExtension extension
Appends an inline span to the current text widget. -
thenButton(
{required VoidCallback onPressed, required Widget child}) → Widget -
Available on Widget, provided by the TextExtension extension
Appends a button widget to the current text widget. -
thenInlineCode(
String text) → Widget -
Available on Widget, provided by the TextExtension extension
Appends inline code to the current text widget. -
thenText(
String text) → Widget -
Available on Widget, provided by the TextExtension extension
Appends a text span to the current text widget. -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
-
transform(
{Key? key, required Matrix4 transform}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies a transformation matrix to this widget. -
withAlign(
AlignmentGeometry alignment) → Widget -
Available on Widget, provided by the WidgetExtension extension
Aligns this widget within its parent. -
withOpacity(
double opacity) → Widget -
Available on Widget, provided by the WidgetExtension extension
Applies opacity to this widget. -
withPadding(
{double? top, double? bottom, double? left, double? right, double? horizontal, double? vertical, double? all, EdgeInsetsGeometry? padding}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Wraps this widget in a Padding widget.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited