CNToolbarButton class
A toolbar button: an icon or a text label, with an optional badge.
label names the button for VoiceOver, for the overflow menu when the window is too narrow, and under the icon in the CNToolbarStyle.expanded style. A button without an icon shows the label as its title.
- Inheritance
-
- Object
- CNToolbarItem
- CNToolbarButton
Constructors
- CNToolbarButton({String? id, required String label, CNSymbol? icon, IconData? customIcon, CNImageAsset? imageAsset, String? tooltip, bool enabled = true, CNToolbarBadge? badge, CNToolbarItemStyle style = CNToolbarItemStyle.plain, Color? tint, bool centered = false, VoidCallback? onPressed})
-
Creates a toolbar button.
const
Properties
- badge → CNToolbarBadge?
-
A badge on the button (macOS 26+, iOS 27+).
final
- centered → bool
-
Whether the button sits in the middle of the window toolbar (macOS
13+).
final
- customIcon → IconData?
-
An icon font glyph shown on the button, rendered by Flutter.
final
- enabled → bool
-
Whether the button can be pressed.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → CNSymbol?
-
SF Symbol shown on the button. The toolbar sizes it; its colour and
rendering mode are kept. Priority: imageAsset > customIcon >
icon.
final
- 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
- imageAsset → CNImageAsset?
-
An image (PNG, JPG or SVG asset, or bytes) shown on the button. A
single-colour image without a colour takes the toolbar's colour, as a
symbol does.
final
-
Whether the button navigates, as Back and Forward do. macOS puts
navigation items at the leading edge, next to the window title.
final
- label → String
-
The name of the button (see the class documentation).
final
- onPressed → VoidCallback?
-
Called when the button is pressed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → CNToolbarItemStyle
-
CNToolbarItemStyle.prominent tints the button (macOS 26+, iOS 26+).
final
- tint → Color?
-
Colour of a CNToolbarItemStyle.prominent button. On iOS it colours a
plain button's icon and title too.
final
- tooltip → String?
-
Help text shown when the pointer rests on the button (macOS).
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