DesignToggleGroup<T> class

A row (or column) of toggles over options.

With multiSelectionEnabled false it is one choice: a screen reader hears a radio group, and a press on the chosen item keeps it unless emptySelectionAllowed. With multiSelectionEnabled true each item toggles on its own.

Tab reaches the group once, at its chosen item (or its first enabled one); the arrows move along it (and wrap), mirrored right to left; Home and End go to its ends; Space and Enter press. selectFollowsFocus chooses as the arrows move, as a segmented control does.

DesignToggleGroup<String>(options: const ['day', 'week'], selected: const {'day'}, onSelectionChanged: (next) {}, itemBuilder: (context, value, states) => Text(value))
Inheritance

Constructors

DesignToggleGroup({Key? key, required List<T> options, required Set<T> selected, required ValueChanged<Set<T>>? onSelectionChanged, required DesignToggleItemBuilder<T> itemBuilder, bool multiSelectionEnabled = false, bool emptySelectionAllowed = false, bool selectFollowsFocus = false, bool isEnabled(T value)?, String labelOf(T value)?, String? semanticLabel, Axis direction = Axis.horizontal, Widget layoutBuilder(BuildContext context, List<Widget> items)?, Size minimumSize = const Size(44, 44)})
A group of options, selected chosen.
const

Properties

direction → Axis
Which way the items run (and which arrows move along them), as SegmentedButton.direction.
final
emptySelectionAllowed → bool
Whether a one-choice group may be left with none.
final
hashCode → int
The hash code for this object.
no setterinherited
isEnabled → bool Function(T value)?
Whether an item can be pressed; null: all can.
final
itemBuilder → DesignToggleItemBuilder<T>
Paints an item.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelOf → String Function(T value)?
What a screen reader calls an item; null: its face's own words.
final
layoutBuilder → Widget Function(BuildContext context, List<Widget> items)?
Lays out the items; null puts them in a row or column at their own size.
final
minimumSize → Size
The smallest an item's target may be.
final
multiSelectionEnabled → bool
Whether any number may be chosen.
final
onSelectionChanged → ValueChanged<Set<T>>?
A press's new choice.
final
options → List<T>
The items, in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selected → Set<T>
The chosen ones.
final
selectFollowsFocus → bool
Whether the arrows choose as they move (one-choice groups).
final
semanticLabel → String?
What a screen reader calls the group.
final

Methods

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