pub struct Carousel { /* private fields */ }Expand description
A swipeable page container: every child is one full-width page.
Implementations§
Source§impl Carousel
impl Carousel
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty carousel — add pages with Carousel::child.
Sourcepub fn children(self, ws: Vec<BoxedWidget>) -> Self
pub fn children(self, ws: Vec<BoxedWidget>) -> Self
Append several pages.
Sourcepub fn builder(count: usize, builder: impl Fn(usize) -> BoxedWidget) -> Self
pub fn builder(count: usize, builder: impl Fn(usize) -> BoxedWidget) -> Self
count pages, each built by calling builder(i) — the same
convenience constructor Grid::builder/ListView::builder have, so
callers don’t hand-build a Vec first. Eager, not virtualized (all
count pages build up front).
Sourcepub fn page(self, page: Atom<usize>) -> Self
pub fn page(self, page: Atom<usize>) -> Self
Control the current page from app state: swipes write the new index back to the atom; external writes ease the carousel to that page.
Sourcepub fn height(self, h: f32) -> Self
pub fn height(self, h: f32) -> Self
Fixed height in logical px (default 200.0); width fills the parent.
Sourcepub fn no_indicator(self) -> Self
pub fn no_indicator(self) -> Self
Hide the indicator dots.
Sourcepub fn indicator_color(self, c: Color) -> Self
pub fn indicator_color(self, c: Color) -> Self
Indicator dot tint — defaults to the theme’s primary (active dot);
inactive dots are the same color dimmed.
Trait Implementations§
Source§impl Widget for Carousel
impl Widget for Carousel
Source§fn children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
Measure under
ctx.constraints and return a size within them. Read moreSource§fn flex_factor(&self) -> f32
fn flex_factor(&self) -> f32
Flex weight inside Row/Column. Wrappers are transparent by default.
Auto Trait Implementations§
impl !RefUnwindSafe for Carousel
impl !UnwindSafe for Carousel
impl Freeze for Carousel
impl Send for Carousel
impl Sync for Carousel
impl Unpin for Carousel
impl UnsafeUnpin for Carousel
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
Mutably borrows from an owned value. Read more
Source§impl<W> FocusApi for W
impl<W> FocusApi for W
Source§fn focus_node(self, node: FocusNode) -> WithFocus<Self>
fn focus_node(self, node: FocusNode) -> WithFocus<Self>
Attach a focus node. This enables focus-ring rendering and explicit
neighbor wiring.