DsIcon class

A semantic icon of DsIcons, drawn from the compiled Phosphor assets of this package.

The glyph and its weight come from the token mapping (icon.tokens.json); filled draws the fill form for active and reached states. A glyph with DsGlyph.spins rotates once per motion.duration.pulse, and only in the full motion context; in reduced motion it stands still and no animation controller exists.

An icon is never alone (docs/design/components.md): pass a label for the screen reader, or decorative: true when text next to it already says the same.

Throws an ArgumentError when neither a non-empty label nor decorative is given, in debug and in release builds.

DsIcon(DsIcons.triggerWorking, label: l10n.triggerWorking)
DsIcon(DsIcons.actionPin, decorative: true, filled: pinned)
Inheritance

Constructors

DsIcon(DsGlyph glyph, {Key? key, DsIconSizeRole size = DsIconSizeRole.md, Color? color, String? label, bool decorative = false, bool filled = false})
Creates the icon of glyph.

Properties

color → Color?
The color, or null for color.text.primary.
final
decorative → bool
Whether the icon is excluded from semantics.
final
filled → bool
Whether the fill form is drawn instead of the mapped weight.
final
glyph → DsGlyph
The semantic icon.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String?
The semantics label, or null for a decorative icon.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → DsIconSizeRole
The token size.
final

Methods

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