username field
This commit is contained in:
parent
aaaada1b23
commit
807d2a87cd
@ -29,27 +29,49 @@ class _LoginPageState extends State<LoginPage> {
|
||||
appBar: AppBar(title: const Text('Welcome')),
|
||||
// https://www.kindacode.com/article/flutter-show-hide-password-in-textfield-textformfield/
|
||||
// https://www.kindacode.com/article/flutter-filteringtextinputformatter/
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Center(
|
||||
child: TextField(
|
||||
obscureText: _isPasswordObscure,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10)
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_isPasswordObscure
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isPasswordObscure = !_isPasswordObscure;
|
||||
});
|
||||
},
|
||||
))),
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
UsernameField(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Center(
|
||||
child: TextField(
|
||||
obscureText: _isPasswordObscure,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_isPasswordObscure
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isPasswordObscure = !_isPasswordObscure;
|
||||
});
|
||||
},
|
||||
))),
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class UsernameField extends StatelessWidget {
|
||||
const UsernameField({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Center(
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Username',
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user