ScreenShakeController class
Per-screen/per-widget-tree shake controller (IDEA-08) — a plain
ChangeNotifier the caller creates and owns (like a TextEditingController),
not a global GetxService singleton, since screen-shake state is local to
whatever's shaking (a board, a card, a whole screen), not app-wide.
offsetAt is a pure, testable seam (mirrors FrameBudgetTracker in
performance_tier_service.dart): given elapsed time since the last
shake call, it returns the current decaying-sine displacement with no
dependency on a live clock/ticker — ScreenShake (the widget below) is
what actually drives it off a real Ticker.
- Inheritance
-
- Object
- ChangeNotifier
- ScreenShakeController
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
offsetAt(
Duration elapsed) → Offset -
Displacement at
elapsedtime since the most recent shake call. Exactly Offset.zero before any shake has ever been triggered, and again onceelapsedreaches_decay(clamped, not asymptotic) — a live-driven ScreenShake uses this to know when it can stop ticking. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
shake(
{double intensity = 12, double frequency = 30, Duration decay = const Duration(milliseconds: 400), Offset? direction}) → void -
Starts (or restarts, discarding any shake already in progress) a
decaying oscillation.
intensityis the max displacement in logical pixels,frequencyin Hz,decayhow long until it fully settles to Offset.zero. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited