CNToolbarSegmentedGroup class
A group of segments in the toolbar, such as view modes or filters.
- macOS: an
NSToolbarItemGroupwith a segmented control. - iOS 26+: CNToolbarSelectionMode.selectOne is a
UISegmentedControl; the other modes are toolbar buttons grouped on one Liquid Glass background, toggles for CNToolbarSelectionMode.selectAny.
- Inheritance
-
- Object
- CNToolbarItem
- CNToolbarSegmentedGroup
Constructors
-
CNToolbarSegmentedGroup({String? id, required String label, required List<
CNToolbarSegment> segments, CNToolbarSelectionMode selectionMode = CNToolbarSelectionMode.selectOne, Set<int> selectedIndices = const <int>{}, CNToolbarGroupRole role = CNToolbarGroupRole.automatic, bool enabled = true, bool centered = false, ValueChanged<int> ? onSelected, ValueChanged<Set< ? onSelectionChanged})int> > -
Creates a segmented group.
const
Properties
- centered → bool
-
Whether the group sits in the middle of the window toolbar (macOS
13+).
final
- enabled → bool
-
Whether the group can be used.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
Identifies the item across rebuilds, so a change updates the native
item in place. Unique within a toolbar. Without one, an item is known
by its kind and its position among the items of that kind.
finalinherited
- label → String
-
The name of the group, for VoiceOver and the overflow menu.
final
-
onSelected
→ ValueChanged<
int> ? -
Called with the index of the segment that was clicked, in every mode.
final
-
onSelectionChanged
→ ValueChanged<
Set< ?int> > -
Called with the selection after a click, for
CNToolbarSelectionMode.selectOne and
CNToolbarSelectionMode.selectAny.
final
- role → CNToolbarGroupRole
-
What the group is for (macOS 27).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
segments
→ List<
CNToolbarSegment> -
The segments, in order.
final
-
selectedIndices
→ Set<
int> -
The selected segments. Ignored for CNToolbarSelectionMode.momentary.
final
- selectionMode → CNToolbarSelectionMode
-
How segments are selected.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited