pub struct Slider<'a, T, Message> { /* private fields */ }Expand description
A Material 3 continuous slider with thumb elevation.
Implementations§
Source§impl<'a, T, Message> Slider<'a, T, Message>
impl<'a, T, Message> Slider<'a, T, Message>
Sourcepub fn on_release(self, on_release: Message) -> Self
pub fn on_release(self, on_release: Message) -> Self
Sets the release message.
Sourcepub fn step(self, step: impl Into<T>) -> Self
pub fn step(self, step: impl Into<T>) -> Self
Sets the step size of the slider.
Examples found in repository?
examples/showcase/pages/feedback.rs (line 27)
17fn progress_indicators(state: &Showcase) -> material::Element<'_, Message> {
18 use material::widget::progress_bar::{self, LinearProgressMode, LoadingIndicatorMode};
19
20 let progress = state.progress / 100.0;
21 let linear_phase = state.progress_animation.linear_phase();
22 let loading_phase = state.progress_animation.loading_phase();
23
24 page::dense_stack([
25 page::labeled_value_row("Determinate", format!("{:.0}%", state.progress)).into(),
26 material::widget::slider::continuous(0.0..=100.0, state.progress, Message::SliderChanged)
27 .step(1.0)
28 .into(),
29 progress_bar::linear(LinearProgressMode::determinate(progress, linear_phase)).into(),
30 progress_bar::linear(LinearProgressMode::indeterminate(linear_phase)).into(),
31 page::indicator_row([
32 progress_bar::loading(LoadingIndicatorMode::indeterminate(loading_phase)).into(),
33 progress_bar::loading(LoadingIndicatorMode::contained_indeterminate(loading_phase))
34 .into(),
35 ])
36 .into(),
37 ])
38 .into()
39}Sourcepub fn shift_step(self, shift_step: impl Into<T>) -> Self
pub fn shift_step(self, shift_step: impl Into<T>) -> Self
Sets the optional shift-step size.
Trait Implementations§
Source§impl<'a, T, Message, Renderer> From<Slider<'a, T, Message>> for Element<'a, Message, Theme, Renderer>
impl<'a, T, Message, Renderer> From<Slider<'a, T, Message>> for Element<'a, Message, Theme, Renderer>
Source§impl<'a, T, Message, Renderer> Widget<Message, Theme, Renderer> for Slider<'a, T, Message>
impl<'a, T, Message, Renderer> Widget<Message, Theme, Renderer> for Slider<'a, T, Message>
Source§fn update(
&mut self,
tree: &mut Tree,
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
)
fn update( &mut self, tree: &mut Tree, event: &Event, layout: Layout<'_>, cursor: Cursor, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, _viewport: &Rectangle, )
Source§fn draw(
&self,
_tree: &Tree,
renderer: &mut Renderer,
theme: &Theme,
_style: &Style,
layout: Layout<'_>,
_cursor: Cursor,
_viewport: &Rectangle,
)
fn draw( &self, _tree: &Tree, renderer: &mut Renderer, theme: &Theme, _style: &Style, layout: Layout<'_>, _cursor: Cursor, _viewport: &Rectangle, )
Draws the
Widget using the associated Renderer.Source§fn mouse_interaction(
&self,
tree: &Tree,
layout: Layout<'_>,
cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction
Auto Trait Implementations§
impl<'a, T, Message> !RefUnwindSafe for Slider<'a, T, Message>
impl<'a, T, Message> !Send for Slider<'a, T, Message>
impl<'a, T, Message> !Sync for Slider<'a, T, Message>
impl<'a, T, Message> !UnwindSafe for Slider<'a, T, Message>
impl<'a, T, Message> Freeze for Slider<'a, T, Message>
impl<'a, T, Message> Unpin for Slider<'a, T, Message>
impl<'a, T, Message> UnsafeUnpin for Slider<'a, T, Message>where
RangeInclusive<T>: UnsafeUnpin,
T: UnsafeUnpin,
Option<T>: UnsafeUnpin,
Box<dyn Fn(T) -> Message + 'a>: UnsafeUnpin,
Option<Message>: 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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.