pub struct SegmentedControl { /* private fields */ }Expand description
A one-of-N horizontal selector — segments in a rounded track, the selected
one highlighted. on_change(index) fires on tap.
Implementations§
Source§impl SegmentedControl
impl SegmentedControl
pub fn new(segments: Vec<impl Into<String>>, selected: usize) -> Self
pub fn height(self, h: f32) -> Self
pub fn disabled(self) -> Self
Sourcepub fn track_color(self, c: Color) -> Self
pub fn track_color(self, c: Color) -> Self
Track (unselected background) color — theme’s surface_variant if unset.
Sourcepub fn selected_color(self, c: Color) -> Self
pub fn selected_color(self, c: Color) -> Self
Selected pill’s fill color — theme’s primary if unset.
Sourcepub fn selected_text_color(self, c: Color) -> Self
pub fn selected_text_color(self, c: Color) -> Self
Selected label color — theme’s on_primary if unset.
pub fn on_change(self, f: impl Fn(usize) + Send + Sync + 'static) -> Self
Trait Implementations§
Source§impl Widget for SegmentedControl
impl Widget for SegmentedControl
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 children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§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 SegmentedControl
impl !UnwindSafe for SegmentedControl
impl Freeze for SegmentedControl
impl Send for SegmentedControl
impl Sync for SegmentedControl
impl Unpin for SegmentedControl
impl UnsafeUnpin for SegmentedControl
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.