CustomShimmer class
A custom shimmer loading animation widget.
Creates a smooth loading placeholder effect with customizable direction, colors, and animation duration. Can either mask a child widget or render a rectangular placeholder.
Example:
// As a placeholder
CustomShimmer(
width: 100,
height: 20,
borderRadius: BorderRadius.circular(4),
)
// As a mask for content
CustomShimmer(
child: MyContentWidget(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomShimmer
Constructors
- CustomShimmer({Key? key, Widget? child, double? width, double? height, BorderRadius? borderRadius, Color baseColor = const Color(0xFFE0E0E0), Color highlightColor = const Color(0xFFF5F5F5), Duration period = const Duration(milliseconds: 1200), ShimmerDirection direction = ShimmerDirection.ltr, double shimmerWidthFraction = 0.25, Curve curve = Curves.easeInOut})
-
const
Properties
- baseColor → Color
-
Base color of the shimmer effect (default: light gray).
final
- borderRadius → BorderRadius?
-
Border radius for the placeholder shape.
final
- child → Widget?
-
The widget to apply the shimmer effect to.
If null, a rectangular placeholder is rendered.
final
- curve → Curve
-
Animation curve for smooth motion (default: easeInOut).
final
- direction → ShimmerDirection
-
Direction of the shimmer animation (default: left to right).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Height of the placeholder (only used if child is null).
final
- highlightColor → Color
-
Highlight color of the shimmer effect (default: lighter gray).
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- period → Duration
-
Duration of one complete shimmer animation cycle (default: 1200ms).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shimmerWidthFraction → double
-
Width of the shimmer highlight as a fraction (0-1, default: 0.25).
final
- width → double?
-
Width of the placeholder (only used if child is null).
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomShimmer> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited