Implement Checkbox in iced_pure

This commit is contained in:
Héctor Ramón Jiménez 2022-02-12 14:26:17 +07:00
parent dee3dba632
commit 178914ec23
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
3 changed files with 97 additions and 2 deletions

View file

@ -36,7 +36,7 @@ pub use iced_style::checkbox::{Style, StyleSheet};
#[allow(missing_debug_implementations)]
pub struct Checkbox<'a, Message, Renderer: text::Renderer> {
is_checked: bool,
on_toggle: Box<dyn Fn(bool) -> Message>,
on_toggle: Box<dyn Fn(bool) -> Message + 'a>,
label: String,
width: Length,
size: u16,
@ -63,7 +63,7 @@ impl<'a, Message, Renderer: text::Renderer> Checkbox<'a, Message, Renderer> {
/// `Message`.
pub fn new<F>(is_checked: bool, label: impl Into<String>, f: F) -> Self
where
F: 'static + Fn(bool) -> Message,
F: 'a + Fn(bool) -> Message,
{
Checkbox {
is_checked,