CallbackEffect class

Effect that calls a callback function at a particular point in the animation. It includes a boolean value indicating if the animation is playing in reverse. For example:

Text("Hello")
  .animate(onPlay: (controller) => controller.repeat(reverse: true))
  .fadeIn(duration: 600.ms)
  .callback(
    duration: 300.ms,
    callback: (rev) => print('halfway (reverse: $rev)')
  )

NOTE: This should be reliable for time-based animations, but callbacks on an animation that is driven by an Adapter (or manipulated via its controller) may behave unexpectedly in certain circumstances.

Inheritance
Annotations

Constructors

CallbackEffect({Duration? delay, Duration? duration, required ValueChanged<bool> callback})
const

Properties

begin → void
The begin value for the effect. If null, effects should use a reasonable default value when appropriate.
finalinherited
callback ValueChanged<bool>
final
curve Curve?
The specified curve for the effect. If null, will use the curve from the previous effect, or Animate.defaultCurve if this is the first effect.
finalinherited
delay Duration?
The specified delay for the effect. If null, will use the delay from the previous effect, or Duration.zero if this is the first effect.
finalinherited
duration Duration?
The specified duration for the effect. If null, will use the duration from the previous effect, or Animate.defaultDuration if this is the first effect.
finalinherited
end → void
The end value for the effect. If null, effects should use a reasonable default value when appropriate.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context, Widget child, AnimationController controller, EffectEntry entry) Widget
Builds the widgets necessary to implement the effect, based on the provided AnimationController and EffectEntry.
override
buildAnimation(AnimationController controller, EffectEntry entry) Animation<void>
Returns an animation based on the controller, entry, and begin/end values.
inherited
getBeginRatio(AnimationController controller, EffectEntry entry) double
Returns a ratio corresponding to the beginning of the specified entry.
inherited
getEndRatio(AnimationController controller, EffectEntry entry) double
Returns a ratio corresponding to the end of the specified entry.
inherited
getOptimizedBuilder<U>({required ValueListenable<U> animation, Widget? child, required TransitionBuilder builder}) AnimatedBuilder
Returns an optimized AnimatedBuilder that doesn't rebuild if the value hasn't changed.
inherited
getToggleBuilder({required ValueListenable<double> animation, required Widget child, required bool toggle(), required ToggleEffectBuilder builder}) AnimatedBuilder
Returns an AnimatedBuilder that rebuilds when the boolean value returned by the toggle function changes.
inherited
isAnimationActive(Animation animation) bool
Check if the animation is currently running / active.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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