ShakeTrigger class abstract
Unified trigger abstraction for shake animations.
ShakeTrigger is a lightweight interface used by ShakeContainer to listen for "shake events".
A shake is an event signal, not a UI state.
This makes it easy to integrate with different architectures, such as:
- ValueListenable / ChangeNotifier
- Stream-based systems (via StreamShakeTrigger)
- GetX / BLoC / Riverpod (through a custom trigger adapter)
Example (Stream)
final controller = StreamController<void>.broadcast();
final trigger = StreamShakeTrigger(controller.stream);
ShakeContainer(
trigger: trigger,
config: ShakePreset.error,
child: const Text('Shake me'),
);
controller.add(null); // triggers shake
Notes:
- Each ShakeContainer should have its own ShakeTrigger.
- You should call dispose to release resources (e.g. stream subscriptions).
- Implemented types
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
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 notifies its listeners.
inherited
-
dispose(
) → void - Disposes any internal resources.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited