pub struct CustomScrollView<State: 'static> { /* private fields */ }Expand description
A declarative scroll surface over a sequence of slivers. See the module docs.
Implementations§
Source§impl<State: 'static> CustomScrollView<State>
impl<State: 'static> CustomScrollView<State>
Sourcepub fn axis(self, axis: ScrollAxis) -> Self
pub fn axis(self, axis: ScrollAxis) -> Self
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) -> Self
pub fn cache_extent(self, extent: f64) -> Self
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: Fn(&mut State, ScrollInfo) + 'static>(
self,
callback: F,
) -> Self
pub fn on_scroll<F: Fn(&mut State, ScrollInfo) + 'static>( self, callback: F, ) -> Self
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: Fn(&mut State) + 'static>(
self,
callback: F,
) -> Self
pub fn on_refresh_release<F: Fn(&mut State) + 'static>( self, callback: F, ) -> Self
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) -> Self
pub fn physics(self, physics: impl ScrollPhysics + 'static) -> Self
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) -> Self
pub fn overscroll_effect(self, effect: OverscrollEffect) -> Self
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) -> Self
pub fn controller(self, controller: ScrollController) -> Self
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: 'static> View<State> for CustomScrollView<State>
impl<State: 'static> View<State> for CustomScrollView<State>
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: &Self,
element: &mut ViewportWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, 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.