diff options
author | 2023-02-04 12:24:13 +0100 | |
---|---|---|
committer | 2023-02-17 15:40:17 +0100 | |
commit | 7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd (patch) | |
tree | ac9aac5eb82f175990da17813985d2f864897080 /native/src/widget/toggler.rs | |
parent | f75e0202575ca6e3ebf7d817eecbf51e198506fd (diff) | |
download | iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.tar.gz iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.tar.bz2 iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.zip |
Use `f32` in `Length::Units` and rename it to `Fixed`
Diffstat (limited to 'native/src/widget/toggler.rs')
-rw-r--r-- | native/src/widget/toggler.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/native/src/widget/toggler.rs b/native/src/widget/toggler.rs index f0a944a3..13d0124d 100644 --- a/native/src/widget/toggler.rs +++ b/native/src/widget/toggler.rs @@ -38,7 +38,7 @@ where on_toggle: Box<dyn Fn(bool) -> Message + 'a>, label: Option<String>, width: Length, - size: u16, + size: f32, text_size: Option<u16>, text_alignment: alignment::Horizontal, spacing: u16, @@ -52,7 +52,7 @@ where Renderer::Theme: StyleSheet, { /// The default size of a [`Toggler`]. - pub const DEFAULT_SIZE: u16 = 20; + pub const DEFAULT_SIZE: f32 = 20.0; /// Creates a new [`Toggler`]. /// @@ -85,14 +85,14 @@ where } /// Sets the size of the [`Toggler`]. - pub fn size(mut self, size: u16) -> Self { + pub fn size(mut self, size: f32) -> Self { self.size = size; self } /// Sets the width of the [`Toggler`]. - pub fn width(mut self, width: Length) -> Self { - self.width = width; + pub fn width(mut self, width: impl Into<Length>) -> Self { + self.width = width.into(); self } @@ -169,11 +169,7 @@ where ); } - row = row.push( - Row::new() - .width(Length::Units(2 * self.size)) - .height(Length::Units(self.size)), - ); + row = row.push(Row::new().width(2.0 * self.size).height(self.size)); row.layout(renderer, limits) } |