Draft float widget and simplify image again 🎉

This commit is contained in:
Héctor Ramón Jiménez 2025-04-29 22:31:58 +02:00
parent 8ba993adad
commit fae95d6095
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
29 changed files with 463 additions and 305 deletions

View file

@ -7,6 +7,7 @@ use crate::core;
use crate::core::widget::operation::{self, Operation};
use crate::core::window;
use crate::core::{Element, Length, Pixels, Widget};
use crate::float::{self, Float};
use crate::keyed;
use crate::overlay;
use crate::pane_grid::{self, PaneGrid};
@ -692,7 +693,7 @@ where
fn overlay<'b>(
&'b mut self,
state: &'b mut core::widget::Tree,
layout: core::Layout<'_>,
layout: core::Layout<'b>,
renderer: &Renderer,
viewport: &Rectangle,
translation: core::Vector,
@ -948,7 +949,7 @@ where
fn overlay<'b>(
&'b mut self,
tree: &'b mut core::widget::Tree,
layout: core::Layout<'_>,
layout: core::Layout<'b>,
renderer: &Renderer,
viewport: &Rectangle,
translation: core::Vector,
@ -1848,12 +1849,7 @@ where
/// ```
/// <img src="https://github.com/iced-rs/iced/blob/9712b319bb7a32848001b96bd84977430f14b623/examples/resources/ferris.png?raw=true" width="300">
#[cfg(feature = "image")]
pub fn image<'a, Handle, Theme>(
handle: impl Into<Handle>,
) -> crate::Image<'a, Handle, Theme>
where
Theme: crate::image::Catalog,
{
pub fn image<Handle>(handle: impl Into<Handle>) -> crate::Image<Handle> {
crate::Image::new(handle.into())
}
@ -2127,3 +2123,14 @@ where
{
PaneGrid::new(state, view)
}
/// Creates a new [`Float`] widget with the given content.
pub fn float<'a, Message, Theme, Renderer>(
content: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> Float<'a, Message, Theme, Renderer>
where
Theme: float::Catalog,
Renderer: core::Renderer,
{
Float::new(content)
}