NibMotionController class
External handle for driving one or more NibMotion widgets' animations
imperatively — equivalent to Framer Motion's useAnimationControls().
final controller = NibMotionController();
@override
Widget build(BuildContext context) {
return Column(children: [
ElevatedButton(
onPressed: () => controller.start(target: const NibAnim(opacity: 0, y: -20)),
child: const Text('Hide'),
),
NibMotion(
controller: controller,
animate: const NibAnim(opacity: 1, y: 0),
child: MyWidget(),
),
]);
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
A single controller can be attached to multiple NibMotion widgets (by
passing it to each one's controller parameter); every method below
applies to all of them.
- Inheritance
-
- Object
- ChangeNotifier
- NibMotionController
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
-
attach(
NibMotionAnimator animator) → void -
Attaches this controller to
animator. Called by_NibMotionStateduringinitState/didUpdateWidget. -
detach(
NibMotionAnimator animator) → void -
Detaches
animatorfrom this controller. Called by_NibMotionStateduringdispose/didUpdateWidget. -
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
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
repeat(
[bool enabled = true]) → void -
Enables (or, with
enabled: false, disables) NibMotion.repeatAnimationInLoop's ping-pong loop at runtime on every attachedNibMotion, regardless of that widget'srepeatAnimationInLoopvalue. -
sequence(
List< NibMotionSequenceStep> steps) → Future<void> -
Runs
stepsin order, waiting for each step's animation to complete (and its NibMotionSequenceStep.wait, if any) before starting the next. -
set(
NibAnim target) → void -
Immediately sets every attached
NibMotiontotarget, with no animation. -
start(
{NibAnim? target, List< NibKeyframe> ? keyframes, NibTransition? transition}) → Future<void> -
Drives every attached
NibMotion: -
stop(
) → void -
Stops all in-progress animations on every attached
NibMotion, freezing each animated property at its current value. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited