feat(widget): Add SpinButtonModel

Enables convenient handling of spin messages, and specifying steppings, minimum, and maximum values
This commit is contained in:
Michael Aaron Murphy 2022-12-07 03:03:41 +01:00
parent 200784b6c1
commit ef71f7f027
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
7 changed files with 277 additions and 134 deletions

View file

@ -6,11 +6,14 @@ use crate::{Element, Renderer};
/// A setting within a settings view section.
#[must_use]
#[allow(clippy::module_name_repetitions)]
pub fn item<'a, Message: 'static>(title: &'a str, widget: impl Into<Element<'a, Message>>) -> iced::widget::Row<'a, Message, Renderer> {
pub fn item<'a, Message: 'static>(
title: impl ToString,
widget: impl Into<Element<'a, Message>>,
) -> iced::widget::Row<'a, Message, Renderer> {
item_row(vec![
iced::widget::text(title).into(),
iced::widget::horizontal_space(iced::Length::Fill).into(),
widget.into()
widget.into(),
])
}
@ -23,4 +26,3 @@ pub fn item_row<Message>(children: Vec<Element<Message>>) -> iced::widget::Row<M
.padding([0, 8])
.spacing(12)
}