Fix password visibility icon state

This commit is contained in:
Joe Julian
2026-04-08 08:40:00 -07:00
parent 36c6687168
commit 4f9792d027
2 changed files with 30 additions and 6 deletions
+8 -6
View File
@@ -7320,12 +7320,7 @@ func (u *ui) passwordLine(label, value string) layout.Widget {
}
func (u *ui) inlinePasswordToggle(gtx layout.Context, click *widget.Clickable, showing bool) layout.Dimensions {
icon := u.eyeIcon
desc := "Show password"
if showing {
icon = u.eyeOffIcon
desc = "Hide password"
}
icon, desc := u.passwordTogglePresentation(showing)
btn := material.IconButton(u.theme, click, icon, desc)
btn.Background = color.NRGBA{R: 239, G: 236, B: 229, A: 255}
btn.Color = accentColor
@@ -7334,6 +7329,13 @@ func (u *ui) inlinePasswordToggle(gtx layout.Context, click *widget.Clickable, s
return btn.Layout(gtx)
}
func (u *ui) passwordTogglePresentation(showing bool) (*widget.Icon, string) {
if showing {
return u.eyeIcon, "Hide password"
}
return u.eyeOffIcon, "Show password"
}
func (u *ui) detailPasswordValue() string {
item, ok := u.selectedEntry()
if !ok {