ExpressiveSegmentedButton<T> class

The segmented button (Compose's SingleChoiceSegmentedButtonRow): Material 3 Expressive's connected button group, which replaces segmented buttons — two to five toggle buttons joined 2dp apart, the outer corners full and the inner ones small; a press tightens the inner corners and widens the segment, and a selected segment rounds out fully. It picks one: value is the chosen segment's, and each segment is a radio button to assistive technology. ExpressiveMultiChoiceSegmentedButton picks several.

Disabled when onChanged is null.

ExpressiveSegmentedButton<int>(segments: [ExpressiveButtonSegment(0, 'Day'), ExpressiveButtonSegment(1, 'Week')], value: range, onChanged: setRange)
Inheritance

Constructors

ExpressiveSegmentedButton({required List<ExpressiveButtonSegment<T>> segments, required T? value, required ValueChanged<T>? onChanged, ExpressiveToggleButtonKind kind = ExpressiveToggleButtonKind.filled, ExpressiveComponentThemeData? style, ExpressiveButtonSize size = ExpressiveButtonSize.small, bool expand = true, Key? key})
A segmented button of segments with value's segment chosen.
const

Properties

expand → bool
Share the available width equally (Compose's samples weight each segment 1); otherwise each segment takes its own 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
kind → ExpressiveToggleButtonKind
The segments' toggle-button kind.
final
onChanged → ValueChanged<T>?
Told the value of the segment chosen; the button is disabled when null. Choosing the chosen segment again tells nothing.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
segments → List<ExpressiveButtonSegment<T>>
The options, start to end.
final
size → ExpressiveButtonSize
The size (ConnectedButtonGroup*Tokens).
final
style → ExpressiveComponentThemeData?
Stateful visual overrides before the component theme.
final
value → T?
The chosen segment's value; none is chosen when it matches none.
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.
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