pub struct PullToRefresh { /* private fields */ }Expand description
Pull to refresh around caller-owned scrolling content.
The refreshing flag is controlled: Self::on_refresh reports a release
past the threshold, and the caller sets Self::refreshing until its work
is done. The gesture has no keyboard form, so give the screen a visible
refresh control that calls the same handler.
use gpui_kit_material::prelude::*;
let list = PullToRefresh::new("inbox", "Refreshing the inbox")
.indicator(PullToRefreshIndicator::LoadingIndicator)
.on_refresh(|_, _| { /* start the work and set `refreshing` */ });Implementations§
Source§impl PullToRefresh
impl PullToRefresh
Sourcepub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
label names the indicator for assistive technology.
Sourcepub fn refreshing(self, refreshing: bool) -> Self
pub fn refreshing(self, refreshing: bool) -> Self
Whether a refresh is running: the indicator rests at the threshold, spinning, and pulls are ignored.
Sourcepub fn indicator(self, indicator: PullToRefreshIndicator) -> Self
pub fn indicator(self, indicator: PullToRefreshIndicator) -> Self
Which indicator to show.
Sourcepub fn threshold(self, threshold: f32) -> Self
pub fn threshold(self, threshold: f32) -> Self
The distance (dp, after the drag multiplier) a pull must pass.
Sourcepub fn mouse_drag(self, mouse_drag: bool) -> Self
pub fn mouse_drag(self, mouse_drag: bool) -> Self
Whether a mouse drag pulls (on by default).
Sourcepub fn track_scroll(self, scroll: &ScrollHandle) -> Self
pub fn track_scroll(self, scroll: &ScrollHandle) -> Self
The scroll position pulls start from. By default the element keeps its own; pass one to read or move the content’s position.
Sourcepub fn on_refresh(
self,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn on_refresh( self, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Called when a pull is released past the threshold.
Trait Implementations§
Source§impl IntoElement for PullToRefresh
impl IntoElement for PullToRefresh
Source§type Element = ViewElement<PullToRefresh>
type Element = ViewElement<PullToRefresh>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Auto Trait Implementations§
impl !RefUnwindSafe for PullToRefresh
impl !Send for PullToRefresh
impl !Sync for PullToRefresh
impl !UnwindSafe for PullToRefresh
impl Freeze for PullToRefresh
impl Unpin for PullToRefresh
impl UnsafeUnpin for PullToRefresh
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.