feat: Add on_change input argument to SpinButton
This commit is contained in:
parent
3f88fb98e2
commit
cb77ca1255
3 changed files with 29 additions and 15 deletions
|
|
@ -23,8 +23,11 @@ impl<T: 'static> SpinButtonModel<T>
|
|||
where
|
||||
T: Copy + Hash + ToString + Sub<Output = T> + Add<Output = T> + Ord,
|
||||
{
|
||||
pub fn view(&self) -> Element<'static, SpinMessage> {
|
||||
SpinButton::new(self.value).into_element()
|
||||
pub fn view<Message: 'static>(
|
||||
&self,
|
||||
on_change: impl Fn(SpinMessage) -> Message + 'static,
|
||||
) -> Element<'static, Message> {
|
||||
SpinButton::new(self.value, on_change).into_element()
|
||||
}
|
||||
|
||||
pub fn update(&mut self, message: SpinMessage) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue