diff --git a/Cargo.toml b/Cargo.toml index f727ef88..f6885e89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,12 +68,17 @@ chrono = { version = "0.4.26", optional = true } once_cell = { version = "1.18.0", optional = true } itertools = { version = "0.11.0", optional = true } - [dependencies.iced_widget] git = "https://github.com/iced-rs/iced.git" rev = "751ea77c29f6eb3d00f45f0a04c833a1d03a425c" #version = "0.1.1" +#[dependencies.iced_renderer] +#git = "https://github.com/iced-rs/iced.git" +#rev = "751ea77c29f6eb3d00f45f0a04c833a1d03a425c" +#features = ["wgpu"] +#version = "0.1.1" + [profile.dev.package."*"] opt-level = 2 @@ -91,7 +96,7 @@ members = [ "examples/grid", "examples/modal", "examples/modal_component", - #"examples/multiple_modals", + "examples/multiple_modals", "examples/tab_bar", "examples/tabs", "examples/time_picker", diff --git a/src/native/card.rs b/src/native/card.rs index c35a62c1..3a6df0b1 100644 --- a/src/native/card.rs +++ b/src/native/card.rs @@ -595,6 +595,7 @@ where } /// Calculates the layout of the head. +#[allow(clippy::too_many_arguments)] fn head_node( renderer: &Renderer, limits: &Limits, diff --git a/src/native/grid/layout.rs b/src/native/grid/layout.rs index 2ffa8a1d..adbc240e 100644 --- a/src/native/grid/layout.rs +++ b/src/native/grid/layout.rs @@ -89,14 +89,18 @@ fn minimum_row_column_sizes( Renderer: iced_widget::core::Renderer, { let mut children = tree.children.iter_mut(); - for row in rows.iter() { + for row in rows { let mut row_height = 0.0f32; for (col_idx, element) in row.elements.iter().enumerate() { let child_limits = Limits::NONE.width(Length::Shrink).height(Length::Shrink); let Size { width, height } = element .as_widget() - .layout(children.next().unwrap(), renderer, &child_limits) + .layout( + children.next().expect("grid missing expected child"), + renderer, + &child_limits, + ) .size(); #[allow(clippy::option_if_let_else)] @@ -200,7 +204,11 @@ where .max_width(column_width) .max_height(row_height); - let mut node = widget.layout(children.next().unwrap(), renderer, &widget_limits); + let mut node = widget.layout( + children.next().expect("Grid missing child"), + renderer, + &widget_limits, + ); node.move_to(Point::new(x, y)); node.align( horizontal_alignment.into(), diff --git a/src/native/mod.rs b/src/native/mod.rs index 306f4b18..7c496feb 100644 --- a/src/native/mod.rs +++ b/src/native/mod.rs @@ -1,6 +1,7 @@ //! Stateless, pure widgets for iced //use iced_widget::{renderer, style}; pub mod helpers; +#[allow(unused_imports)] pub use helpers::*; pub mod overlay; diff --git a/src/native/number_input.rs b/src/native/number_input.rs index 0135538a..b2440dbf 100644 --- a/src/native/number_input.rs +++ b/src/native/number_input.rs @@ -332,7 +332,7 @@ where ) }; - let mut input_tree = if let Some(child_tree) = tree.children.get_mut(1) { + let input_tree = if let Some(child_tree) = tree.children.get_mut(1) { child_tree.diff(element.as_widget()); child_tree } else { @@ -343,7 +343,7 @@ where let mut modifier = element .as_widget() - .layout(&mut input_tree, renderer, &limits2.loose()); + .layout(input_tree, renderer, &limits2.loose()); let intrinsic = Size::new( content.size().width - 1.0, content.size().height.max(modifier.size().height), diff --git a/src/native/overlay/color_picker.rs b/src/native/overlay/color_picker.rs index cd0e7d01..c096deac 100644 --- a/src/native/overlay/color_picker.rs +++ b/src/native/overlay/color_picker.rs @@ -906,7 +906,7 @@ where .width(Length::Fill) .height(Length::FillPortion(1)), ) - .layout(&mut color_picker.tree, renderer, &block1_limits); + .layout(color_picker.tree, renderer, &block1_limits); block1_node.move_to(Point::new(bounds.x + PADDING, bounds.y + PADDING)); @@ -977,7 +977,7 @@ where ); } let element: Element> = Element::new(rgba_colors); - let mut rgba_tree = if let Some(child_tree) = color_picker.tree.children.get_mut(2) { + let rgba_tree = if let Some(child_tree) = color_picker.tree.children.get_mut(2) { child_tree.diff(element.as_widget()); child_tree } else { @@ -988,7 +988,7 @@ where let mut rgba_colors = element .as_widget() - .layout(&mut rgba_tree, renderer, &block2_limits); + .layout(rgba_tree, renderer, &block2_limits); rgba_colors.move_to(Point::new( rgba_colors.bounds().x + PADDING, diff --git a/src/native/overlay/date_picker.rs b/src/native/overlay/date_picker.rs index c4360473..3b7787f1 100644 --- a/src/native/overlay/date_picker.rs +++ b/src/native/overlay/date_picker.rs @@ -470,7 +470,7 @@ where .push(days); let element: Element> = Element::new(col); - let mut col_tree = if let Some(child_tree) = self.tree.children.get_mut(2) { + let col_tree = if let Some(child_tree) = self.tree.children.get_mut(2) { child_tree.diff(element.as_widget()); child_tree } else { @@ -479,7 +479,7 @@ where &mut self.tree.children[2] }; - let mut col = element.as_widget().layout(&mut col_tree, renderer, &limits); + let mut col = element.as_widget().layout(col_tree, renderer, &limits); col.move_to(Point::new( col.bounds().x + PADDING, col.bounds().y + PADDING, diff --git a/src/native/overlay/floating_element.rs b/src/native/overlay/floating_element.rs index 72e6a10a..fc7c6baf 100644 --- a/src/native/overlay/floating_element.rs +++ b/src/native/overlay/floating_element.rs @@ -64,7 +64,7 @@ where let mut node = self .element .as_widget() - .layout(&mut self.state, renderer, &limits); + .layout(self.state, renderer, &limits); let position = match self.anchor { Anchor::NorthWest => Point::new(position.x + self.offset.x, position.y + self.offset.y), diff --git a/src/native/overlay/modal.rs b/src/native/overlay/modal.rs index da084239..92d5e635 100644 --- a/src/native/overlay/modal.rs +++ b/src/native/overlay/modal.rs @@ -73,7 +73,7 @@ where let mut content = self .content .as_widget() - .layout(&mut self.state, renderer, &limits); + .layout(self.state, renderer, &limits); let max_size = limits.max(); content.align( diff --git a/src/native/overlay/time_picker.rs b/src/native/overlay/time_picker.rs index 46f44a91..3ed42e17 100644 --- a/src/native/overlay/time_picker.rs +++ b/src/native/overlay/time_picker.rs @@ -530,7 +530,7 @@ where let mut clock = Row::<(), Renderer>::new() .width(Length::Fill) .height(Length::Fill) - .layout(&mut self.tree, renderer, &limits); + .layout(self.tree, renderer, &limits); clock.move_to(Point::new( clock.bounds().x + PADDING, diff --git a/src/native/wrap.rs b/src/native/wrap.rs index 43003122..52a7060f 100644 --- a/src/native/wrap.rs +++ b/src/native/wrap.rs @@ -377,9 +377,11 @@ where Size::new(limits.min().width, line_minimal_length), limits.max(), ); - let mut node = - elem.as_widget() - .layout(&mut children.next().unwrap(), renderer, &node_limit); + let mut node = elem.as_widget().layout( + children.next().expect("wrap missing expected child"), + renderer, + &node_limit, + ); let size = node.size(); @@ -462,9 +464,11 @@ where Size::new(line_minimal_length, limits.min().height), limits.max(), ); - let mut node = - elem.as_widget() - .layout(&mut children.next().unwrap(), renderer, &node_limit); + let mut node = elem.as_widget().layout( + children.next().expect("wrap missing expected child"), + renderer, + &node_limit, + ); let size = node.size();