Ungate responsive from the lazy feature flag

This commit is contained in:
Héctor Ramón Jiménez 2025-08-21 00:07:04 +02:00
parent 6f72ac4650
commit 199a189515
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
6 changed files with 25 additions and 24 deletions

View file

@ -7,4 +7,4 @@ publish = false
[dependencies]
iced.workspace = true
iced.features = ["debug", "lazy"]
iced.features = ["debug"]

View file

@ -6,7 +6,7 @@ use crate::container::{self, Container};
use crate::core;
use crate::core::widget::operation::{self, Operation};
use crate::core::window;
use crate::core::{Element, Length, Pixels, Widget};
use crate::core::{Element, Length, Pixels, Size, Widget};
use crate::float::{self, Float};
use crate::keyed;
use crate::overlay;
@ -25,7 +25,9 @@ use crate::text_input::{self, TextInput};
use crate::toggler::{self, Toggler};
use crate::tooltip::{self, Tooltip};
use crate::vertical_slider::{self, VerticalSlider};
use crate::{Column, Grid, MouseArea, Pin, Row, Sensor, Space, Stack, Themer};
use crate::{
Column, Grid, MouseArea, Pin, Responsive, Row, Sensor, Space, Stack, Themer,
};
use std::borrow::Borrow;
use std::ops::RangeInclusive;
@ -2140,3 +2142,18 @@ where
{
Float::new(content)
}
/// Creates a new [`Responsive`] widget with a closure that produces its
/// contents.
///
/// 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.
pub fn responsive<'a, Message, Theme, Renderer>(
f: impl Fn(Size) -> Element<'a, Message, Theme, Renderer> + 'a,
) -> Responsive<'a, Message, Theme, Renderer>
where
Renderer: core::Renderer,
{
Responsive::new(f)
}

View file

@ -2,11 +2,9 @@
pub(crate) mod helpers;
pub mod component;
pub mod responsive;
#[allow(deprecated)]
pub use component::Component;
pub use responsive::Responsive;
mod cache;

View file

@ -1,10 +1,10 @@
use crate::core::{self, Element, Size};
use crate::core::{self, Element};
use crate::lazy::component;
use std::hash::Hash;
#[allow(deprecated)]
pub use crate::lazy::{Component, Lazy, Responsive};
pub use crate::lazy::{Component, Lazy};
/// Creates a new [`Lazy`] widget with the given data `Dependency` and a
/// closure that can turn this data into a widget tree.
@ -41,19 +41,3 @@ where
{
component::view(component)
}
/// Creates a new [`Responsive`] widget with a closure that produces its
/// contents.
///
/// 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, Theme, Renderer>(
f: impl Fn(Size) -> Element<'a, Message, Theme, Renderer> + 'a,
) -> Responsive<'a, Message, Theme, Renderer>
where
Renderer: core::Renderer,
{
Responsive::new(f)
}

View file

@ -12,6 +12,7 @@ mod action;
mod column;
mod mouse_area;
mod pin;
mod responsive;
mod space;
mod stack;
mod themer;
@ -78,6 +79,8 @@ pub use progress_bar::ProgressBar;
#[doc(no_inline)]
pub use radio::Radio;
#[doc(no_inline)]
pub use responsive::Responsive;
#[doc(no_inline)]
pub use row::Row;
#[doc(no_inline)]
pub use rule::Rule;

View file

@ -14,7 +14,6 @@ use crate::horizontal_space;
///
/// A [`Responsive`] widget will always try to fill all the available space of
/// its parent.
#[cfg(feature = "lazy")]
#[allow(missing_debug_implementations)]
pub struct Responsive<
'a,