created homescreen with password input

This commit is contained in:
Specoolazius 2021-10-18 15:01:12 +02:00
parent c602e3ce8c
commit aaaada1b23

View File

@ -1,12 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter_noise/main.dart';
void main() => runApp(const LoginPage());
void main() => runApp(MyApp());
// ToDo: remove when done: currently only for testing purposes
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Noise!',
home: LoginPage(),
);
}
}
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
@ -18,8 +27,29 @@ class _LoginPageState extends State<LoginPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Welcome')),
body: Center(
// 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;
});
},
))),
),
));
}
}