PullToRefresh class
A customizable pull-to-refresh widget that adapts to different platforms.
This widget wraps the platform-appropriate refresh indicator:
- Android: Uses RefreshIndicator (Material Design)
- iOS: Uses CupertinoSliverRefreshControl (Cupertino-style)
- Web/Desktop: Defaults to Material design unless specified.
The user can also specify a custom loading indicator icon.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PullToRefresh
Constructors
-
PullToRefresh({Key? key, Supplier<
void> ? onRefreshed, Supplier<Future< ? onAsyncRefreshed, required Widget child, Color? color, Color? backgroundColor, PullToRefreshType? refreshType, Double displacement = 40.0, Double strokeWidth = 2.0, Double edgeOffset = 0.0, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, String? semanticsLabel, String? semanticsValue, RefreshIndicatorTriggerMode triggerMode = RefreshIndicatorTriggerMode.onEdge, double elevation = 2.0})void> > -
Creates a PullToRefresh widget.
const
-
PullToRefresh.adaptive({Key? key, Supplier<
void> ? onRefreshed, Supplier<Future< ? onAsyncRefreshed, required Widget child, Color? color, Color? backgroundColor, PullToRefreshType? refreshType, Double displacement = 40.0, Double strokeWidth = 2.0, Double edgeOffset = 0.0, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, String? semanticsLabel, String? semanticsValue, RefreshIndicatorTriggerMode triggerMode = RefreshIndicatorTriggerMode.onEdge, double elevation = 2.0})void> > -
Creates an adaptive PullToRefresh widget which renders based on the current platform.
const
-
PullToRefresh.custom({Key? key, Supplier<
void> ? onRefreshed, Supplier<Future< ? onAsyncRefreshed, required Widget child, Color? color, Color? backgroundColor, required Widget? customIndicator, Double displacement = 40.0, Double strokeWidth = 2.0, Double edgeOffset = 0.0, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, String? semanticsLabel, String? semanticsValue, RefreshIndicatorTriggerMode triggerMode = RefreshIndicatorTriggerMode.onEdge, double elevation = 2.0})void> > -
Creates a custom PullToRefresh widget with a fully custom refresh view.
const
Properties
- backgroundColor → Color?
-
The background color of the refresh indicator.
final
- child → Widget
-
The widget to be refreshed.
final
- color → Color?
-
The color of the refresh indicator.
final
- customIndicator → Widget?
-
A custom indicator widget to replace the default ones.
final
- displacement → Double
-
The displacement distance from the top of the scrollable content before triggering the refresh.
final
- edgeOffset → Double
-
The edge offset for where the indicator starts.
final
- elevation → Double
-
Defines the elevation of the underlying RefreshIndicator.
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
-
onAsyncRefreshed
→ Supplier<
Future< ?void> > -
Callback future function triggered when the user pulls to refresh.
final
-
onRefreshed
→ Supplier<
void> ? -
Callback function triggered when the user pulls to refresh.
final
- refreshType → PullToRefreshType?
-
Determines whether to use Material, Cupertino, or a custom refresh view.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String?
-
The SemanticsProperties.label for this progress indicator.
final
- semanticsValue → String?
-
The SemanticsProperties.value for this progress indicator.
final
- strokeWidth → Double
-
The stroke width of the refresh indicator (for Material style).
final
- triggerMode → RefreshIndicatorTriggerMode
-
Defines how this RefreshIndicator can be triggered when users overscroll.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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