M3EButtonGroup class

A row (or column) of selectable M3EButtons with standard or connected layout, optional neighbour squish, and overflow handling.

All actions render as M3EButton. Use M3EButtonGroupAction.minWidth for icon-only resting widths. Standard groups use size-token between-space; connected groups use a 2dp gap and span their surface.

Selection:

Inheritance

Constructors

M3EButtonGroup({Key? key, required List<M3EButtonGroupAction> actions, M3EButtonGroupType type = M3EButtonGroupType.standard, M3EButtonShape shape = M3EButtonShape.round, M3EButtonSize size = M3EButtonSize.sm, M3EButtonStyle style = M3EButtonStyle.filled, M3EButtonGroupDensity density = M3EButtonGroupDensity.regular, double? spacing, Axis direction = Axis.horizontal, int? selectedIndex, Set<int>? selectedIndices, ValueChanged<int?>? onSelectedIndexChanged, ValueChanged<Set<int>>? onSelectedIndicesChanged, bool multiSelect = false, bool selectionRequired = false, bool neighborSquish = true, double expandedRatio = 0.15, M3EHapticFeedback haptic = M3EHapticFeedback.none, bool enableFeedback = true, M3EButtonDecoration? decoration, String? semanticLabel, Clip clipBehavior = Clip.none, M3EButtonGroupOverflow overflow = M3EButtonGroupOverflow.scroll, Widget? overflowIcon, M3EOverflowPopupDecoration overflowPopupDecoration = const M3EOverflowPopupDecoration(), M3EOverflowBottomSheetDecoration overflowBottomSheetDecoration = const M3EOverflowBottomSheetDecoration(), M3EButtonGroupOverflowMenuStyle overflowMenuStyle = M3EButtonGroupOverflowMenuStyle.popup, M3EOverflowStrategy? overflowStrategy})
Creates a button group.
const

Properties

actions → List<M3EButtonGroupAction>
Actions rendered as group buttons.
final
clipBehavior → Clip
Clip behavior for the group bounds.
final
decoration → M3EButtonDecoration?
Group-level decoration merged under each action's decoration.
final
density → M3EButtonGroupDensity
Density level (0…−3) that shrinks container height.
final
direction → Axis
Main layout axis.
final
enableFeedback → bool
Whether actions play platform feedback by default.
final
expandedRatio → double
Pressed width growth ratio for neighbour squish (default 0.15).
final
haptic → M3EHapticFeedback
Haptic feedback policy for presses.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
multiSelect → bool
When true, taps toggle membership in selectedIndices (multi-select).
final
neighborSquish → bool
Whether pressing an action squishes neighbours (standard horizontal only).
final
onSelectedIndexChanged → ValueChanged<int?>?
Called when single-select selection changes.
final
onSelectedIndicesChanged → ValueChanged<Set<int>>?
Called when multi-select selection changes.
final
overflow → M3EButtonGroupOverflow
Built-in overflow strategy when overflowStrategy is null.
final
overflowBottomSheetDecoration → M3EOverflowBottomSheetDecoration
Decoration for the overflow bottom sheet.
final
overflowIcon → Widget?
Icon for the overflow menu / paging trigger.
final
overflowMenuStyle → M3EButtonGroupOverflowMenuStyle
Popup vs bottom sheet for M3EButtonGroupOverflow.menu.
final
overflowPopupDecoration → M3EOverflowPopupDecoration
Decoration for the overflow popup menu.
final
overflowStrategy → M3EOverflowStrategy?
Custom overflow strategy; overrides overflow when non-null.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedIndex → int?
Controlled single-select index; pair with onSelectedIndexChanged.
final
selectedIndices → Set<int>?
Controlled multi-select indices; pair with onSelectedIndicesChanged.
final
selectionRequired → bool
When true, the last selected action cannot be cleared.
final
semanticLabel → String?
Semantics label for the group container (optional).
final
shape → M3EButtonShape
Default corner strategy for actions (round or square).
final
size → M3EButtonSize
Size token applied uniformly to every action.
final
spacing → double?
Optional between-space override; defaults to size / connection tokens.
final
style → M3EButtonStyle
Visual style applied uniformly to every action.
final
type → M3EButtonGroupType
Standard (gapped) or connected (joined) layout.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<M3EButtonGroup>
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