From d39ad717ed0ab85acbe935d7ab883166b36e7bc7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Oct 2021 19:06:53 +0700 Subject: Wire up styling to `Radio` in `iced_native` --- web/src/widget/radio.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'web/src/widget') diff --git a/web/src/widget/radio.rs b/web/src/widget/radio.rs index fbc88d29..5e9eaa3f 100644 --- a/web/src/widget/radio.rs +++ b/web/src/widget/radio.rs @@ -31,17 +31,17 @@ use dodrio::bumpalo; /// /// ![Radio buttons drawn by Coffee's renderer](https://github.com/hecrj/coffee/blob/bda9818f823dfcb8a7ad0ff4940b4d4b387b5208/images/ui/radio.png?raw=true) #[allow(missing_debug_implementations)] -pub struct Radio { +pub struct Radio<'a, Message> { is_selected: bool, on_click: Message, label: String, id: Option, name: Option, #[allow(dead_code)] - style: Box, + style_sheet: &'a dyn StyleSheet, } -impl Radio { +impl<'a, Message> Radio<'a, Message> { /// Creates a new [`Radio`] button. /// /// It expects: @@ -66,13 +66,13 @@ impl Radio { label: label.into(), id: None, name: None, - style: Default::default(), + style_sheet: Default::default(), } } /// Sets the style of the [`Radio`] button. - pub fn style(mut self, style: impl Into>) -> Self { - self.style = style.into(); + pub fn style(mut self, style_sheet: &'a dyn StyleSheet) -> Self { + self.style_sheet = style_sheet; self } @@ -89,7 +89,7 @@ impl Radio { } } -impl Widget for Radio +impl<'a, Message> Widget for Radio<'a, Message> where Message: 'static + Clone, { @@ -142,11 +142,11 @@ where } } -impl<'a, Message> From> for Element<'a, Message> +impl<'a, Message> From> for Element<'a, Message> where Message: 'static + Clone, { - fn from(radio: Radio) -> Element<'a, Message> { + fn from(radio: Radio<'a, Message>) -> Element<'a, Message> { Element::new(radio) } } -- cgit