Skip to main content

Module input

Module input 

Source
Expand description

Pure input/gesture helpers (slop constants, input::VelocityTracker, the fling-decay math) re-exported for app authors and advanced widgets.

Structs§

VelocityTracker
A ring of recent (time_ms, position) samples used to estimate the release velocity of a drag for flinging.

Constants§

FLING_DECAY
Per-millisecond exponential fling decay factor (iOS “normal” deceleration): v(t) = v0 · FLING_DECAY.powf(t_ms).
FLING_STOP
Fling stop threshold, in px/s (~0.5 px/frame at 60 Hz): below this speed a fling is finished and the animation stops requesting frames.
MOUSE_SLOP
Mouse drag threshold (kept smaller than TOUCH_SLOP because a mouse is far more precise). Reserved for when events carry an input-kind flag; v1 widgets use TOUCH_SLOP uniformly.
TOUCH_SLOP
Touch drag threshold: how far a contact may move before a press becomes a drag/scroll (Flutter’s tap-vs-drag slop, 18 logical px).
VELOCITY_WINDOW_MS
Trailing window, in milliseconds, over which VelocityTracker estimates velocity — older samples are pruned.
WHEEL_LINE_PX
Logical pixels per wheel line — the constant a LineDelta wheel notch is multiplied by to get a pixel scroll amount (a sane cross-toolkit value).

Functions§

fling_decay
Velocity of v0 after elapsed_ms of exponential fling decay.
fling_displacement
Closed-form displacement (in px) travelled by a fling of initial velocity v0 (px/s) over elapsed_ms milliseconds.