EasyRefreshSliverRefreshControl class

A sliver widget implementing the iOS-style pull to refresh content control.

When inserted as the first sliver in a scroll view or behind other slivers that still lets the scrollable overscroll in front of this sliver (such as the CupertinoSliverNavigationBar, this widget will:

The builder function will be informed of the current RefreshMode when invoking it, except in the RefreshMode.inactive state when no space is available and nothing needs to be built. The builder function will otherwise be continuously invoked as the amount of space available changes from overscroll, as the sliver scrolls away after the onRefresh task is done, etc.

Only one refresh can be triggered until the previous refresh has completed and the indicator sliver has retracted at least 90% of the way back.

Can only be used in downward-scrolling vertical lists that overscrolls. In other words, refreshes can't be triggered with lists using ClampingScrollPhysics.

In a typical application, this sliver should be inserted between the app bar sliver such as CupertinoSliverNavigationBar and your main scrollable content's sliver.

See also:

Inheritance

Constructors

EasyRefreshSliverRefreshControl({Key? key, double refreshTriggerPullDistance = _defaultRefreshTriggerPullDistance, double refreshIndicatorExtent = _defaultRefreshIndicatorExtent, required RefreshControlBuilder builder, Duration? completeDuration, OnRefreshCallback? onRefresh, required ValueNotifier<bool> focusNotifier, required ValueNotifier<TaskState> taskNotifier, required ValueNotifier<bool> callRefreshNotifier, required bool taskIndependence, required BindRefreshIndicator bindRefreshIndicator, bool enableControlFinishRefresh = false, bool enableInfiniteRefresh = false, bool enableHapticFeedback = false, bool headerFloat = false})
Create a new refresh control for inserting into a list of slivers.
const

Properties

bindRefreshIndicator BindRefreshIndicator
绑定刷新指示器
final
builder RefreshControlBuilder
A builder that's called as this sliver's size changes, and as the state changes.
final
callRefreshNotifier ValueNotifier<bool>
触发刷新状态
final
completeDuration Duration?
完成延时
final
enableControlFinishRefresh bool
是否开启控制结束
final
enableHapticFeedback bool
开启震动反馈
final
enableInfiniteRefresh bool
是否开启无限刷新
final
focusNotifier ValueNotifier<bool>
滚动状态
final
hashCode int
The hash code for this object.
no setterinherited
headerFloat bool
Header浮动
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onRefresh OnRefreshCallback?
Callback invoked when pulled by refreshTriggerPullDistance.
final
refreshIndicatorExtent double
The amount of space the refresh indicator sliver will keep holding while onRefresh's Future is still running.
final
refreshTriggerPullDistance double
The amount of overscroll the scrollable must be dragged to trigger a reload.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
taskIndependence bool
是否任务独立
final
taskNotifier ValueNotifier<TaskState>
任务状态
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _EasyRefreshSliverRefreshControlState
Retrieve the current state of the EasyRefreshSliverRefreshControl. The same as the state that gets passed into the builder function. Used for testing.
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