pub struct CustomScrollView<State>where
State: 'static,{ /* private fields */ }Expand description
A declarative scroll surface over a sequence of slivers. See the module docs.
Implementations§
Source§impl<State> CustomScrollView<State>where
State: 'static,
impl<State> CustomScrollView<State>where
State: 'static,
Sourcepub fn axis(self, axis: ScrollAxis) -> CustomScrollView<State>
pub fn axis(self, axis: ScrollAxis) -> CustomScrollView<State>
Scroll along axis — ScrollAxis::Vertical by default. See the
module docs’ Axis.
use frust_core::ScrollAxis;
use frust_widgets::{CustomScrollView, custom_scroll_view, text};
let view: CustomScrollView<()> =
custom_scroll_view((text("a"), text("b"))).axis(ScrollAxis::Horizontal);Sourcepub fn cache_extent(self, extent: f64) -> CustomScrollView<State>
pub fn cache_extent(self, extent: f64) -> CustomScrollView<State>
Lay out children up to extent logical px past each end of the visible
region (DEFAULT_CACHE_EXTENT unless set), so content about to
scroll in is already laid out. A cached child is laid out but not
painted. A negative, NaN or infinite value is treated as 0.0.
Sourcepub fn on_scroll<F>(self, callback: F) -> CustomScrollView<State>
pub fn on_scroll<F>(self, callback: F) -> CustomScrollView<State>
Observe scroll position changes — the same contract as
ScrollView::on_scroll: fired on each
input-driven change, one event late for paint-driven motion, and
flushed on the next frame for a controller jump or tween.
Sourcepub fn on_refresh_release<F>(self, callback: F) -> CustomScrollView<State>where
F: Fn(&mut State) + 'static,
pub fn on_refresh_release<F>(self, callback: F) -> CustomScrollView<State>where
F: Fn(&mut State) + 'static,
The pull-to-refresh trigger — the same contract as
ScrollView::on_refresh_release:
fires on pointer Up when the surface was pulled past its leading edge
by more than the shared trigger distance, never on a Cancel.
Sourcepub fn physics(
self,
physics: impl ScrollPhysics + 'static,
) -> CustomScrollView<State>
pub fn physics( self, physics: impl ScrollPhysics + 'static, ) -> CustomScrollView<State>
Install a custom ScrollPhysics — the same build/rebuild contract as
ScrollView::physics: a view carrying one
reinstalls it every rebuild, a view with none leaves the installed
physics alone, and a fresh build starts at the platform default.
use frust_widgets::{Clamping, CustomScrollView, custom_scroll_view, text};
let view: CustomScrollView<()> = custom_scroll_view(text("a")).physics(Clamping::new());Sourcepub fn overscroll_effect(
self,
effect: OverscrollEffect,
) -> CustomScrollView<State>
pub fn overscroll_effect( self, effect: OverscrollEffect, ) -> CustomScrollView<State>
Select how past-edge pull is visualized — the same contract as
ScrollView::overscroll_effect.
Under OverscrollEffect::Translate the pull moves the slivers (they
are laid out at the out-of-range position); the other two lay them out
at the in-range one.
Sourcepub fn controller(self, controller: ScrollController) -> CustomScrollView<State>
pub fn controller(self, controller: ScrollController) -> CustomScrollView<State>
Attach a ScrollController — the same build/rebuild contract as
ScrollView::controller. Item commands
(ScrollController::scroll_to_item) are list-only and ignored here.
Trait Implementations§
Source§impl<State> View<State> for CustomScrollView<State>where
State: 'static,
impl<State> View<State> for CustomScrollView<State>where
State: 'static,
Source§type Element = ViewportWidget
type Element = ViewportWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> ViewportWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> ViewportWidget
Source§fn rebuild(
&self,
prev: &CustomScrollView<State>,
element: &mut ViewportWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &CustomScrollView<State>, element: &mut ViewportWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for CustomScrollView<State>
impl<State> !Send for CustomScrollView<State>
impl<State> !Sync for CustomScrollView<State>
impl<State> !UnwindSafe for CustomScrollView<State>
impl<State> Freeze for CustomScrollView<State>where
Vec<AnyView<State>>: Freeze,
Option<Rc<dyn Fn(&mut State, ScrollInfo)>>: Freeze,
Option<Rc<dyn Fn(&mut State)>>: Freeze,
impl<State> Unpin for CustomScrollView<State>where
Vec<AnyView<State>>: Unpin,
Option<Rc<dyn Fn(&mut State, ScrollInfo)>>: Unpin,
Option<Rc<dyn Fn(&mut State)>>: Unpin,
impl<State> UnsafeUnpin for CustomScrollView<State>where
Vec<AnyView<State>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, ScrollInfo)>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State)>>: 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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Source§impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
Source§fn extend_views(self, out: &mut Vec<AnyView<State>>)
fn extend_views(self, out: &mut Vec<AnyView<State>>)
out — erasing each
with AnyView::new (a no-op for an element already an AnyView).