I want to use '*' instead of '•' in text field.
TextField(
focusNode: _passwordFocusNode,
controller: _passwordController,
obscureText: true,
);
To hide an entered password in a TextField/TextFormField, just set its obscureText property to true. To show the entered password for the user to read it, set obscureText to false. to show/hide password in TextFormField in flutter Here we will use Use TextField/TextFormField.
Use the enabled: property of the TextField widget by setting it to false : TextField( enabled: false, ... ) This field won't respond to onTap events - it is similar to a disabled field in HTML.
obscureText property Null safety bool obscureText. Whether to hide the text being edited (e.g., for passwords). When this is set to true, all the characters in the text field are replaced by obscuringCharacter, and the text in the field cannot be copied with copy or cut.
Now flutter does support this feature for a textfield by setting the obscuringCharacter property, it takes a string strict to 1 character and the obscureText property should be true in order to take this effect
TextField(
obscuringCharacter: '&', // defaults to *
obscureText: true,
)
Flutter currently does not support this feature. Obscuring text is controlled by the property obscureText which takes a boolean expression. As you can see in the docs
When this is set to true, all the characters in the text field are replaced by U+2022 BULLET characters (•).
This issue on GitHub may be of help: https://github.com/flutter/flutter/issues/36377
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With