Skip to content

Commit 5eee261

Browse files
committed
fix: (a11y) add tooltip to toggle icon
1 parent a5a0462 commit 5eee261

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/src/components/_supa_password_field.dart

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,18 @@ class _SupaPasswordFieldState extends State<SupaPasswordField> {
5858
decoration: InputDecoration(
5959
prefixIcon: widget.prefixIcon,
6060
label: Text(widget.labelText),
61-
suffixIcon: IconButton(
62-
icon: Icon(
63-
_obscureText ? Icons.visibility_off : Icons.visibility,
61+
suffixIcon: Tooltip(
62+
message: _obscureText ? 'Show password' : 'Hide password',
63+
child: IconButton(
64+
icon: Icon(
65+
_obscureText ? Icons.visibility_off : Icons.visibility,
66+
),
67+
onPressed: () {
68+
setState(() {
69+
_obscureText = !_obscureText;
70+
});
71+
},
6472
),
65-
onPressed: () {
66-
setState(() {
67-
_obscureText = !_obscureText;
68-
});
69-
},
7073
),
7174
),
7275
);

0 commit comments

Comments
 (0)