WAsyncStateSliver<T> class
把 WAsyncState 渲染成 sliver:
- ready → readySliverBuilder;
- loading / empty / failed(无数据)→ SliverFillRemaining;
- failed + 旧数据 → ready sliver + WAsyncErrorBanner;
- refreshing + 旧数据 → ready sliver;如需额外进度,显式传 refreshingSliverBuilder。默认不添加进度条,避免和 SmartRefresher 自带的刷新指示器重复。
始终返回同一个 SliverMainAxisGroup,避免状态切换重建 ready 子树。
readySliverBuilder 必须返回 sliver(例如 SliverList),不能返回 box。
loading / empty / error 的默认值来自 WAsyncSliverDefaults,
不是 WAsyncViewDefaults;这些 builder 必须返回非滚动内容。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- WAsyncStateSliver
Constructors
-
WAsyncStateSliver({Key? key, required WAsyncState<
T> state, required Widget readySliverBuilder(BuildContext context, T data), required VoidCallback onRetry, WidgetBuilder? loadingBuilder, WidgetBuilder? emptyBuilder, WAsyncErrorWidgetBuilder? errorBuilder, WAsyncErrorWidgetBuilder? errorBannerBuilder, WidgetBuilder? refreshingSliverBuilder, bool hasScrollBody = false}) -
const
Properties
- emptyBuilder → WidgetBuilder?
-
final
- errorBannerBuilder → WAsyncErrorWidgetBuilder?
-
final
- errorBuilder → WAsyncErrorWidgetBuilder?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasScrollBody → bool
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → WidgetBuilder?
-
final
- onRetry → VoidCallback
-
final
- readySliverBuilder → Widget Function(BuildContext context, T data)
-
final
- refreshingSliverBuilder → WidgetBuilder?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ WAsyncState<
T> -
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