KeyLabel class

A one-line key label drawn exactly in style.

A plain Text would force FontWeight.bold on every label under the platform's Bold Text setting, erasing the weight difference between digits and operators; the caller already made style heavier, so Bold Text is switched off for this label only.

Runs of super- and subscripts (⁻¹ in sin⁻¹, ʸ in xʸ) are drawn in CalseeSymbols at the label's weight (span), so a run never mixes fonts. A label wider than the room it is given scales down to fit on one line, and is never scaled up (m7-design §6).

Inheritance

Constructors

KeyLabel(String text, {required TextStyle style, Key? key})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
span → TextSpan
What the label draws: text in style, with each run of super- and subscripts (symbolRuns) in a child span styled symbolRunStyle. A label without such a run is a single span.
no setter
style → TextStyle
Its full style.
final
text → String
The label.
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.
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

Static Methods

fontSizeFor(String label, double shortSide) → double
The label font size on a key whose shorter side is shortSide: 0.4× for one or two characters, 0.3× for three or four, and 0.24× for five or more (m7-design §6), so sinh⁻¹ is 13.4 dp on a 56 dp key, not 16.8.

Constants

backspaceIcon → const IconData
What backspaceText is drawn as. U+232B is in neither bundled font, so as text it fell back to a different system font on every platform (or to a missing-glyph box); the bundled Material icon looks the same everywhere.
backspaceText → const String
The backspace label text (CalcKeys.backspace.label).