M3EButton class

M3EButton.

Inheritance

Constructors

M3EButton({Key? key, required VoidCallback? onPressed, Widget? child, Widget? icon, Widget? label, Widget? selectedIcon, Widget? selectedLabel, bool? isSelected, M3EButtonStyle style = M3EButtonStyle.filled, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
M3EButton.
const
M3EButton.elevated({Key? key, required VoidCallback? onPressed, Widget? child, Widget? icon, Widget? label, Widget? selectedIcon, Widget? selectedLabel, bool? isSelected, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
An elevated button (medium emphasis with a shadow).
const
M3EButton.filled({Key? key, required VoidCallback? onPressed, Widget? child, Widget? icon, Widget? label, Widget? selectedIcon, Widget? selectedLabel, bool? isSelected, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
A filled button (highest emphasis).
const
M3EButton.icon({Key? key, required VoidCallback? onPressed, required Widget icon, required Widget label, Widget? selectedIcon, Widget? selectedLabel, bool? isSelected, M3EButtonStyle style = M3EButtonStyle.filled, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
Factory for a button with an icon and label.
factory
M3EButton.outlined({Key? key, required VoidCallback? onPressed, Widget? child, Widget? icon, Widget? label, Widget? selectedIcon, Widget? selectedLabel, bool? isSelected, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
An outlined button (medium emphasis with a border).
const
M3EButton.text({Key? key, required VoidCallback? onPressed, Widget? child, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
A text button (lowest emphasis).
const
M3EButton.tonal({Key? key, required VoidCallback? onPressed, Widget? child, Widget? icon, Widget? label, Widget? selectedIcon, Widget? selectedLabel, bool? isSelected, M3EButtonSize size = M3EButtonSize.sm, M3EButtonShape shape = M3EButtonShape.round, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, WidgetStatesController? statesController, M3EButtonDecoration? decoration, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool>? onFocusChange, String? semanticLabel, String? tooltip, MouseCursor mouseCursor = SystemMouseCursors.click, VoidCallback? onLongPress, ValueChanged<bool>? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory})
A tonal button (medium emphasis).
const

Properties

autofocus → bool
Whether this button should focus itself on mount.
final
child → Widget?
The child content of the button.
final
decoration → M3EButtonDecoration?
Optional decoration that bundles styling properties together.
final
decorationBackgroundColor → WidgetStateProperty<Color?>?
decorationBackgroundColor.
no setter
decorationBorderRadius → double?
decorationBorderRadius.
no setter
decorationBorderSide → WidgetStateProperty<BorderSide?>?
decorationBorderSide.
no setter
decorationConnectedInnerRadius → double?
Radius used on connected inner corners.
no setter
decorationForegroundColor → WidgetStateProperty<Color?>?
decorationForegroundColor.
no setter
decorationHaptic → M3EHapticFeedback
decorationHaptic.
no setter
decorationMotion → M3EButtonMotion?
decorationMotion.
no setter
decorationMouseCursor → WidgetStateProperty<MouseCursor?>?
decorationMouseCursor.
no setter
decorationOverlayColor → WidgetStateProperty<Color?>?
decorationOverlayColor.
no setter
decorationPressedRadius → double?
decorationPressedRadius.
no setter
decorationSelectedRadius → double?
Radius used by the selected resting shape.
no setter
decorationSurfaceTintColor → WidgetStateProperty<Color?>?
decorationSurfaceTintColor.
no setter
decorationUnselectedRadius → double?
Radius used by the unselected resting shape.
no setter
enabled → bool
Whether the button is enabled. Defaults to true.
final
enableFeedback → bool
Whether to show a ripple/splash effect and haptic feedback on press.
final
focusNode → FocusNode?
External focus node for keyboard navigation.
final
hashCode → int
The hash code for this object.
no setterinherited
icon → Widget?
Icon displayed by selection-capable buttons.
final
isFirstInGroup → bool
Whether this is the first button in a connected group.
final
isGroupConnected → bool
Whether this button is part of a connected button group.
final
isLastInGroup → bool
Whether this is the last button in a connected group.
final
isSelected → bool?
Selection state. Null keeps default, non-toggle button behavior.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → Widget?
Label displayed by selection-capable buttons.
final
mouseCursor → MouseCursor
Custom mouse cursor.
final
onFocusChange → ValueChanged<bool>?
Callback fired when focus state changes.
final
onHover → ValueChanged<bool>?
Callback invoked when the hover state changes.
final
onLongPress → VoidCallback?
Callback invoked when the button is long-pressed.
final
onPressed → VoidCallback?
Callback invoked when the button is pressed. Null disables the button.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedIcon → Widget?
Icon displayed when isSelected is true. Falls back to icon.
final
selectedLabel → Widget?
Label displayed when isSelected is true. Falls back to label.
final
semanticLabel → String?
Accessibility label. Merged on top of the button's own semantics.
final
shape → M3EButtonShape
Corner radius strategy for the button.
final
size → M3EButtonSize
Size variant of the button.
final
splashFactory → InteractiveInkFeatureFactory?
The splash factory for the ink ripple effect.
final
statesController → WidgetStatesController?
Optional controller for managing widget states externally.
final
style → M3EButtonStyle
Visual style of the button.
final
tooltip → String?
Tooltip text.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<M3EButton>
Creates the mutable state for this widget at a given location in the tree.
override
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