Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a Password input type in flutter makes the password user input is not visible , just like Android Native EditText 's inputtype:password?

i meet a problem that Flutter 's TextInputType do not have a password type:

/// All possible enum values.  static const List<TextInputType> values = const <TextInputType>[   text, multiline, number, phone, datetime, emailAddress, url, ]; 

how to make the password user input not visible? any one has a good idea ?

like image 512
naivor Avatar asked Aug 31 '18 08:08

naivor


People also ask

How do I make my password on Flutter not visible?

Input filed and password input fields are the same except for one arguments (obscureText). obscureText: This argument gives us the power to hide the data entered in the input field. The default of this is false, which makes it visible to us. If we make this true, the actual text will be invisible.

How do you put a password on Flutter?

You need to pass "true" on "obscureText" property in TextField to enable Password input.

How do you enter an input type password?

The <input> tag with a type="password" attribute creates a text field where users can securily enter a password. As characters are entered, they are replaced by a dot ("•") or asterisk ("*") symbol, depending on the browser.


1 Answers

In case you are using the TextField widget (or something that derives from this widget), you can use the obscureText property and set it to true. More details can be found here.

Additionally, consider adding these properties to prevent input suggestions because they risk revealing at least part of the password input to screen viewers.

obscureText: true, enableSuggestions: false, autocorrect: false, 
like image 175
Maurits van Beusekom Avatar answered Sep 20 '22 03:09

Maurits van Beusekom