56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
void main() => runApp(MyApp());
|
|
|
|
// ToDo: remove when done: currently only for testing purposes
|
|
|
|
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();
|
|
}
|
|
|
|
class _LoginPageState extends State<LoginPage> {
|
|
bool _isPasswordObscure = true;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
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;
|
|
});
|
|
},
|
|
))),
|
|
),
|
|
));
|
|
}
|
|
}
|