Answers for "how to handle password textfield in flutter"

1

flutter textformfield type password

TextFormField(
	obscureText: true,
    
    // Additionally, consider adding these properties to prevent input 
    // suggestions because they risk revealing at least part of the 
    // password input to screen viewers.
    enableSuggestions: false,
    autocorrect: false,
    ...
)
Posted by: Guest on March-12-2021
3

show password in flutter

TextFormField(
   keyboardType: TextInputType.text,
   controller: _userPasswordController,
   obscureText: !_passwordVisible,//This will obscure text dynamically
   decoration: InputDecoration(
       labelText: 'Password',
       hintText: 'Enter your password',
       // Here is key idea
       suffixIcon: IconButton(
            icon: Icon(
              // Based on passwordVisible state choose the icon
               _passwordVisible
               ? Icons.visibility
               : Icons.visibility_off,
               color: Theme.of(context).primaryColorDark,
               ),
            onPressed: () {
               // Update the state i.e. toogle the state of passwordVisible variable
               setState(() {
                   _passwordVisible = !_passwordVisible;
               });
             },
            ),
          ),
        );
Posted by: Guest on May-10-2021

Code answers related to "how to handle password textfield in flutter"

Browse Popular Code Answers by Language