ExpressiveButtonGroup class

A standard button group (Compose ButtonGroup): related buttons in a row, the size's gap apart. Pressing one widens it by expandedRatio of its width and squeezes its neighbours (each by at most ButtonGroupBehavior.compressionLimit) on the group's spatial spring; a quick tap still plays the widening out to ButtonGroupBehavior.releaseThreshold before it springs back.

Every Expressive button, toggle button, icon button and icon toggle button in children joins the squish; another pressable joins by passing pressedHandlerOf as its onPressedChanged.

Inheritance

Constructors

ExpressiveButtonGroup({required List<Widget> children, ExpressiveButtonSize size = ExpressiveButtonSize.small, bool expand = false, List<double>? weights, double expandedRatio = ButtonGroupBehavior.expandedRatio, Key? key})
A button group of children in a row, sized by size.
const

Properties

children → List<Widget>
The buttons, start to end.
final
expand → bool
Share the available width equally between the buttons (Compose's Modifier.weight(1f) on each); otherwise each takes its own width.
final
expandedRatio → double
How much a pressed button widens, as a share of its width.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → ExpressiveButtonSize
The size of the buttons in the group: the gap between them (ButtonGroup*Tokens.BetweenSpace).
final
weights → List<double>?
The buttons' shares of the width (Modifier.weight), 0 for a button that takes its own width; overrides expand.
final

Methods

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

pressedHandlerOf(BuildContext context) → ValueChanged<bool>?
The press callback a pressable inside a group reports to (null outside one): pass it as ExpressivePressable.onPressedChanged.