A widget that supports the Material "swipe to refresh" idiom.

When the child's vertical 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 refresh 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.

The required scrollableKey parameter identifies the scrollable widget whose scrollOffset is monitored by this RefreshIndicator. The same scrollableKey must also be set on the scrollable. See Block.scrollableKey, ScrollableList.scrollableKey, etc.

See also:

Inheritance

Constructors

RefreshIndicator({Key key, GlobalKey<ScrollableState> scrollableKey, Widget child, double displacement: 40.0, RefreshCallback refresh, RefreshIndicatorLocation location: RefreshIndicatorLocation.top, Color color, Color backgroundColor })

Creates a refresh indicator.

Properties

backgroundColor Color

The progress indicator's background color. The current theme's ThemeData.canvasColor by default.

read-only
child Widget

The refresh indicator will be stacked on top of this child. The indicator will appear when child's Scrollable descendant is over-scrolled.

read-only
color Color

The progress indicator's foreground color. The current theme's ThemeData.accentColor by default.

read-only
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.

read-only
location RefreshIndicatorLocation

Where the refresh indicator should appear, RefreshIndicatorLocation.top by default.

read-only
refresh RefreshCallback

A function that's called when the user has dragged the refresh indicator far enough to demonstrate that they want the app to refresh. The returned Future must complete when the refresh operation is finished.

read-only
scrollableKey GlobalKey<ScrollableState>

Identifies the Scrollable descendant of child that will cause the refresh indicator to appear.

read-only
hashCode int

Get a hash code for this object.

read-only, inherited
key Key

Controls how one widget replaces another widget in the tree.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

createState() RefreshIndicatorState

Creates the mutable state for this widget at a given location in the tree.

createElement() StatefulElement

Creates a StatefulElement to manage this widget's location in the tree.

inherited
debugFillDescription(List<String> description) → void

Add additional information to the given description for use by toString.

inherited
noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() String

Returns a string representation of this object.

inherited
toStringShort() String

A short, textual description of this widget.

inherited