summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/modal/src/main.rs2
-rw-r--r--examples/tour/src/main.rs6
-rw-r--r--widget/src/text_input.rs8
3 files changed, 6 insertions, 10 deletions
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs
index 6fe951ee..1dac0075 100644
--- a/examples/modal/src/main.rs
+++ b/examples/modal/src/main.rs
@@ -157,7 +157,7 @@ impl Application for App {
text_input("", &self.password)
.on_input(Message::Password)
.on_submit(Message::Submit)
- .password()
+ .secure(true)
.padding(5),
]
.spacing(5),
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 6d24b5ec..15d37896 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -613,11 +613,7 @@ impl<'a> Step {
Self::container("Text input")
.push("Use a text input to ask for different kinds of information.")
- .push(if is_secure {
- text_input.password()
- } else {
- text_input
- })
+ .push(text_input.secure(is_secure))
.push(
checkbox("Enable password mode", is_secure)
.on_toggle(StepMessage::ToggleSecureInput),
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index f5b57422..72ed1ef3 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -122,8 +122,8 @@ where
}
/// Converts the [`TextInput`] into a secure password input.
- pub fn password(mut self) -> Self {
- self.is_secure = true;
+ pub fn secure(mut self, is_secure: bool) -> Self {
+ self.is_secure = is_secure;
self
}
@@ -991,9 +991,9 @@ where
}
return event::Status::Captured;
- } else {
- state.is_pasting = None;
}
+
+ state.is_pasting = None;
}
Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
let state = state();