Implement pure::Responsive in iced_lazy
This commit is contained in:
parent
9fd66c820d
commit
b50e208f31
3 changed files with 398 additions and 3 deletions
|
|
@ -1 +1,31 @@
|
|||
pub mod component;
|
||||
mod component;
|
||||
mod responsive;
|
||||
|
||||
pub use component::Component;
|
||||
pub use responsive::Responsive;
|
||||
|
||||
use iced_native::Size;
|
||||
use iced_pure::Element;
|
||||
|
||||
/// Turns an implementor of [`Component`] into an [`Element`] that can be
|
||||
/// embedded in any application.
|
||||
pub fn component<'a, C, Message, Renderer>(
|
||||
component: C,
|
||||
) -> Element<'a, Message, Renderer>
|
||||
where
|
||||
C: Component<Message, Renderer> + 'a,
|
||||
C::State: 'static,
|
||||
Message: 'a,
|
||||
Renderer: iced_native::Renderer + 'a,
|
||||
{
|
||||
component::view(component)
|
||||
}
|
||||
|
||||
pub fn responsive<'a, Message, Renderer>(
|
||||
f: impl Fn(Size) -> Element<'a, Message, Renderer> + 'a,
|
||||
) -> Responsive<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: iced_native::Renderer,
|
||||
{
|
||||
Responsive::new(f)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue