LokioButton class
A customizable button widget with multiple variants, sizes, and states.
Supports primary, secondary, outline, text, and icon variants with tiny, small, medium, large, and giant sizes. Includes loading state and icon support.
Example:
LokioButton(
onPressed: () {},
variant: ButtonVariant.primary,
size: ButtonSize.medium,
child: Text('Click me'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- LokioButton
Constructors
- LokioButton({Key? key, required VoidCallback? onPressed, ButtonVariant variant = ButtonVariant.primary, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, bool isExpanded = false, LokioTheme? theme})
-
const
- LokioButton.icon({required VoidCallback? onPressed, required Widget icon, ButtonSize size = ButtonSize.medium, bool isLoading = false, bool isExpanded = false, LokioTheme? theme, bool leading = true})
-
Create an icon button with default styling
factory
- LokioButton.outline({required VoidCallback? onPressed, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, bool isExpanded = false, LokioTheme? theme})
-
Create an outline button with default styling
factory
- LokioButton.primary({required VoidCallback? onPressed, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, bool isExpanded = false, LokioTheme? theme})
-
Create a primary button with default styling
factory
- LokioButton.secondary({required VoidCallback? onPressed, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, bool isExpanded = false, LokioTheme? theme})
-
Create a secondary button with default styling
factory
- LokioButton.text({required VoidCallback? onPressed, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, bool isExpanded = false, LokioTheme? theme})
-
Create a text button with default styling
factory
Properties
- child → Widget?
-
Child widget (typically Text)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isExpanded → bool
-
Whether to expand button to fill available width
final
- isLoading → bool
-
Whether button is in loading state
When true, button is disabled and loading spinner appears in leading position
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leadingIcon → Widget?
-
Leading icon (displayed before child, or replaced by loading spinner)
final
- onPressed → VoidCallback?
-
Callback function when button is pressed
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → ButtonSize
-
Button size
final
- theme → LokioTheme?
-
Optional custom theme. If not provided, uses default theme.
final
- trailingIcon → Widget?
-
Trailing icon (displayed after child)
final
- variant → ButtonVariant
-
Button variant style
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited