pub struct RefreshIndicator {Show 14 fields
pub key: Option<KeyRef>,
pub child: WidgetRef,
pub displacement: f64,
pub edge_offset: f64,
pub on_refresh: RefreshCallback,
pub on_status_change: Option<ValueChanged<Option<RefreshIndicatorStatus>>>,
pub color: Option<Color>,
pub background_color: Option<Color>,
pub notification_predicate: ScrollNotificationPredicate,
pub semantics_label: Option<String>,
pub semantics_value: Option<String>,
pub stroke_width: f64,
pub trigger_mode: RefreshIndicatorTriggerMode,
pub elevation: f64,
/* private fields */
}Expand description
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 on_refresh callback is called. The
callback is expected to update the scrollable’s contents and then complete the task it
returns. The refresh indicator disappears after the callback’s task has completed.
The trigger mode is configured by RefreshIndicator::trigger_mode.
§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 physics to AlwaysScrollableScrollPhysics.
See also:
- https://material.io/design/platform-guidance/android-swipe-to-refresh.html
RefreshIndicatorState, which can be used to programmatically show the refresh indicator.
Fields§
§key: Option<KeyRef>§child: WidgetRefThe widget below this widget in the tree.
The refresh indicator will be stacked on top of this child. The indicator will appear when the child’s scrollable descendant is over-scrolled.
displacement: f64The distance from the child’s top or bottom edge_offset where the refresh indicator
will settle.
edge_offset: f64The offset where the refresh indicator starts to appear on drag start.
on_refresh: RefreshCallbackA function that is called when the user has dragged the refresh indicator far enough to demonstrate that they want the app to refresh.
on_status_change: Option<ValueChanged<Option<RefreshIndicatorStatus>>>Called to get the current status of the refresh indicator to update the UI as needed.
Dart declares this on the RefreshIndicator.noSpinner constructor only; here every
constructor shares the field, so any of them can set it (PORTING.md).
color: Option<Color>The progress indicator’s foreground color.
background_color: Option<Color>The progress indicator’s background color.
notification_predicate: ScrollNotificationPredicateWhether a ScrollNotification should be handled by this widget.
semantics_label: Option<String>The progress indicator’s semantics label.
semantics_value: Option<String>The progress indicator’s semantics value.
stroke_width: f64The refresh indicator’s stroke width.
trigger_mode: RefreshIndicatorTriggerModeHow this refresh indicator can be triggered when users overscroll.
elevation: f64The elevation of the underlying refresh indicator.
Implementations§
Source§impl RefreshIndicator
impl RefreshIndicator
Sourcepub fn new<K>(
on_refresh: RefreshCallback,
child: impl IntoWidget<K>,
) -> RefreshIndicator
pub fn new<K>( on_refresh: RefreshCallback, child: impl IntoWidget<K>, ) -> RefreshIndicator
Creates a refresh indicator; Dart’s optional named arguments are the setters.
Sourcepub fn adaptive<K>(
on_refresh: RefreshCallback,
child: impl IntoWidget<K>,
) -> RefreshIndicator
pub fn adaptive<K>( on_refresh: RefreshCallback, child: impl IntoWidget<K>, ) -> RefreshIndicator
Creates an adaptive refresh indicator: a Cupertino activity indicator on iOS and macOS, and a Material one elsewhere.
Sourcepub fn no_spinner<K>(
on_refresh: RefreshCallback,
child: impl IntoWidget<K>,
) -> RefreshIndicator
pub fn no_spinner<K>( on_refresh: RefreshCallback, child: impl IntoWidget<K>, ) -> RefreshIndicator
Creates a refresh indicator with no spinner that calls on_refresh when successfully
armed by a drag event.
Sourcepub fn key(self, key: KeyRef) -> RefreshIndicator
pub fn key(self, key: KeyRef) -> RefreshIndicator
Dart RefreshIndicator(key:).
Sourcepub fn displacement(self, displacement: f64) -> RefreshIndicator
pub fn displacement(self, displacement: f64) -> RefreshIndicator
Dart RefreshIndicator(displacement:).
Sourcepub fn edge_offset(self, edge_offset: f64) -> RefreshIndicator
pub fn edge_offset(self, edge_offset: f64) -> RefreshIndicator
Dart RefreshIndicator(edgeOffset:).
Sourcepub fn on_status_change(
self,
on_status_change: ValueChanged<Option<RefreshIndicatorStatus>>,
) -> RefreshIndicator
pub fn on_status_change( self, on_status_change: ValueChanged<Option<RefreshIndicatorStatus>>, ) -> RefreshIndicator
Dart RefreshIndicator(onStatusChange:).
Sourcepub fn color(self, color: Color) -> RefreshIndicator
pub fn color(self, color: Color) -> RefreshIndicator
Dart RefreshIndicator(color:).
Sourcepub fn background_color(self, background_color: Color) -> RefreshIndicator
pub fn background_color(self, background_color: Color) -> RefreshIndicator
Dart RefreshIndicator(backgroundColor:).
Sourcepub fn notification_predicate(
self,
notification_predicate: ScrollNotificationPredicate,
) -> RefreshIndicator
pub fn notification_predicate( self, notification_predicate: ScrollNotificationPredicate, ) -> RefreshIndicator
Dart RefreshIndicator(notificationPredicate:).
Sourcepub fn semantics_label(
self,
semantics_label: impl Into<String>,
) -> RefreshIndicator
pub fn semantics_label( self, semantics_label: impl Into<String>, ) -> RefreshIndicator
Dart RefreshIndicator(semanticsLabel:).
Sourcepub fn semantics_value(
self,
semantics_value: impl Into<String>,
) -> RefreshIndicator
pub fn semantics_value( self, semantics_value: impl Into<String>, ) -> RefreshIndicator
Dart RefreshIndicator(semanticsValue:).
Sourcepub fn stroke_width(self, stroke_width: f64) -> RefreshIndicator
pub fn stroke_width(self, stroke_width: f64) -> RefreshIndicator
Dart RefreshIndicator(strokeWidth:).
Sourcepub fn trigger_mode(
self,
trigger_mode: RefreshIndicatorTriggerMode,
) -> RefreshIndicator
pub fn trigger_mode( self, trigger_mode: RefreshIndicatorTriggerMode, ) -> RefreshIndicator
Dart RefreshIndicator(triggerMode:).
Sourcepub fn elevation(self, elevation: f64) -> RefreshIndicator
pub fn elevation(self, elevation: f64) -> RefreshIndicator
Dart RefreshIndicator(elevation:).
Trait Implementations§
Source§impl Debug for RefreshIndicator
impl Debug for RefreshIndicator
Source§impl StatefulWidget for RefreshIndicator
impl StatefulWidget for RefreshIndicator
Source§type State = RefreshIndicatorState
type State = RefreshIndicatorState
Source§fn create_state(&self) -> RefreshIndicatorState
fn create_state(&self) -> RefreshIndicatorState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for RefreshIndicator
impl !Send for RefreshIndicator
impl !Sync for RefreshIndicator
impl !UnwindSafe for RefreshIndicator
impl Forget for RefreshIndicator
impl Freeze for RefreshIndicatorwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const RcInner<dyn Fn(&mut App) -> Task<()>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App) -> Task<()>>>: Freeze,
*const RcInner<dyn Fn(&mut App, Option<RefreshIndicatorStatus>)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, Option<RefreshIndicatorStatus>)>>: Freeze,
*const RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl Move for RefreshIndicator
impl Unpin for RefreshIndicator
impl UnsafeUnpin for RefreshIndicatorwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App) -> Task<()>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App) -> Task<()>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, Option<RefreshIndicatorStatus>)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, Option<RefreshIndicatorStatus>)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.