From d0f79d2779d00752eef78cd98b6904cd888d59e3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 23 Nov 2019 20:23:38 +0100 Subject: Make `tour` work with `iced_web` again :tada: - Implements `TextInput`, `Scrollable`, and `Container` - Adds basic style generation --- web/src/widget/radio.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'web/src/widget/radio.rs') 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 Radio { impl Widget for Radio where - Message: 'static + Copy, + Message: 'static + Clone, { fn node<'b>( &self, bump: &'b bumpalo::Bump, bus: &Bus, + _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> for Element<'a, Message> where - Message: 'static + Copy, + Message: 'static + Clone, { fn from(radio: Radio) -> Element<'a, Message> { Element::new(radio) -- cgit