Switch icon when toggling visibility of secure input

Switch between the eye icon and the icon with a slash through it.
This commit is contained in:
Jason Rodney Hansen 2024-08-05 19:41:45 -06:00
parent 4dd0f72f15
commit a87070f9b1

View file

@ -111,7 +111,7 @@ where
.into(),
)
}
/// Creates a new search [`TextInput`].
/// Creates a new secure [`TextInput`].
///
/// [`TextInput`]: widget::TextInput
pub fn secure_input<'a, Message>(
@ -139,7 +139,11 @@ where
}
if let Some(msg) = on_visible_toggle {
input.trailing_icon(
crate::widget::icon::from_name("document-properties-symbolic")
crate::widget::icon::from_name(if hidden {
"document-properties-symbolic"
} else {
"image-red-eye-symbolic"
})
.size(16)
.apply(crate::widget::button)
.style(crate::theme::Button::Icon)