diff options
| author | 2024-09-18 20:40:17 +0200 | |
|---|---|---|
| committer | 2024-09-18 20:40:17 +0200 | |
| commit | 035d4e37d5a1c818aa134b8c99b31d635a7b8996 (patch) | |
| tree | 50c1cb5fac6bee8738fe69e59ed355150b701cf1 /examples/todos/src | |
| parent | f89744283167a1961fcff512ad48b0eb9b8fcaef (diff) | |
| parent | 1448c5bfa5d0977e54670bb8c640ba186bb13167 (diff) | |
| download | iced-035d4e37d5a1c818aa134b8c99b31d635a7b8996.tar.gz iced-035d4e37d5a1c818aa134b8c99b31d635a7b8996.tar.bz2 iced-035d4e37d5a1c818aa134b8c99b31d635a7b8996.zip | |
Merge pull request #2582 from iced-rs/from-trait-for-text-input-id
Implement some `From` traits for `text_input::Id`
Diffstat (limited to '')
| -rw-r--r-- | examples/todos/src/main.rs | 7 | 
1 files changed, 2 insertions, 5 deletions
| diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index a5f7b36a..25e3ead2 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -6,12 +6,9 @@ use iced::widget::{  use iced::window;  use iced::{Center, Element, Fill, Font, Subscription, Task as Command}; -use once_cell::sync::Lazy;  use serde::{Deserialize, Serialize};  use uuid::Uuid; -static INPUT_ID: Lazy<text_input::Id> = Lazy::new(text_input::Id::unique); -  pub fn main() -> iced::Result {      #[cfg(not(target_arch = "wasm32"))]      tracing_subscriber::fmt::init(); @@ -85,7 +82,7 @@ impl Todos {                      _ => {}                  } -                text_input::focus(INPUT_ID.clone()) +                text_input::focus("new-task")              }              Todos::Loaded(state) => {                  let mut saved = false; @@ -198,7 +195,7 @@ impl Todos {                      .align_x(Center);                  let input = text_input("What needs to be done?", input_value) -                    .id(INPUT_ID.clone()) +                    .id("new-task")                      .on_input(Message::InputChanged)                      .on_submit(Message::CreateTask)                      .padding(15) | 
