LokioButton class

A customizable button widget with multiple variants, sizes, and states.

Supports primary, secondary, outlined, and text variants with small, medium, and large sizes. Includes loading state and icon support.

Example:

LokioButton(
  onPressed: () {},
  variant: ButtonVariant.primary,
  size: ButtonSize.medium,
  child: Text('Click me'),
)
Inheritance

Constructors

LokioButton({Key? key, required VoidCallback? onPressed, ButtonVariant variant = ButtonVariant.primary, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, Color? backgroundColor, Color? foregroundColor, Color? borderColor, double? borderWidth, double? borderRadius, double? minWidth, bool isExpanded = false})
const
LokioButton.outlined({required VoidCallback? onPressed, ButtonSize size = ButtonSize.medium, Widget? child, Widget? leadingIcon, Widget? trailingIcon, bool isLoading = false, bool isExpanded = false})
Create an outlined 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})
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})
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})
Create a text button with default styling
factory

Properties

backgroundColor Color?
Custom background color (only for primary and secondary)
final
borderColor Color?
Custom border color (only for outlined variant)
final
borderRadius double?
Custom border radius
final
borderWidth double?
Custom border width (only for outlined variant)
final
child Widget?
Child widget (typically Text)
final
foregroundColor Color?
Custom foreground color (text and icon color)
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
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leadingIcon Widget?
Leading icon (displayed before child)
final
minWidth double?
Minimum width of the button
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
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