diff options
author | 2019-11-23 20:23:38 +0100 | |
---|---|---|
committer | 2019-11-23 20:23:38 +0100 | |
commit | d0f79d2779d00752eef78cd98b6904cd888d59e3 (patch) | |
tree | 436e757d7b24ae9791dc554d341b38d6646285d3 /web/src/widget/radio.rs | |
parent | 3a678561f2da92e089390ee79bd4f9efc2c1a8c7 (diff) | |
download | iced-d0f79d2779d00752eef78cd98b6904cd888d59e3.tar.gz iced-d0f79d2779d00752eef78cd98b6904cd888d59e3.tar.bz2 iced-d0f79d2779d00752eef78cd98b6904cd888d59e3.zip |
Make `tour` work with `iced_web` again :tada:
- Implements `TextInput`, `Scrollable`, and `Container`
- Adds basic style generation
Diffstat (limited to 'web/src/widget/radio.rs')
-rw-r--r-- | web/src/widget/radio.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/web/src/widget/radio.rs b/web/src/widget/radio.rs index 32532ebe..4e7d02b8 100644 --- a/web/src/widget/radio.rs +++ b/web/src/widget/radio.rs @@ -1,4 +1,4 @@ -use crate::{Bus, Color, Element, Widget}; +use crate::{style, Bus, Color, Element, Widget}; use dodrio::bumpalo; @@ -70,29 +70,31 @@ impl<Message> Radio<Message> { impl<Message> Widget<Message> for Radio<Message> where - Message: 'static + Copy, + Message: 'static + Clone, { fn node<'b>( &self, bump: &'b bumpalo::Bump, bus: &Bus<Message>, + _style_sheet: &mut style::Sheet<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; let radio_label = bumpalo::format!(in bump, "{}", self.label); let event_bus = bus.clone(); - let on_click = self.on_click; + let on_click = self.on_click.clone(); // TODO: Complete styling label(bump) - .attr("style", "display: block") + .attr("style", "display: block; font-size: 20px") .children(vec![ input(bump) .attr("type", "radio") + .attr("style", "margin-right: 10px") .bool_attr("checked", self.is_selected) .on("click", move |root, vdom, _event| { - event_bus.publish(on_click, root); + event_bus.publish(on_click.clone(), root); vdom.schedule_render(); }) @@ -105,7 +107,7 @@ where impl<'a, Message> From<Radio<Message>> for Element<'a, Message> where - Message: 'static + Copy, + Message: 'static + Clone, { fn from(radio: Radio<Message>) -> Element<'a, Message> { Element::new(radio) |