improv(text_input): Switch icon when toggling visibility of secure input
This commit is contained in:
parent
4c04792481
commit
84afe7b50a
1 changed files with 12 additions and 8 deletions
|
|
@ -111,7 +111,7 @@ where
|
||||||
.into(),
|
.into(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/// Creates a new search [`TextInput`].
|
/// Creates a new secure [`TextInput`].
|
||||||
///
|
///
|
||||||
/// [`TextInput`]: widget::TextInput
|
/// [`TextInput`]: widget::TextInput
|
||||||
pub fn secure_input<'a, Message>(
|
pub fn secure_input<'a, Message>(
|
||||||
|
|
@ -139,13 +139,17 @@ where
|
||||||
}
|
}
|
||||||
if let Some(msg) = on_visible_toggle {
|
if let Some(msg) = on_visible_toggle {
|
||||||
input.trailing_icon(
|
input.trailing_icon(
|
||||||
crate::widget::icon::from_name("document-properties-symbolic")
|
crate::widget::icon::from_name(if hidden {
|
||||||
.size(16)
|
"document-properties-symbolic"
|
||||||
.apply(crate::widget::button)
|
} else {
|
||||||
.style(crate::theme::Button::Icon)
|
"image-red-eye-symbolic"
|
||||||
.on_press(msg)
|
})
|
||||||
.padding([spacing, spacing, spacing, spacing])
|
.size(16)
|
||||||
.into(),
|
.apply(crate::widget::button)
|
||||||
|
.style(crate::theme::Button::Icon)
|
||||||
|
.on_press(msg)
|
||||||
|
.padding([spacing, spacing, spacing, spacing])
|
||||||
|
.into(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
input
|
input
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue