PlaceholderText class
A placeholder text mainly used with ListView when using network request, includes four states: normal, loading, nothing, error.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PlaceholderText
Constructors
- PlaceholderText({Key? key, required Widget childBuilder(BuildContext), required PlaceholderState state, String? errorText, void onRefresh()?, void onRetryForNothing()?, void onRetryForError()?, PlaceholderStateChangedCallback? onChanged, PlaceholderSetting? setting})
-
Creates PlaceholderText with state.
const
- PlaceholderText.from({Key? key, required Widget childBuilder(BuildContext), PlaceholderState? forceState, required bool isEmpty, required bool isLoading, String? errorText, void onRefresh()?, void onRetryForNothing()?, void onRetryForError()?, PlaceholderStateChangedCallback? onChanged, PlaceholderSetting? setting, PlaceholderDisplayRule displayRule = PlaceholderDisplayRule.dataFirst})
-
Creates PlaceholderText with given parameters, this constructor uses given fields and
displayRule
to get the state.const
Properties
- childBuilder → Widget Function(BuildContext)
-
The child builder of this widget.
final
- errorText → String?
-
The current error message, shown when current state is PlaceholderState.error.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onChanged → PlaceholderStateChangedCallback?
-
The callback function when state changed.
final
- onRefresh → (void Function()?)
-
The refresh handler to perform retry logic. Note that this will only be used when
onRetryForNothing or onRetryForError are null.
final
- onRetryForError → (void Function()?)
-
The refresh handler to perform retry logic, for error. If this value is null,
onRefresh will be used instead.
final
- onRetryForNothing → (void Function()?)
-
The refresh handler to perform retry logic, for nothing. If this value is null,
onRefresh will be used instead.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- setting → PlaceholderSetting?
-
The display setting of this widget, defaults to
const PlaceholderSetting()
.final - state → PlaceholderState
-
The current state of this widget.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _PlaceholderTextState -
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}) → 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