login screen background and autofill hints
This commit is contained in:
BIN
assets/nekro_wallpaper.jpg
Normal file
BIN
assets/nekro_wallpaper.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -10,39 +10,68 @@ class LoginPage extends StatelessWidget {
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
final TextEditingController passwordController = TextEditingController();
|
||||
Size screenSize = MediaQuery.of(context).size;
|
||||
double dialogWidth = screenSize.width > 400 ? 400 : screenSize.width;
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: dialogWidth,
|
||||
child: Form(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: emailController,
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: const InputDecoration(label: Text('Email')),
|
||||
double dialogWidth = screenSize.width > 300 ? 300 : screenSize.width;
|
||||
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(
|
||||
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) {
|
||||
|
||||
@@ -64,6 +64,7 @@ flutter:
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- secrets.env
|
||||
- assets/nekro_wallpaper.jpg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
Reference in New Issue
Block a user