Created
January 8, 2020 09:50
-
-
Save igabice/0a644d794e3200bac01bbd38217f72fb to your computer and use it in GitHub Desktop.
Flutter TextField with password input type and an icon to toggle visibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool _showPassword = false; | |
Widget _buildPasswordTextField() { | |
return TextField( | |
obscureText: !this._showPassword, | |
decoration: InputDecoration( | |
labelText: 'password', | |
prefixIcon: Icon(Icons.security), | |
suffixIcon: IconButton( | |
icon: Icon( | |
Icons.remove_red_eye, | |
color: this._showPassword ? Colors.blue : Colors.grey, | |
), | |
onPressed: () { | |
setState(() => this._showPassword = !this._showPassword); | |
}, | |
), | |
), | |
); | |
} |
Thanks for your help.
Thanks
thanks
Niceee!!
helpful if any one need any help comment i can help.
when i enter password then TextField is set to be empty. Please help me to figure out this problem
when i enter password then TextField is set to be empty. Please help me to figure out this problem
i didnt get your problem can you explain briefly
great one bro thanks alot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice 👍