PullToRefreshController class

A standard controller that can initiate the refreshing of a scroll view’s contents. This should be used whenever the user can refresh the contents of a WebView via a vertical swipe gesture.

All the methods should be called only when the WebView has been created or is already running (for example PlatformWebViewCreationParams.onWebViewCreated or PlatformInAppBrowserEvents.onBrowserCreated).

NOTE for Android: to be able to use the "pull-to-refresh" feature, InAppWebViewSettings.useHybridComposition must be true.

Officially Supported Platforms/Implementations:

  • Android native WebView
  • iOS

Constructors

PullToRefreshController({void onRefresh()?, @Deprecated("Use settings instead") PullToRefreshOptions? options, PullToRefreshSettings? settings})
A standard controller that can initiate the refreshing of a scroll view’s contents. This should be used whenever the user can refresh the contents of a WebView via a vertical swipe gesture.
PullToRefreshController.fromPlatform({required PlatformPullToRefreshController platform})
Constructs a PullToRefreshController from a specific platform implementation.
PullToRefreshController.fromPlatformCreationParams({required PlatformPullToRefreshControllerCreationParams params})
Constructs a PullToRefreshController.

Properties

hashCode int
The hash code for this object.
no setterinherited
onRefresh → (void Function()?)
Event called when a swipe gesture triggers a refresh.
no setter
options PullToRefreshOptions
Use settings instead.
no setter
platform PlatformPullToRefreshController
Implementation of PlatformPullToRefreshController for the current platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
settings PullToRefreshSettings
Initial settings.
no setter

Methods

beginRefreshing() Future<void>
Tells the controller that a refresh operation was started programmatically.
dispose({bool isKeepAlive = false}) → void
Disposes the controller.
endRefreshing() Future<void>
Tells the controller that a refresh operation has ended.
getDefaultSlingshotDistance() Future<int>
Gets the default distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture.
isEnabled() Future<bool>
Returns true is pull-to-refresh feature is enabled, otherwise false.
isRefreshing() Future<bool>
Returns whether a refresh operation has been triggered and is in progress.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAttributedTitle(IOSNSAttributedString attributedTitle) Future<void>
Use setStyledTitle instead.
setBackgroundColor(Color color) Future<void>
Sets the background color of the refresh control.
setColor(Color color) Future<void>
Sets the color of the refresh control.
setDistanceToTriggerSync(int distanceToTriggerSync) Future<void>
Set the distance to trigger a sync in dips.
setEnabled(bool enabled) Future<void>
Sets whether the pull-to-refresh feature is enabled or not.
setIndicatorSize(PullToRefreshSize size) Future<void>
Sets the size of the refresh indicator. One of PullToRefreshSize.DEFAULT, or PullToRefreshSize.LARGE.
setSize(AndroidPullToRefreshSize size) Future<void>
Use setIndicatorSize instead.
setSlingshotDistance(int slingshotDistance) Future<void>
Sets the distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture.
setStyledTitle(AttributedString attributedTitle) Future<void>
Sets the styled title text to display in the refresh control.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited