M3eKeyFace class

M3 Expressive key renderer for one theme.

Implements LerpableKeyFace: a same-family theme change morphs each key's resting outline into the next theme's through a cached FlatMorph (prepareLerp builds them ahead), following the transition's shape progress — including its rubber-band past 1.

Inheritance
Implemented types
Implementers

Constructors

M3eKeyFace({required KeyGeometry restShape, KeyGeometry? operatorShape, int pressedCornerPermille = 300, bool rowSquish = false, bool slashedZero = false, KeyShapeCache? cache})
const

Properties

cache → KeyShapeCache?
Shape cache (null = KeyShapeCache.instance).
final
hashCode → int
The hash code for this object.
no setteroverride
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 setterinherited
operatorShape → KeyGeometry?
Resting outline of operator and = keys (a non-colour cue); null = restShape.
final
pressedCornerPermille → int
Pressed corner radius (fraction of the short side × 1000; brief: 300).
final
pressedShape → KeyGeometry
The pressed outline (same for every role).
no setter
restShape → KeyGeometry
Resting outline of digit and function keys.
final
rowSquish → bool
Row-neighbour squish (brief: 10 % of key width, "tune"). Reserved: off by default and not drawn yet (it needs keypad-level layout).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
slashedZero → bool
Draw 0 with a slash (fonts that support zero).
finalinherited

Methods

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
Places label on the face for the press (NeoPOP moves it with the face). Must follow motion by repainting, never by rebuilding. The default leaves it centred.
inherited
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
morphFor(KeyRole role, Size size) → KeyMorph
The morph for role at size (cache lookup; builds on a miss).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outlineInto(Path path, KeyRole role, Size size, double t) → void
Resets path to role's outline at press progress t (clamped, see M3eKeyPainter.morphProgress) in unit-square space.
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 every role's morph for keys of each of cellSizes ahead of time (keypad layout and theme prefetch), so no frame ever constructs a Morph.
override
prepareLerp(KeyFaceRenderer other, Iterable<Size> cellSizes) → void
Builds what lerpTo faces toward other will paint (shape morphs) for keys of cellSizes, ahead of the transition.
override
restFor(KeyRole role) → KeyGeometry
Resting outline for role.
toString() → String
A string representation of this object.
inherited

Operators

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