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/radio.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/radio.rs')
-rw-r--r-- | native/src/widget/radio.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs index b95ccc5b..22aeb4ce 100644 --- a/native/src/widget/radio.rs +++ b/native/src/widget/radio.rs @@ -50,7 +50,7 @@ where on_click: Message, label: String, width: Length, - size: u16, + size: f32, spacing: u16, text_size: Option<u16>, font: Renderer::Font, @@ -64,7 +64,7 @@ where Renderer::Theme: StyleSheet, { /// The default size of a [`Radio`] button. - pub const DEFAULT_SIZE: u16 = 28; + pub const DEFAULT_SIZE: f32 = 28.0; /// The default spacing of a [`Radio`] button. pub const DEFAULT_SPACING: u16 = 15; @@ -101,14 +101,14 @@ where } /// Sets the size of the [`Radio`] button. - 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 [`Radio`] button. - 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 } @@ -163,11 +163,7 @@ where .width(self.width) .spacing(self.spacing) .align_items(Alignment::Center) - .push( - Row::new() - .width(Length::Units(self.size)) - .height(Length::Units(self.size)), - ) + .push(Row::new().width(self.size).height(self.size)) .push(Text::new(&self.label).width(self.width).size( self.text_size.unwrap_or_else(|| renderer.default_size()), )) |