story: Sync number input value when changed (#748)

Closed #741 


https://github.com/user-attachments/assets/ec572918-a574-4adb-a8c0-c59010dc4d5e
This commit is contained in:
Floyd Wang 2025-03-27 11:27:38 +08:00 committed by GitHub
parent 05fea87ec4
commit 26b59ea23e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -263,7 +263,12 @@ impl InputStory {
) {
match event {
NumberInputEvent::Input(input_event) => match input_event {
InputEvent::Change(text) => println!("Change: {}", text),
InputEvent::Change(text) => {
if let Ok(value) = text.parse::<i64>() {
self.number_input1_value = value;
}
println!("Change: {}", text);
}
InputEvent::PressEnter => println!("PressEnter"),
InputEvent::Focus => println!("Focus"),
InputEvent::Blur => println!("Blur"),
@ -294,7 +299,12 @@ impl InputStory {
) {
match event {
NumberInputEvent::Input(input_event) => match input_event {
InputEvent::Change(text) => println!("Change: {}", text),
InputEvent::Change(text) => {
if let Ok(value) = text.parse::<u64>() {
self.number_input2_value = value;
}
println!("Change: {}", text);
}
InputEvent::PressEnter => println!("PressEnter"),
InputEvent::Focus => println!("Focus"),
InputEvent::Blur => println!("Blur"),