ShimmerEffect class
An effect that enables gradient effects, such as the shimmer loading effect popularized by facebook.
By default it animates a simple 50% white gradient clipped by the child content. However it provides a large amount of customization, including changing the gradient angle, the gradient colors / stops, and specifying the blend mode.
If colors
is not specified then it will use color
to build one:
[transparent, color, transparent]
.
blendMode
lets you adjust how the gradient fill is composited. It defaults to
BlendMode.srcATop, which layers the fill over the child, using the child's
alpha (ie. the child acts as a mask). Other interesting options include:
- BlendMode.srcIn which uses the child as a mask
- BlendMode.srcOver layers the gradient fill over the child (no masking)
- BlendMode.dstOver layers the gradient fill under the child (no masking)
Note that most blend modes in Flutter do not respect the alpha channel correctly.
Constructors
Properties
- angle → double?
-
final
- begin → double?
-
The begin value for the effect. If null, effects should use a reasonable
default value when appropriate.
finalinherited
- blendMode → BlendMode?
-
final
- color → Color?
-
final
-
colors
→ List<
Color> ? -
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 → double?
-
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
- size → double?
-
final
-
stops
→ List<
double> ? -
final
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< double> -
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
Constants
- defaultAngle → const double
- defaultBlendMode → const BlendMode
- defaultColor → const Color
- defaultSize → const double