diff options
| author | 2023-04-12 04:51:19 +0200 | |
|---|---|---|
| committer | 2023-04-12 04:51:19 +0200 | |
| commit | ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a (patch) | |
| tree | f9be0c6e0d8f9e2af6170f4370677918c4b43a2a /examples/todos/src | |
| parent | ca828f03f5aab9efacc9d63d4149363333035a0c (diff) | |
| parent | 7e7e66586d990788ffd77b17e98357e74252f497 (diff) | |
| download | iced-ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a.tar.gz iced-ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a.tar.bz2 iced-ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a.zip | |
Merge pull request #1744 from JungleTryne/disable-text-input
Add functionality to make `TextInput` disabled 
Diffstat (limited to '')
| -rw-r--r-- | examples/todos/src/main.rs | 29 | 
1 files changed, 12 insertions, 17 deletions
| diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 6361667e..99cdb8f9 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -204,15 +204,12 @@ impl Application for Todos {                      .style(Color::from([0.5, 0.5, 0.5]))                      .horizontal_alignment(alignment::Horizontal::Center); -                let input = text_input( -                    "What needs to be done?", -                    input_value, -                    Message::InputChanged, -                ) -                .id(INPUT_ID.clone()) -                .padding(15) -                .size(30) -                .on_submit(Message::CreateTask); +                let input = text_input("What needs to be done?", input_value) +                    .id(INPUT_ID.clone()) +                    .on_input(Message::InputChanged) +                    .on_submit(Message::CreateTask) +                    .padding(15) +                    .size(30);                  let controls = view_controls(tasks, *filter);                  let filtered_tasks = @@ -375,14 +372,12 @@ impl Task {                  .into()              }              TaskState::Editing => { -                let text_input = text_input( -                    "Describe your task...", -                    &self.description, -                    TaskMessage::DescriptionEdited, -                ) -                .id(Self::text_input_id(i)) -                .on_submit(TaskMessage::FinishEdition) -                .padding(10); +                let text_input = +                    text_input("Describe your task...", &self.description) +                        .id(Self::text_input_id(i)) +                        .on_input(TaskMessage::DescriptionEdited) +                        .on_submit(TaskMessage::FinishEdition) +                        .padding(10);                  row