Rename password method in TextInput to secure

This commit is contained in:
Héctor Ramón Jiménez 2024-02-15 02:01:56 +01:00
parent 5827023ccc
commit 9dd20ead08
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 6 additions and 10 deletions

View file

@ -157,7 +157,7 @@ impl Application for App {
text_input("", &self.password) text_input("", &self.password)
.on_input(Message::Password) .on_input(Message::Password)
.on_submit(Message::Submit) .on_submit(Message::Submit)
.password() .secure(true)
.padding(5), .padding(5),
] ]
.spacing(5), .spacing(5),

View file

@ -613,11 +613,7 @@ impl<'a> Step {
Self::container("Text input") Self::container("Text input")
.push("Use a text input to ask for different kinds of information.") .push("Use a text input to ask for different kinds of information.")
.push(if is_secure { .push(text_input.secure(is_secure))
text_input.password()
} else {
text_input
})
.push( .push(
checkbox("Enable password mode", is_secure) checkbox("Enable password mode", is_secure)
.on_toggle(StepMessage::ToggleSecureInput), .on_toggle(StepMessage::ToggleSecureInput),

View file

@ -122,8 +122,8 @@ where
} }
/// Converts the [`TextInput`] into a secure password input. /// Converts the [`TextInput`] into a secure password input.
pub fn password(mut self) -> Self { pub fn secure(mut self, is_secure: bool) -> Self {
self.is_secure = true; self.is_secure = is_secure;
self self
} }
@ -991,9 +991,9 @@ where
} }
return event::Status::Captured; return event::Status::Captured;
} else {
state.is_pasting = None;
} }
state.is_pasting = None;
} }
Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => { Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
let state = state(); let state = state();