flutter_animate library

Classes

Adapter
Adapters provide a mechanism to drive an animation from an arbitrary source. For example, synchronizing an animation with a scroll, controlling an animation with a slider input, or progressing an animation based on the time of day.
Animate
The Flutter Animate library makes adding beautiful animated effects to your widgets simple. It supports both a declarative and chained API. The latter is exposed via the Widget.animate extension, which simply wraps the widget in Animate.
AnimateList<T extends Widget>
Applies animated effects to a list of widgets. It does this by wrapping each widget in Animate, and then proxying calls to all instances. It can also offset the timing of each widget's animation via interval.
BlurEffect
Effect that animates a blur on the target (via ImageFiltered) between the specified begin and end blur radius values. Defaults to a blur radius of begin=0, end=4.
CallbackEffect
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:
ChangeNotifierAdapter
Drives an Animate animation from a ChangeNotifier. The valueGetter should provide a value in the range 0-1 when a change occurs.
CustomEffect
Provide an easy way to add custom effects via a build method. For example, this would animate custom padding on the target from 0 to 40.
Effect<T>
Class that defines the required interface and helper methods for all effect classes. Look at the various effects for examples of how to build new reusable effects. One-off effects can be implemented with CustomEffect.
EffectEntry
Because Effect classes are immutable and may be reused between multiple Animate (or AnimateList) instances, an EffectEntry is created to store values that may be different between instances. For example, due to AnimateList interval, or from inheriting values from prior effects in the chain.
FadeEffect
Effect that animates the opacity of the target (via FadeTransition) between the specified begin and end values. It defaults to begin=0, end=1.
ListenEffect
Effect that calls a callback function with the current animation value.
MoveEffect
Effect that moves the target (via Transform.translate) between the specified begin and end offsets. Defaults to begin=Offset(0, -16), end=Offset.zero.
SaturateEffect
An effect that animates the color saturation of the target. The begin and end values indicate the saturation level, where 0 is fully desaturated (ie. grayscale) and 1 is normal saturation. Values over 1 will oversaturate.
ScaleEffect
Effect that scales the target (via ScaleTransition) between the specified begin and end values. Defaults to begin=0, end=1.
ScrollAdapter
Drives an Animate animation from a ScrollController.
ShakeEffect
Effect that shakes the target, using translation, rotation, or both. The hz parameter indicates approximately how many times to repeat the shake per second. Defaults to a 5 degree (pi / 36) shake, 12 times per second — equivalent to:
ShimmerEffect
An effect that enables gradient effects, such as the shimmer loading effect popularized by facebook.
SlideEffect
Effect that moves the target based on a fraction of its size (via SlideTransition) based on the specified begin and end offsets. Defaults to begin=Offset(0, -0.5), end=Offset.zero (ie. slide down from half its height).
SwapEffect
Effect that swaps out the incoming child for a new child at a particular point in time. This includes all preceeding effects. For example, this would fade out foo, swap it for Bar() (including discarding the fadeOut effect) and apply a fade in effect.
ThenEffect
A special convenience "effect" that makes it easier to sequence effects after one another. It does this by calculating a new inheritable delay by adding the previous effect's delay, duration and its own optional delay.
TintEffect
An effect that applies an animated color tint to the target. The begin and end values indicate the strength of the tint (0 - no tint, 1 - 100% tint). The default color is opaque black (Color(0xFF000000)). If color has an opacity less than one, that opacity is multiplied against the strength. Ex. Colors.black54 at strength 1 would apply a 54% tint.
ToggleEffect
Effect that allows you to toggle the behavior of a builder function at a certain point in time.
ValueAdapter
Drives an Animate animation directly from a value in the range 0-1
ValueNotifierAdapter
Drives an Animate animation from a ValueNotifier. The value from the notifier should be in the range 0-1.
VisibilityEffect
Effect that toggles the visibility of the target (via Visibility). Defaults to end=true.

Mixins

AnimateManager<T>
Provides a common interface for Animate and AnimateList to attach Effect extensions.

Extensions

AnimateListExtensions on List<Widget>
Wraps the target List<Widget> in a AnimateList instance. Ex. [foo, bar].animate() is equivalent to AnimateList(children: [foo, bar]).
AnimateWidgetExtensions on Widget
Wraps the target Widget in an Animate instance. Ex. myWidget.animate() is equivalent to Animate(child: myWidget).
BlurEffectExtensions on AnimateManager<T>
CallbackEffectExtensions on AnimateManager<T>
CustomEffectExtensions on AnimateManager<T>
EffectExtensions on AnimateManager<T>
FadeEffectExtensions on AnimateManager<T>
ListenEffectExtensions on AnimateManager<T>
MoveEffectExtensions on AnimateManager<T>
NumDurationExtensions on num
Adds extensions to num (ie. int & double) to make creating durations simple:
SaturateEffectExtensions on AnimateManager<T>
ScaleEffectExtensions on AnimateManager<T>
ShakeEffectExtensions on AnimateManager<T>
ShimmerEffectExtensions on AnimateManager<T>
SlideEffectExtensions on AnimateManager<T>
SwapEffectExtensions on AnimateManager<T>
ThenEffectExtensions on AnimateManager<T>
TintEffectExtensions on AnimateManager<T>
ToggleEffectExtensions on AnimateManager<T>
VisibilityEffectExtensions on AnimateManager<T>

Constants

defaultAmount → const double
defaultBlur → const double

Functions

buildSubAnimation(AnimationController controller, Duration begin, Duration end, Curve curve) Animation<double>
Builds a sub-animation to the provided controller that runs from start to end, with the provided curve. For example, it could create an animation that runs from 300ms to 800ms with an easeOut curve, within a controller that has a total duration of 1000ms.

Typedefs

AnimateCallback = void Function(AnimationController controller)
Function signature for Animate callbacks.
CustomEffectBuilder = Widget Function(BuildContext context, double value, Widget child)
ReparentChildBuilder = Widget Function(Widget parent, Widget child)
The builder type used by Animate.reparentTypes. It must accept an existing parent widget, and rebuild it with the provided child. In effect, it clones the provided parent widget with the new child.
ToggleEffectBuilder = Widget Function(BuildContext context, bool value, Widget child)