created homescreen with password input
This commit is contained in:
parent
c602e3ce8c
commit
aaaada1b23
@ -1,12 +1,21 @@
|
|||||||
import 'package:flutter/material.dart';
|
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
|
// 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
|
@override
|
||||||
_LoginPageState createState() => _LoginPageState();
|
_LoginPageState createState() => _LoginPageState();
|
||||||
}
|
}
|
||||||
@ -18,8 +27,29 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Welcome')),
|
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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
))),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user