prettier login
This commit is contained in:
@@ -7,39 +7,50 @@ class LoginPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final width = MediaQuery.of(context).size.width;
|
double width = MediaQuery.of(context).size.width / 2;
|
||||||
|
width = width < 400 ? 400 : width;
|
||||||
TextEditingController username = TextEditingController();
|
TextEditingController username = TextEditingController();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
|
child: Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: width / 2,
|
width: width,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Text('Welcome!',
|
Text(
|
||||||
style: TextStyle(
|
'Welcome!',
|
||||||
fontSize: 35,
|
style: Theme.of(context)
|
||||||
fontWeight: FontWeight.bold,
|
.textTheme
|
||||||
color: Colors.white,
|
.displayMedium!
|
||||||
)),
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
const Padding(padding: EdgeInsets.symmetric(vertical: 20)),
|
),
|
||||||
|
const Padding(padding: EdgeInsets.symmetric(vertical: 5)),
|
||||||
|
Text('please enter your first name to get started',
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge),
|
||||||
|
const Padding(padding: EdgeInsets.symmetric(vertical: 15)),
|
||||||
TextField(
|
TextField(
|
||||||
controller: username,
|
controller: username,
|
||||||
onSubmitted: (value) => DbHelper.login(username.text),
|
onSubmitted: (value) => DbHelper.login(username.text),
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
label: Text('Username'),
|
label: Text('Your first name'),
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Padding(padding: EdgeInsets.symmetric(vertical: 20)),
|
const Padding(padding: EdgeInsets.symmetric(vertical: 15)),
|
||||||
ElevatedButton(
|
FloatingActionButton.extended(
|
||||||
onPressed: () => DbHelper.login(username.text),
|
onPressed: () => DbHelper.login(username.text),
|
||||||
child: const Text('Login'),
|
label: const Text('READY'),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user