ShimmerEffect class
An effect that animates gradient overlay effects (via ShaderMask), such as the shimmer loading effect popularized by facebook.
IMPORTANT: Due to current limitations in Flutter, this effect may cause issues on mobile web when using the HTML renderer. More info can be found here.
NOTE:* By default, this effect adds 0.5px of padding to its target to prevent visual issues, which could effect layout.
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, colors / stops, and a blendMode.
If colors is not specified then it will use color to build one similar to
[transparent, color, transparent]
.
blendMode specifies 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.
padding allows you to expand the area the shimmer applies to. This defaults
to 0.5
, which helps prevent visual issues with ShaderMask
and antialiasing.
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 easing curve for the effect. If null, will inherit the curve from the
previous effect, or use Animate.defaultCurve if this is the first effect.
finalinherited
- delay → Duration?
-
The specified delay for the effect. If null, will inherit the delay from the
previous effect, or use Duration.zero if this is the first effect.
finalinherited
- duration → Duration?
-
The specified duration for the effect. If null, will inherit the duration from the
previous effect, or use 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
- padding → double?
-
final
- 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 that implement the effect on the target
child
, 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
- defaultPadding → const double
- defaultSize → const double