BetterSkeletonizer class

像 skeletonizer 一样包裹页面或列表区域,开启后自动以灰色骨架替代原绘制。

组件仍使用 Flutter 原生布局、ListView/Sliver 懒构建与懒绘制机制;未构建或未进入绘制 流程的列表项不会额外生成骨架。

Inheritance

Constructors

BetterSkeletonizer({Key? key, required bool enabled, required Widget child, Color? baseColor, Color lightBaseColor = const Color(0xFFD9DDE3), Color darkBaseColor = const Color(0xFF4B5563), Duration fadeDuration = const Duration(milliseconds: 900), double minOpacity = 0.65, double maxOpacity = 1, BorderRadius textBorderRadius = const BorderRadius.all(Radius.circular(4)), BorderRadius defaultBorderRadius = const BorderRadius.all(Radius.circular(8)), bool ignorePointers = false})
const

Properties

baseColor Color?
自定义骨架颜色。为空时会根据当前主题亮暗模式自动选择颜色。
final
child Widget
final
darkBaseColor Color
深色模式下的默认骨架颜色。
final
defaultBorderRadius BorderRadius
final
enabled bool
final
fadeDuration Duration
final
hashCode int
The hash code for this object.
no setterinherited
ignorePointers bool
enabled 时是否忽略子树手势。
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lightBaseColor Color
浅色模式下的默认骨架颜色。
final
maxOpacity double
final
minOpacity double
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textBorderRadius BorderRadius
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BetterSkeletonizer>
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