username field

This commit is contained in:
Specoolazius 2021-11-15 13:26:13 +01:00
parent aaaada1b23
commit 807d2a87cd

View File

@ -29,7 +29,10 @@ class _LoginPageState extends State<LoginPage> {
appBar: AppBar(title: const Text('Welcome')), appBar: AppBar(title: const Text('Welcome')),
// https://www.kindacode.com/article/flutter-show-hide-password-in-textfield-textformfield/ // https://www.kindacode.com/article/flutter-show-hide-password-in-textfield-textformfield/
// https://www.kindacode.com/article/flutter-filteringtextinputformatter/ // https://www.kindacode.com/article/flutter-filteringtextinputformatter/
body: Padding( body: ListView(
children: <Widget>[
UsernameField(),
Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Center( child: Center(
child: TextField( child: TextField(
@ -37,8 +40,7 @@ class _LoginPageState extends State<LoginPage> {
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Password', hintText: 'Password',
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10) borderRadius: BorderRadius.circular(10)),
),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon(_isPasswordObscure icon: Icon(_isPasswordObscure
? Icons.visibility ? Icons.visibility
@ -50,6 +52,26 @@ class _LoginPageState extends State<LoginPage> {
}, },
))), ))),
), ),
)
],
)); ));
} }
} }
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)),
)),
),
);
}
}