HButton

Class
A highly customizable button with various styling, size, and behavioral options.

Fields

controller: ButtonController
enabled: bool
focusKey: Key
onClick: Action
radius: Nullable<HInputRadius>
selected: bool
size: Nullable<HButtonSize>
variant: Nullable<HButtonVariant>

Constructors

HButton(variant: Nullable<HButtonVariant>, controller: ButtonController, focusKey: Key, enabled: bool, selected: bool, onClick: Action, style: HButtonStyle, radius: Nullable<HInputRadius>, size: Nullable<HButtonSize>, palette: ColorTokenPalette, child: Widget, key: Key, constants: object[], modifiers: IReadOnlyCollection<Modifier>)
Creates a highly customizable button with various styling, size, and behavioral options.

Parameters

variant:Nullable<HButtonVariant> - The preset button variant that is used to generate the button's visual style. If not specified, the current PrimitiveTheme.Button theme will be used.
controller:ButtonController - The controller used to manage the button's WidgetState and button behavior. If not specified, a controller will be created and managed by the button's state.
focusKey:Key - The key that will be used by the interactive element of the button. Can be used for focus management using GlobalKey.
enabled:bool - Sets WidgetState.Disabled if no controller is specified.
selected:bool - Sets WidgetState.Selected if no controller is specified.
onClick:Action - Sets the ButtonController.onClick action if no controller is specified.
style:HButtonStyle - A predefined button style to change the visual appearance of the button. If specified, the variant and PrimitiveTheme.Button theme will be ignored.
radius:Nullable<HInputRadius> - The radius preset used to generate the button's variant style.
size:Nullable<HButtonSize> - The size preset used to generate the button's variant style.
palette:ColorTokenPalette - The primary palette used to generate the button's variant style.
child:Widget - A widget that will be rendered inside the button.
key:Key - Passed on to Widget.key.
constants:object[] - Passed on to Widget.constants.
modifiers:IReadOnlyCollection<Modifier> - Passed on to Widget.modifiers.

Methods

CreateState(): State<HButton>
DebugFillProperties(properties: DiagnosticPropertiesBuilder): void

Inherited Members

Extension Methods

ToDiagnosticsNodeSafeIfClipConstDisplayExpandFillFlexibleMarginOpacityPaddingPositionedShrinkSizeStretchTightStretchTightVisibilityWithModifierToBuildableToFactorySpreadDescribeIdentityShortHashToStringNullable

On this page