File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,13 @@ class _EmailPasswordLoginPageState extends State<EmailPasswordLoginPage> {
99
99
final GlobalKey <FormFieldState <String >> _emailKey = GlobalKey ();
100
100
final GlobalKey <FormFieldState <String >> _passwordKey = GlobalKey ();
101
101
102
+ bool _obscurePassword = true ;
103
+ void _handlePasswordVisibilityPress () {
104
+ setState (() {
105
+ _obscurePassword = ! _obscurePassword;
106
+ });
107
+ }
108
+
102
109
Future <int > _getUserId (FetchApiKeyResult fetchApiKeyResult) async {
103
110
final FetchApiKeyResult (: email, : apiKey) = fetchApiKeyResult;
104
111
final auth = Auth (
@@ -177,10 +184,14 @@ class _EmailPasswordLoginPageState extends State<EmailPasswordLoginPage> {
177
184
const SizedBox (height: 8 ),
178
185
TextFormField (
179
186
key: _passwordKey,
180
- obscureText: true ,
187
+ obscureText: _obscurePassword ,
181
188
keyboardType: TextInputType .visiblePassword,
182
- decoration: const InputDecoration (
183
- labelText: 'Password' )),
189
+ decoration: InputDecoration (
190
+ labelText: 'Password' ,
191
+ suffixIcon: Semantics (label: 'Hide password' , toggled: _obscurePassword,
192
+ child: IconButton (
193
+ onPressed: _handlePasswordVisibilityPress,
194
+ icon: _obscurePassword ? const Icon (Icons .visibility_off) : const Icon (Icons .visibility))))),
184
195
const SizedBox (height: 8 ),
185
196
ElevatedButton (
186
197
onPressed: _submit,
You can’t perform that action at this time.
0 commit comments