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,39 +10,68 @@ 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: [
body: Center( Image(
child: SizedBox( width: screenSize.width,
width: dialogWidth, height: screenSize.height,
child: Form( fit: BoxFit.cover,
child: Column( image: const AssetImage(
mainAxisSize: MainAxisSize.max, 'nekro_wallpaper.jpg',
mainAxisAlignment: MainAxisAlignment.center, ),
children: [ ),
TextFormField( Scaffold(
controller: emailController, backgroundColor: Colors.transparent,
textInputAction: TextInputAction.next, body: Center(
decoration: const InputDecoration(label: Text('Email')), child: Container(
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
backgroundBlendMode: BlendMode.luminosity,
borderRadius: BorderRadius.circular(10),
),
height: 300,
width: dialogWidth,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Form(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextFormField(
controller: emailController,
autofillHints: const [
'email',
'username',
'name',
'login',
'mail'
],
textInputAction: TextInputAction.next,
decoration: const InputDecoration(label: Text('Email')),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)),
TextFormField(
controller: passwordController,
autofillHints: const ['password', 'pass', 'login'],
onFieldSubmitted: (value) => _loginSubmitted(
emailController.text, passwordController.text),
decoration:
const InputDecoration(label: Text('Password')),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)),
FloatingActionButton.extended(
onPressed: () => _loginSubmitted(
emailController.text, passwordController.text),
label: const Text('Login'))
],
), ),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)), ),
TextFormField(
controller: passwordController,
onFieldSubmitted: (value) => _loginSubmitted(
emailController.text, passwordController.text),
decoration: const InputDecoration(label: Text('Password')),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)),
FloatingActionButton.extended(
onPressed: () => _loginSubmitted(
emailController.text, passwordController.text),
label: const Text('Login'))
],
), ),
), ),
), ),
), ),
); ]);
} }
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