RefreshIndicator 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.

If the Scrollable might not have enough content to overscroll, consider settings its physics property to AlwaysScrollableScrollPhysics:

  physics: const AlwaysScrollableScrollPhysics(),
  children: ...

Using AlwaysScrollableScrollPhysics will ensure that the scroll view is always scrollable and, therefore, can trigger the RefreshIndicator.

A RefreshIndicator can only be used with a vertical scroll view.

See also:



RefreshIndicator({Key key, @required Widget child, double displacement: 40.0, @required RefreshCallback onRefresh, Color color, Color backgroundColor, ScrollNotificationPredicate notificationPredicate: defaultScrollNotificationPredicate })
Creates a refresh indicator. [...]


backgroundColor Color
The progress indicator's background color. The current theme's ThemeData.canvasColor by default.
child Widget
The widget below this widget in the tree. [...]
color Color
The progress indicator's foreground color. The current theme's ThemeData.accentColor by default.
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.
notificationPredicate ScrollNotificationPredicate
A check that specifies whether a ScrollNotification should be handled by this widget. [...]
onRefresh 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.
hashCode → int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


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. [...]
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by toStringDeep. [...]
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) → String
Returns a string representation of this object.
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug }) → String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug }) → String
Returns a one-line detailed description of the object. [...]
toStringShort() → String
A short, textual description of this widget.


operator ==(dynamic other) → bool
The equality operator. [...]