Skip to content

Commit

Permalink
Rename on_change to on_input for TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Apr 12, 2023
1 parent f10e936 commit 9ffd65b
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 213 deletions.
2 changes: 1 addition & 1 deletion examples/component/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod numeric_input {
.as_deref()
.unwrap_or(""),
)
.on_change(Event::InputChanged)
.on_input(Event::InputChanged)
.padding(10),
button("+", Event::IncrementPressed),
]
Expand Down
2 changes: 1 addition & 1 deletion examples/integration_wgpu/src/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl Program for Controls {
)
.push(
text_input("Placeholder", text)
.on_change(Message::TextChanged),
.on_input(Message::TextChanged),
),
),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/lazy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl Sandbox for App {
scrollable(options).height(Length::Fill),
row![
text_input("Add a new option", &self.input)
.on_change(Message::InputChanged)
.on_input(Message::InputChanged)
.on_submit(Message::AddItem(self.input.clone())),
button(text(format!("Toggle Order ({})", self.order)))
.on_press(Message::ToggleOrder)
Expand Down
4 changes: 2 additions & 2 deletions examples/modal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ impl Application for App {
column![
text("Email").size(12),
text_input("abc@123.com", &self.email,)
.on_change(Message::Email)
.on_input(Message::Email)
.on_submit(Message::Submit)
.padding(5),
]
.spacing(5),
column![
text("Password").size(12),
text_input("", &self.password)
.on_change(Message::Password)
.on_input(Message::Password)
.on_submit(Message::Submit)
.password()
.padding(5),
Expand Down
2 changes: 1 addition & 1 deletion examples/qr_code/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Sandbox for QRGenerator {

let input =
text_input("Type the data of your QR code here...", &self.data)
.on_change(Message::DataChanged)
.on_input(Message::DataChanged)
.size(30)
.padding(15);

Expand Down
2 changes: 1 addition & 1 deletion examples/styling/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Sandbox for Styling {
);

let text_input = text_input("Type something...", &self.input_value)
.on_change(Message::InputChanged)
.on_input(Message::InputChanged)
.padding(10)
.size(20);

Expand Down
2 changes: 1 addition & 1 deletion examples/text_input/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Application for Example {
let mut txt_input = text_input(placeholder, &self.data);

if self.text_edit_enabled {
txt_input = txt_input.on_change(Message::TextInputChanged);
txt_input = txt_input.on_input(Message::TextInputChanged);
}

let btn = button("Enable/Disable").on_press(StartTimer);
Expand Down
4 changes: 2 additions & 2 deletions examples/toast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ impl Application for App {
subtitle(
"Title",
text_input("", &self.editing.title)
.on_change(Message::Title)
.on_input(Message::Title)
.on_submit(Message::Add)
.into()
),
subtitle(
"Message",
text_input("", &self.editing.body)
.on_change(Message::Body)
.on_input(Message::Body)
.on_submit(Message::Add)
.into()
),
Expand Down
8 changes: 4 additions & 4 deletions examples/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ impl Application for Todos {
.horizontal_alignment(alignment::Horizontal::Center);

let input = text_input("What needs to be done?", input_value)
.on_change(Message::InputChanged)
.id(INPUT_ID.clone())
.on_input(Message::InputChanged)
.on_submit(Message::CreateTask)
.padding(15)
.size(30)
.on_submit(Message::CreateTask);
.size(30);

let controls = view_controls(tasks, *filter);
let filtered_tasks =
Expand Down Expand Up @@ -375,7 +375,7 @@ impl Task {
let text_input =
text_input("Describe your task...", &self.description)
.id(Self::text_input_id(i))
.on_change(TaskMessage::DescriptionEdited)
.on_input(TaskMessage::DescriptionEdited)
.on_submit(TaskMessage::FinishEdition)
.padding(10);

Expand Down
2 changes: 1 addition & 1 deletion examples/tour/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ impl<'a> Step {
};

let mut text_input = text_input("Type something to continue...", value)
.on_change(StepMessage::InputChanged)
.on_input(StepMessage::InputChanged)
.padding(10)
.size(30);

Expand Down
2 changes: 1 addition & 1 deletion examples/websocket/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Application for WebSocket {

let new_message_input = {
let mut input = text_input("Type a message...", &self.new_message)
.on_change(Message::NewMessageChanged)
.on_input(Message::NewMessageChanged)
.padding(10);

let mut button = button(
Expand Down
Loading

0 comments on commit 9ffd65b

Please sign in to comment.