Skip to content

Instantly share code, notes, and snippets.

@ashutoshkrris
Created April 30, 2021 11:58
Show Gist options
  • Select an option

  • Save ashutoshkrris/1fb5477905ba3fc862fcd8043a44bc88 to your computer and use it in GitHub Desktop.

Select an option

Save ashutoshkrris/1fb5477905ba3fc862fcd8043a44bc88 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class LoginForm extends StatefulWidget {
@override
_LoginFormState createState() => _LoginFormState();
}
class _LoginFormState extends State<LoginForm> {
bool _isHidden = true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).secondaryHeaderColor,
body: Center(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: TextField(
obscureText: _isHidden,
decoration: InputDecoration(
hintText: 'Password',
suffixIcon: Icon(Icons.visibility), // Add this line
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment