login screen background and autofill hints

This commit is contained in:
marcoabat
2023-08-09 16:13:38 +02:00
parent 518ab2958a
commit bbce3ace56
4 changed files with 58 additions and 28 deletions

BIN
assets/nekro_wallpaper.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -10,11 +10,29 @@ class LoginPage extends StatelessWidget {
final TextEditingController emailController = TextEditingController(); final TextEditingController emailController = TextEditingController();
final TextEditingController passwordController = TextEditingController(); final TextEditingController passwordController = TextEditingController();
Size screenSize = MediaQuery.of(context).size; Size screenSize = MediaQuery.of(context).size;
double dialogWidth = screenSize.width > 400 ? 400 : screenSize.width; double dialogWidth = screenSize.width > 300 ? 300 : screenSize.width;
return Scaffold( return Stack(children: [
Image(
width: screenSize.width,
height: screenSize.height,
fit: BoxFit.cover,
image: const AssetImage(
'nekro_wallpaper.jpg',
),
),
Scaffold(
backgroundColor: Colors.transparent,
body: Center( body: Center(
child: SizedBox( child: Container(
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
backgroundBlendMode: BlendMode.luminosity,
borderRadius: BorderRadius.circular(10),
),
height: 300,
width: dialogWidth, width: dialogWidth,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Form( child: Form(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@@ -22,15 +40,24 @@ class LoginPage extends StatelessWidget {
children: [ children: [
TextFormField( TextFormField(
controller: emailController, controller: emailController,
autofillHints: const [
'email',
'username',
'name',
'login',
'mail'
],
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
decoration: const InputDecoration(label: Text('Email')), decoration: const InputDecoration(label: Text('Email')),
), ),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)), const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)),
TextFormField( TextFormField(
controller: passwordController, controller: passwordController,
autofillHints: const ['password', 'pass', 'login'],
onFieldSubmitted: (value) => _loginSubmitted( onFieldSubmitted: (value) => _loginSubmitted(
emailController.text, passwordController.text), emailController.text, passwordController.text),
decoration: const InputDecoration(label: Text('Password')), decoration:
const InputDecoration(label: Text('Password')),
), ),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)), const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)),
FloatingActionButton.extended( FloatingActionButton.extended(
@@ -42,7 +69,9 @@ class LoginPage extends StatelessWidget {
), ),
), ),
), ),
); ),
),
]);
} }
void _loginSubmitted(String email, String password) { void _loginSubmitted(String email, String password) {

View File

@@ -64,6 +64,7 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- secrets.env - secrets.env
- assets/nekro_wallpaper.jpg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware # https://flutter.dev/assets-and-images/#resolution-aware