diff options
author | 2024-01-16 12:02:42 +0100 | |
---|---|---|
committer | 2024-01-16 12:02:42 +0100 | |
commit | 534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0 (patch) | |
tree | 0ddc8f1b681cbade7e47293bd46a362896aa538a /widget/src/lazy | |
parent | 17135cbd56316f31167eb62e026839450506573f (diff) | |
parent | c4ba657de86d7606587dad5124f435141258f570 (diff) | |
download | iced-534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0.tar.gz iced-534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0.tar.bz2 iced-534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0.zip |
Merge branch 'master' into update-winit
Diffstat (limited to 'widget/src/lazy')
-rw-r--r-- | widget/src/lazy/component.rs | 11 | ||||
-rw-r--r-- | widget/src/lazy/helpers.rs | 3 | ||||
-rw-r--r-- | widget/src/lazy/responsive.rs | 11 |
3 files changed, 15 insertions, 10 deletions
diff --git a/widget/src/lazy/component.rs b/widget/src/lazy/component.rs index ad0c3823..3684e0c9 100644 --- a/widget/src/lazy/component.rs +++ b/widget/src/lazy/component.rs @@ -244,12 +244,15 @@ where self.rebuild_element_if_necessary(); } - fn width(&self) -> Length { - self.with_element(|element| element.as_widget().width()) + fn size(&self) -> Size<Length> { + self.with_element(|element| element.as_widget().size()) } - fn height(&self) -> Length { - self.with_element(|element| element.as_widget().height()) + fn size_hint(&self) -> Size<Length> { + Size { + width: Length::Shrink, + height: Length::Shrink, + } } fn layout( diff --git a/widget/src/lazy/helpers.rs b/widget/src/lazy/helpers.rs index 8ca9cb86..5dc60d52 100644 --- a/widget/src/lazy/helpers.rs +++ b/widget/src/lazy/helpers.rs @@ -6,6 +6,7 @@ use std::hash::Hash; /// Creates a new [`Lazy`] widget with the given data `Dependency` and a /// closure that can turn this data into a widget tree. +#[cfg(feature = "lazy")] pub fn lazy<'a, Message, Renderer, Dependency, View>( dependency: Dependency, view: impl Fn(&Dependency) -> View + 'a, @@ -19,6 +20,7 @@ where /// Turns an implementor of [`Component`] into an [`Element`] that can be /// embedded in any application. +#[cfg(feature = "lazy")] pub fn component<'a, C, Message, Renderer>( component: C, ) -> Element<'a, Message, Renderer> @@ -37,6 +39,7 @@ where /// The `view` closure will be provided with the current [`Size`] of /// the [`Responsive`] widget and, therefore, can be used to build the /// contents of the widget in a responsive way. +#[cfg(feature = "lazy")] pub fn responsive<'a, Message, Renderer>( f: impl Fn(Size) -> Element<'a, Message, Renderer> + 'a, ) -> Responsive<'a, Message, Renderer> diff --git a/widget/src/lazy/responsive.rs b/widget/src/lazy/responsive.rs index 86d37b6c..1df0866f 100644 --- a/widget/src/lazy/responsive.rs +++ b/widget/src/lazy/responsive.rs @@ -135,12 +135,11 @@ where }) } - fn width(&self) -> Length { - Length::Fill - } - - fn height(&self) -> Length { - Length::Fill + fn size(&self) -> Size<Length> { + Size { + width: Length::Fill, + height: Length::Fill, + } } fn layout( |