M3EToggleButton class
Material 3 Expressive Toggle Button.
Morphs between round (unchecked) and square (checked) shapes.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- M3EToggleButton
Constructors
-
M3EToggleButton({Key? key, ValueChanged<
bool> ? onCheckedChange, Widget? icon, Widget? checkedIcon, Widget? label, Widget? checkedLabel, bool? checked, M3EButtonStyle style = M3EButtonStyle.filled, M3EButtonSize size = M3EButtonSize.sm, bool enabled = true, bool isGroupConnected = false, bool isFirstInGroup = true, bool isLastInGroup = true, M3EToggleButtonDecoration? decoration, MouseCursor? mouseCursor, WidgetStatesController? statesController, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool> ? onFocusChange, String? semanticLabel, String? tooltip, VoidCallback? onLongPress, ValueChanged<bool> ? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory}) -
const.
const
-
M3EToggleButton.elevated({Key? key, ValueChanged<
bool> ? onCheckedChange, Widget? icon, Widget? checkedIcon, Widget? label, Widget? checkedLabel, bool? checked, M3EButtonSize size = M3EButtonSize.sm, bool enabled = true, M3EToggleButtonDecoration? decoration, MouseCursor? mouseCursor, WidgetStatesController? statesController, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool> ? onFocusChange, String? semanticLabel, String? tooltip, VoidCallback? onLongPress, ValueChanged<bool> ? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory}) -
An elevated toggle button (medium emphasis with a shadow).
const
-
M3EToggleButton.filled({Key? key, ValueChanged<
bool> ? onCheckedChange, Widget? icon, Widget? checkedIcon, Widget? label, Widget? checkedLabel, bool? checked, M3EButtonSize size = M3EButtonSize.sm, bool enabled = true, M3EToggleButtonDecoration? decoration, MouseCursor? mouseCursor, WidgetStatesController? statesController, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool> ? onFocusChange, String? semanticLabel, String? tooltip, VoidCallback? onLongPress, ValueChanged<bool> ? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory}) -
A filled toggle button (highest emphasis).
const
-
M3EToggleButton.outlined({Key? key, ValueChanged<
bool> ? onCheckedChange, Widget? icon, Widget? checkedIcon, Widget? label, Widget? checkedLabel, bool? checked, M3EButtonSize size = M3EButtonSize.sm, bool enabled = true, M3EToggleButtonDecoration? decoration, MouseCursor? mouseCursor, WidgetStatesController? statesController, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool> ? onFocusChange, String? semanticLabel, String? tooltip, VoidCallback? onLongPress, ValueChanged<bool> ? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory}) -
An outlined toggle button (medium emphasis with a border).
const
-
M3EToggleButton.text({Key? key, ValueChanged<
bool> ? onCheckedChange, Widget? icon, Widget? checkedIcon, Widget? label, Widget? checkedLabel, bool? checked, M3EButtonSize size = M3EButtonSize.sm, bool enabled = true, M3EToggleButtonDecoration? decoration, MouseCursor? mouseCursor, WidgetStatesController? statesController, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool> ? onFocusChange, String? semanticLabel, String? tooltip, VoidCallback? onLongPress, ValueChanged<bool> ? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory}) -
A text toggle button (lowest emphasis).
const
-
M3EToggleButton.tonal({Key? key, ValueChanged<
bool> ? onCheckedChange, Widget? icon, Widget? checkedIcon, Widget? label, Widget? checkedLabel, bool? checked, M3EButtonSize size = M3EButtonSize.sm, bool enabled = true, M3EToggleButtonDecoration? decoration, MouseCursor? mouseCursor, WidgetStatesController? statesController, FocusNode? focusNode, bool autofocus = false, ValueChanged<bool> ? onFocusChange, String? semanticLabel, String? tooltip, VoidCallback? onLongPress, ValueChanged<bool> ? onHover, bool enableFeedback = _kDefaultEnableFeedback, InteractiveInkFeatureFactory? splashFactory}) -
A tonal toggle button (medium emphasis).
const
Properties
- autofocus → bool
-
Whether this button should focus itself on mount.
final
- checked → bool?
-
Current checked state. Null for internal state management.
final
- checkedIcon → Widget?
-
Icon displayed in the checked state. Falls back to icon when null.
final
- checkedLabel → Widget?
-
Label shown when checked. Falls back to label when null.
final
- decoration → M3EToggleButtonDecoration?
-
Optional decoration that bundles styling properties together.
final
-
decorationBackgroundColor
→ WidgetStateProperty<
Color?> ? -
WidgetStateProperty.
no setter
- decorationBorderRadius → double?
-
double.
no setter
-
decorationBorderSide
→ WidgetStateProperty<
BorderSide?> ? -
WidgetStateProperty.
no setter
- decorationCheckedRadius → double?
-
double.
no setter
- decorationConnectedInnerRadius → double?
-
double.
no setter
-
decorationForegroundColor
→ WidgetStateProperty<
Color?> ? -
WidgetStateProperty.
no setter
- decorationHaptic → M3EHapticFeedback
-
M3EHapticFeedback.
no setter
- decorationMotion → M3EButtonMotion?
-
M3EButtonMotion.
no setter
-
decorationOverlayColor
→ WidgetStateProperty<
Color?> ? -
WidgetStateProperty.
no setter
- decorationPressedRadius → double?
-
double.
no setter
-
decorationSurfaceTintColor
→ WidgetStateProperty<
Color?> ? -
WidgetStateProperty.
no setter
- decorationUncheckedRadius → double?
-
double.
no setter
- enabled → bool
-
Whether the toggle button is enabled.
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 in the unchecked state.
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
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → Widget?
-
Optional text label. When set, button is content-width (not square).
final
- mouseCursor → MouseCursor?
-
Optional mouse cursor to show when hovering over the button.
final
-
onCheckedChange
→ ValueChanged<
bool> ? -
Callback fired when the checked state changes.
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
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Accessibility label. Merged on top of the button's own semantics.
final
- size → M3EButtonSize
-
Size variant of the toggle 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 toggle 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< M3EToggleButton> -
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