ShimmerWrapper class
The AppShimmer is a versatile widget that provides control over when you want to display the shimmer effect on top of your child widget.
By specifying a widget by itself, the shimmer effect will be rendered on top of it, which can be great for decorative widgets.
This widget is however very useful when combined with a builder widget (such
as RxBlocBuilder
or StreamBuilder
) which can have powerful results.
For example, we can grab data from a stream, check if that data is still loading or has not yet met our conditions and display a placeholder widget while we are still waiting for our data. Once we have our data, we can stop displaying the shimmer effect and render out widget.
AppShimmer(
showShimmer: _showShimmerEffect,
child: _showShimmerEffect ? widgetWithShimmer : targetChildWidget,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ShimmerWrapper
Constructors
- ShimmerWrapper.new({required Widget child, required bool showShimmer, AlignmentGeometry? alignment = Alignment.centerLeft, double radius = 0, bool fadeTransition = true, Color? baseColor, Color? highlightColor, Key? key})
-
const
Properties
- alignment → AlignmentGeometry?
-
The alignment of the content within the widget
final
- baseColor → Color?
-
Base shimmer color
final
- child → Widget
-
The child widget
final
- fadeTransition → bool
-
Use the default fade transition.
If set to
false
, the fade and size transition will be used instead.final - hashCode → int
-
The hash code for this object.
no setterinherited
- highlightColor → Color?
-
Highlight shimmer color
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- radius → double
-
The border radius of the widget
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showShimmer → bool
-
Flag indicating whether or not to display the shimmer effect
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
Constants
- shimmerContainerKey → const Key
- Key used for the Container widget containing the child