Remove Id for container, scrollable, and text_input

This commit is contained in:
Héctor Ramón Jiménez 2025-08-23 02:04:30 +02:00
parent 63142d34fc
commit fbe60feb7e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
9 changed files with 68 additions and 179 deletions

View file

@ -41,9 +41,9 @@ impl Example {
Task::none()
}
Message::Scrolled | Message::WindowResized => Task::batch(vec![
container::visible_bounds(OUTER_CONTAINER.clone())
container::visible_bounds(OUTER_CONTAINER)
.map(Message::OuterBoundsFetched),
container::visible_bounds(INNER_CONTAINER.clone())
container::visible_bounds(INNER_CONTAINER)
.map(Message::InnerBoundsFetched),
]),
Message::OuterBoundsFetched(outer_bounds) => {
@ -113,7 +113,7 @@ impl Example {
text("Scroll me!"),
vertical_space().height(400),
container(text("I am the outer container!"))
.id(OUTER_CONTAINER.clone())
.id(OUTER_CONTAINER)
.padding(40)
.style(container::rounded_box),
vertical_space().height(400),
@ -122,7 +122,7 @@ impl Example {
text("Scroll me!"),
vertical_space().height(400),
container(text("I am the inner container!"))
.id(INNER_CONTAINER.clone())
.id(INNER_CONTAINER)
.padding(40)
.style(container::rounded_box),
vertical_space().height(400),
@ -157,9 +157,5 @@ impl Example {
}
}
use std::sync::LazyLock;
static OUTER_CONTAINER: LazyLock<container::Id> =
LazyLock::new(|| container::Id::new("outer"));
static INNER_CONTAINER: LazyLock<container::Id> =
LazyLock::new(|| container::Id::new("inner"));
const OUTER_CONTAINER: &str = "outer";
const INNER_CONTAINER: &str = "inner";