RemixButton class
A customizable button component that supports text with optional leading and trailing icons, loading states, and styling. The button integrates with the Mix styling system and follows Remix design patterns. For icon-only buttons, use RemixIconButton instead.
Examples
// Basic button
RemixButton(
label: 'Click Me',
onPressed: () => debugPrint('Button pressed!'),
)
// Button with leading icon
RemixButton(
label: 'Save Changes',
leadingIcon: Icons.save,
onPressed: () => debugPrint('Save pressed!'),
)
// Button with trailing icon
RemixButton(
label: 'Next',
trailingIcon: Icons.arrow_forward,
onPressed: () => debugPrint('Next pressed!'),
)
// Button with both icons
RemixButton(
label: 'Send',
leadingIcon: Icons.send,
trailingIcon: Icons.check,
onPressed: () => debugPrint('Send pressed!'),
)
// Loading button
RemixButton(
label: 'Processing',
loading: true,
onPressed: () => debugPrint('Processing...'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- RemixButton
Constructors
- RemixButton({Key? key, required String label, IconData? leadingIcon, IconData? trailingIcon, RemixButtonTextBuilder? textBuilder, RemixButtonIconBuilder? leadingIconBuilder, RemixButtonIconBuilder? trailingIconBuilder, RemixButtonLoadingBuilder? loadingBuilder, bool loading = false, bool enabled = true, VoidCallback? onPressed, VoidCallback? onLongPress, FocusNode? focusNode, bool autofocus = false, bool enableFeedback = true, String? semanticLabel, String? semanticHint, bool excludeSemantics = false, MouseCursor mouseCursor = SystemMouseCursors.click, ButtonStyler style = const ButtonStyler.create(), ButtonSpec? styleSpec})
-
Creates a Remix button.
const
Properties
- autofocus → bool
-
Whether the button should automatically request focus when it is created.
final
- enabled → bool
-
Whether the button is enabled.
final
- enableFeedback → bool
-
Whether to provide feedback when the button is pressed.
final
- excludeSemantics → bool
-
Whether to hide the complete control from the semantic tree.
final
- focusNode → FocusNode?
-
Optional focus node to control the button's focus behavior.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String
-
The label text to display in the button.
If textBuilder is provided, this is ignored.
final
- leadingIcon → IconData?
-
The leading icon to display in the button (before the text).
If leadingIconBuilder is provided, this is ignored.
final
- leadingIconBuilder → RemixButtonIconBuilder?
-
Builder for customizing the leading icon rendering.
final
- loading → bool
-
Whether the button is in a loading state.
final
- loadingBuilder → RemixButtonLoadingBuilder?
-
Builder for customizing the loading state rendering.
final
- mouseCursor → MouseCursor
-
Cursor when hovering over the button.
final
- onLongPress → VoidCallback?
-
Callback function called when the button is long pressed.
final
- onPressed → VoidCallback?
-
Callback function called when the button is pressed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticHint → String?
-
The semantic hint for the button.
final
- semanticLabel → String?
-
The semantic label for the button.
final
- style → ButtonStyler
-
The style configuration for the button.
final
- styleSpec → ButtonSpec?
-
Optional raw style spec that bypasses fluent style resolution.
final
- textBuilder → RemixButtonTextBuilder?
-
Builder for customizing the text rendering.
final
- trailingIcon → IconData?
-
The trailing icon to display in the button (after the text).
If trailingIconBuilder is provided, this is ignored.
final
- trailingIconBuilder → RemixButtonIconBuilder?
-
Builder for customizing the trailing icon rendering.
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
Static Properties
-
styleFrom
→ ButtonStyler Function({AnimationConfig? animation, FlexBoxStyler? container, RemixBoxEffectsMix? containerEffects, IconStyler? icon, RemixIconAlignment? iconAlignment, TextStyler? label, WidgetModifierConfig? modifier, SpinnerStyler? spinner, List<
VariantStyle< ? variants})ButtonSpec> > -
final
Static Methods
-
composeStyle(
ButtonStyler style) → ButtonStyler - Composes widget-owned defaults with an incoming Button style.