MultiPull class
A widget that supports the Material "swipe to refresh" idiom.
When the child's Scrollable descendant overscrolls, an animated circular
progress indicator is faded into view. When the scroll ends, if the
indicator has been dragged far enough for it to become completely opaque,
the onRefresh
callback is called. The callback is expected to update the
scrollable's contents and then complete the Future it returns. The refresh
indicator disappears after the callback's Future has completed.
Troubleshooting
Refresh indicator does not show up
The RefreshIndicator will appear if its scrollable descendant can be overscrolled, i.e. if the scrollable's content is bigger than its viewport. To ensure that the RefreshIndicator will always appear, even if the scrollable's content fits within its viewport, set the scrollable's Scrollable.physics property to AlwaysScrollableScrollPhysics:
ListView(
physics: const AlwaysScrollableScrollPhysics(),
children: ...
)
A RefreshIndicator can only be used with a vertical scroll view.
See also:
- material.io/design/platform-guidance/android-swipe-to-refresh.html
- RefreshIndicatorState, can be used to programmatically show the refresh indicator.
- RefreshProgressIndicator, widget used by RefreshIndicator to show the inner circular progress spinner during refreshes.
- CupertinoSliverRefreshControl, an iOS equivalent of the pull-to-refresh pattern. Must be used as a sliver inside a CustomScrollView instead of wrapping around a ScrollView because it's a part of the scrollable instead of being overlaid on top of it.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MultiPull
Constructors
-
MultiPull({Key? key, required Widget child, double displacement = 40.0, required List<
PullIndicator> pullIndicators, CircleIndicator circleIndicator = const DefaultCircle(), Duration? circleMoveDuration, Curve circleMoveCurve = Curves.easeIn, Color? refreshColor, Color? refreshBackgroundColor, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, String? semanticsLabel, String? semanticsValue, double strokeWidth = 2.0}) -
Creates a refresh indicator.
const
Properties
- child → Widget
-
The widget below this widget in the tree.
final
- circleIndicator → CircleIndicator
-
final
- circleMoveCurve → Curve
-
final
- circleMoveDuration → Duration?
-
final
- displacement → double
-
The distance from the child's top or bottom edge to where the refresh
indicator will settle. During the drag that exposes the refresh indicator,
its actual displacement may significantly exceed this value.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- notificationPredicate → ScrollNotificationPredicate
-
A check that specifies whether a ScrollNotification should be
handled by this widget.
final
-
pullIndicators
→ List<
PullIndicator> -
final
- refreshBackgroundColor → Color?
-
The progress indicator's background color. The current theme's
ThemeData.canvasColor by default.
final
- refreshColor → Color?
-
The progress indicator's foreground color. The current theme's
ThemeData.accentColor
by default.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String?
-
This will be defaulted to MaterialLocalizations.refreshIndicatorSemanticLabel
if it is null.
final
- semanticsValue → String?
-
final
- strokeWidth → double
-
Defines
strokeWidth
forRefreshIndicator
.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → MultiPullState -
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