KeyPressMotion class final

The animation channels of one key (motion brief §2.2, §4.1, §4.4).

  • press: p, 0 at rest and the press amplitude when held (1 for touch, 0.5 for a physical key). Unbounded, so an underdamped theme spring may overshoot; the painter accepts p outside 0, 1.
  • tint: the pressed state layer, 0–1. Snapped on at touch-down so the first frame already confirms the press; released on the release spring. With Reduce Motion it fades on effectsFast and press jumps.
  • hover: the desktop hover state layer, 0–1 on effectsDefault.
  • hold: long-press progress, 0–1 linearly over holdDuration. The painter shows the radial fill from holdFillDelay.

Every spring is retargeted from the current value and velocity, so a release mid-press turns around smoothly. Release starts no earlier than CalcThemeData.minPress after the press began; callers commit input immediately regardless.

Implemented types

Constructors

KeyPressMotion({required TickerProvider vsync})

Properties

amplitude → double
The amplitude of the current (or last) press.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hold → AnimationController
Long-press progress, 0–1 over holdDuration.
final
holdFill → double
The long-press fill fraction now (holdFillFraction of hold).
no setteroverride
hover → AnimationController
Hover state layer, 0–1.
final
isDown → bool
Whether the key is held (release may still be pending for minPress).
no setter
listenable → Listenable
All channels, for a painter's repaint.
latefinal
press → AnimationController
Press depth p (see class docs).
final
releasePending → bool
Whether a release is waiting for CalcThemeData.minPress.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scale → AnimationController
Press depth for the key's scale (the widget's press transform): the same as press on the way in; on release it follows the family's release spring (M3E 800/0.6, which may overshoot) while press — what painters read for corners and depth — may follow releaseAlt (M3E effectsDefault: corners never bounce; motion brief §2.3).
final
tint → AnimationController
Pressed state layer, 0–1.
final
touchFraction ↔ Offset?
Where the current (or last) touch went down, as a fraction of the key's box; null for physical-key and screen-reader presses (set by the key before down). Liquid Glass lights its glow from here.
getter/setter pairoverride-getter

Methods

completeHold() → void
Shows the long-press fill as complete (the long press fired).
dispose() → void
Releases timers and controllers.
down({required SpringDescription spring, required double lead, double amplitude = 1, bool reduceMotion = false}) → void
Presses the key to amplitude on the spring (pressIn), one lead (seconds) ahead so the first frame moves. Snaps the tint on.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetHold() → void
Clears the long-press fill instantly.
setHovered({required bool hovered}) → void
Fades the hover state layer in or out on effectsDefault.
startHold() → void
Starts the long-press fill from empty.
stopHold() → void
Stops the long-press fill where it is; it fades out with the tint.
toString() → String
A string representation of this object.
inherited
up({required SpringDescription spring, SpringDescription? shapeSpring, bool reduceMotion = false}) → void
Releases the key on the spring (release), no earlier than CalcThemeData.minPress after down. With reduceMotion, p jumps to 0 and the tint fades out on effectsFast.

Operators

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

Static Methods

frameLead(double refreshRate) → double
One frame at refreshRate Hz, in seconds (60 Hz when unknown).
holdFillFraction(double t) → double
Hold fill progress for a hold value t (0–1 over holdDuration): 0 until holdFillDelay, then linear to 1 at holdDuration.

Constants

holdDuration → const Duration
Long-press hold time (motion brief §4.4).
holdFillDelay → const Duration
When the long-press radial fill starts to show (quick taps never see it).
keyboardAmplitude → const double
Amplitude of a press driven by a physical key (motion brief §4.1).
tolerance → const Tolerance
Spring stop tolerance (motion brief §6.2): stops ticking as soon as the motion is invisible, and lands exactly on the target.