EasyRefreshSliverLoadControl 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:
- Let the user draw inside the overscrolled area via the passed in builder.
- Trigger the provided onLoad function when overscrolled far enough to pass loadTriggerPullDistance.
- Continue to hold loadIndicatorExtent amount of space for the builder to keep drawing inside of as the Future returned by onLoad processes.
- Scroll away once the onLoad Future completes.
The builder function will be informed of the current LoadMode when invoking it, except in the LoadMode.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 onLoad 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:
- CustomScrollView, a typical sliver holding scroll view this control should go into.
- developer.apple.com/ios/human-interface-guidelines/controls/refresh-content-controls/
- RefreshIndicator, a Material Design version of the pull-to-refresh paradigm. This widget works differently than RefreshIndicator because instead of being an overlay on top of the scrollable, the EasyRefreshSliverLoadControl is part of the scrollable and actively occupies scrollable space.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- EasyRefreshSliverLoadControl
Constructors
-
EasyRefreshSliverLoadControl({Key? key, double loadTriggerPullDistance = _defaultLoadTriggerPullDistance, double loadIndicatorExtent = _defaultLoadIndicatorExtent, required LoadControlBuilder builder, Duration? completeDuration, OnLoadCallback? onLoad, required ValueNotifier<
bool> focusNotifier, required ValueNotifier<TaskState> taskNotifier, required ValueNotifier<bool> callLoadNotifier, required bool taskIndependence, required ValueNotifier<double> extraExtentNotifier, required BindLoadIndicator bindLoadIndicator, bool enableControlFinishLoad = false, bool enableInfiniteLoad = true, bool enableHapticFeedback = false, bool safeArea = false, EdgeInsets? padding}) -
Create a new refresh control for inserting into a list of slivers.
const
Properties
- bindLoadIndicator → BindLoadIndicator
-
绑定加载指示器
final
- builder → LoadControlBuilder
-
A builder that's called as this sliver's size changes, and as the state
changes.
final
-
callLoadNotifier
→ ValueNotifier<
bool> -
触发加载状态
final
- completeDuration → Duration?
-
完成延时
final
- enableControlFinishLoad → bool
-
是否开启控制结束
final
- enableHapticFeedback → bool
-
开启震动反馈
final
- enableInfiniteLoad → bool
-
是否开启无限加载
final
-
extraExtentNotifier
→ ValueNotifier<
double> -
列表未占满时多余长度
final
-
focusNotifier
→ ValueNotifier<
bool> -
滚动状态
final
-
Footer浮动
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadIndicatorExtent → double
-
The amount of space the refresh indicator sliver will keep holding while
onLoad's Future is still running.
final
- loadTriggerPullDistance → double
-
The amount of overscroll the scrollable must be dragged to trigger a reload.
final
- onLoad → OnLoadCallback?
-
Callback invoked when pulled by loadTriggerPullDistance.
final
- padding → EdgeInsets?
-
内边距(根据布局合理使用,设置后safeArea无效)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- safeArea → bool
-
安全区域
final
- taskIndependence → bool
-
是否任务独立
final
-
taskNotifier
→ ValueNotifier<
TaskState> -
任务状态
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _EasyRefreshSliverLoadControlState -
Retrieve the current state of the EasyRefreshSliverLoadControl. 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, 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