ContentPlaceholder class

A widget that creates a placeholder for content.

The ContentPlaceholder widget can be used to create a placeholder for your content while it is being loaded or fetched asynchronously. It can be used with or without a child widget. If a child widget is provided, the placeholder will overlay the child with a shimmer effect, otherwise, it will create a standalone placeholder block.

Inheritance

Constructors

ContentPlaceholder({Key? key, double? width, double? height, BuildContext? context, EdgeInsets spacing = _Styles.defaultSpacing, Color bgColor = _Styles.defaultPlaceholderColor, Color highlightColor = _Styles.defaultPlaceholderHighlight, bool isAnimationEnabled = true, double borderRadius = _Styles.defaultBorderRadius, Widget? child})
Creates a ContentPlaceholder widget.
const

Properties

bgColor Color
The background color of the placeholder block.
final
borderRadius double
The border radius of the placeholder. If not provided, defaults to _Styles.defaultBorderRadius.
final
child Widget?
The child widget that will be overlaid with the placeholder.
final
context BuildContext?
The BuildContext for the placeholder. If not provided, defaults to null.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the placeholder. If not provided, defaults to null.
final
highlightColor Color
The color of the shimmer animation highlight.
final
isAnimationEnabled bool
Specifies whether the shimmer animation is enabled.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spacing EdgeInsets
The spacing around the placeholder.
final
width double?
The width of the placeholder. If not provided, defaults to null.
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}) 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

Static Methods

block({double? width, double? height, required BuildContext context, double topSpacing = 0, double leftSpacing = 0, double rightSpacing = 0, double bottomSpacing = _Styles.defaultSpacingSingle, double borderRadius = _Styles.defaultBorderRadius}) Widget