RetroKeyFace class final

Retro keycap renderer for one theme. A same-family theme change lerps travel, corners, skirt tones and bevel strengths (LerpableKeyFace).

Inheritance
Implemented types

Constructors

RetroKeyFace({required double travel, required Color digitSkirt, required Color operatorSkirt, required Color equalsSkirt, required Color functionSkirt, double cornerFraction = 0.15, Color highlight = const Color(0x8CFFFFFF), Color shade = const Color(0x47000000), Color shadowColor = const Color(0x47000000), bool slashedZero = false, RetroKeyFace? layoutBase})
const

Properties

cornerFraction → double
Cap corner radius as a fraction of its short side (0–0.5).
final
digitSkirt → Color
Skirt (side) colour per key group.
final
equalsSkirt → Color
final
functionSkirt → Color
final
hashCode → int
The hash code for this object.
no setteroverride
highlight → Color
Bevel highlight (translucent white).
final
layoutBase → RetroKeyFace?
For an in-between face of a theme morph: the end it is closer to.
final
layoutFace → KeyFaceRenderer
The renderer that decides the key's widgets (label, label layer): itself, or for an in-between face of a theme morph the end it is closer to. Compared by CalcThemeData.sameLayout.
no setteroverride
operatorSkirt → Color
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shade → Color
Bevel shade (translucent black).
final
shadowColor → Color
Contact shadow under the key.
final
slashedZero → bool
Draw 0 with a slash (fonts that support zero).
finalinherited
travel → double
Key travel d in dp (the visible skirt band at rest).
final

Methods

capRect(Size size, double p) → Rect
The cap rectangle at press p in a box of size. p may overshoot a little on the bouncy release (1200/0.7): the cap rises ≤ 0.1 dp.
label(String text, TextStyle style) → Widget
The label widget for text in style (already sized, coloured and weighted, Bold Text included). Not scaled by the text scaler: the key size bounds it.
inherited
labelLayer(KeyFaceMotion motion, KeyFaceSpec spec, Widget label) → Widget
The label rides on the cap: centred on it at rest, travelling down.
override
lerpTo(KeyFaceRenderer other, double t) → KeyFaceRenderer
This face t of the way to other (t may exceed 1 slightly: the shape rubber-band to 1.06). other's layoutFace has this face's renderer type.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
painter(KeyFaceMotion motion, KeyFaceSpec spec) → CustomPainter
The painter behind the label: fill, state layers, long-press fill. It should repaint from motion's listenable without rebuilds.
override
prepare(Iterable<Size> cellSizes) → void
Builds whatever the painter would otherwise build lazily (key-shape morphs) for keys of cellSizes, ahead of a theme commit: called on keypad layout and when a theme enters the prefetch queue. The default does nothing.
inherited
prepareLerp(KeyFaceRenderer other, Iterable<Size> cellSizes) → void
Nothing to build ahead: keycaps are drawn from rects.
override
skirtFor(KeyRole role) → Color
The skirt colour for role.
toString() → String
A string representation of this object.
inherited
travelFor(Size size) → double
Travel usable in a box of size (at most a sixth of the short side).

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

bevelFor(Size size) → double
Bevel band thickness for a cap of size.
bevelSwapped({required double press, required double tint, bool reduceMotion = false}) → bool
Whether the bevel is swapped (pressed artwork) for press / tint: from the touch-down frame (tint snapped to 1) until the release passes p < 0.5; under Reduce Motion whenever the key is down.