Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ========SHOW / HIDE PASSWORD METHOD ========
- bool _showPassword = false;
- void _togglevisibility() {
- setState(() {
- _showPassword = !_showPassword;
- });
- }
- // ==========PASSWORD BUTTON CODE =========
- Padding(
- padding:
- const EdgeInsets.fromLTRB(12.0, 8.0, 12.0, 8.0),
- child: Material(
- color: Colors.white.withOpacity(0.5),
- borderRadius: BorderRadius.circular(20.0),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 10.0),
- child: TextFormField(
- controller: _passwordController,
- obscureText: !_showPassword,
- cursorColor: Colors.red,
- style: TextStyle(color: Colors.white),
- decoration: InputDecoration(
- hintText: "Password",
- border: InputBorder.none,
- suffixIcon: GestureDetector(
- onTap: () {
- _togglevisibility();
- },
- child: Icon(
- _showPassword ? Icons.visibility : Icons
- .visibility_off, color: Colors.red,),
- ),
- ),
- ),
- ),
- ),
- ),
Add Comment
Please, Sign In to add comment