ChromiaButton is a versatile button component that supports multiple variants, sizes, and states. It automatically adapts to the current theme and provides smooth animations and interactions.
Basic Usage
Variants
Buttons come in five visual variants:Filled Button (Default)
The primary button variant with solid background color.Outlined Button
Button with border and transparent background.Text Button
Minimal button without background or border (ghost variant).Tonal Button
Filled button with subtle background for lower emphasis.Elevated Button
Button with shadow elevation.Sizes
Buttons support three size options:With Icons
Add icons before or after the button text:Loading State
Show a loading indicator:Full Width
Make the button take full available width:Disabled State
Disable the button by settingonPressed to null:
Custom Styling
Override default styles with custom button style:Long Press
Handle long press events:Parameters
Callback when the button is pressed. If null, the button will be disabled.
The widget to display as the button content.
The button variant. Options:
filled, outlined, text, tonal, elevated.The button size. Options:
small, medium, large.Custom button style to override default styling.
Whether the button should take full available width.
Whether the button is in loading state.
Custom loading widget (defaults to CircularProgressIndicator).
Optional icon to display alongside the child.
Position of the icon relative to the child. Options:
leading, trailing.Spacing between icon and child.
Callback when the button is long pressed.
ChromiaButtonStyle Properties
TheChromiaButtonStyle class provides extensive customization options:
The background color of the button.
The foreground color (text and icon) of the button.
The background color when the button is disabled.
The foreground color when the button is disabled.
The background color when the button is hovered.
The background color when the button is pressed.
The border color of the button.
The width of the button border.
The padding inside the button.
The border radius of the button.
The elevation of the button.
The text style for the button label.
The minimum size of the button.
The maximum size of the button.
