prettier login

This commit is contained in:
SomnusVeritas
2023-10-21 02:20:22 +02:00
parent 4db2a63008
commit 068ad02438

View File

@@ -7,36 +7,47 @@ 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: SizedBox( child: Card(
width: width / 2, child: Padding(
child: Column( padding: const EdgeInsets.all(15.0),
children: [ child: SizedBox(
const Text('Welcome!', width: width,
style: TextStyle( child: Column(
fontSize: 35, mainAxisSize: MainAxisSize.min,
fontWeight: FontWeight.bold, children: [
color: Colors.white, Text(
)), 'Welcome!',
const Padding(padding: EdgeInsets.symmetric(vertical: 20)), style: Theme.of(context)
TextField( .textTheme
controller: username, .displayMedium!
onSubmitted: (value) => DbHelper.login(username.text), .copyWith(fontWeight: FontWeight.bold),
textInputAction: TextInputAction.done, ),
decoration: const InputDecoration( const Padding(padding: EdgeInsets.symmetric(vertical: 5)),
label: Text('Username'), Text('please enter your first name to get started',
border: OutlineInputBorder(), style: Theme.of(context).textTheme.bodyLarge),
), const Padding(padding: EdgeInsets.symmetric(vertical: 15)),
TextField(
controller: username,
onSubmitted: (value) => DbHelper.login(username.text),
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
label: Text('Your first name'),
border: OutlineInputBorder(),
),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 15)),
FloatingActionButton.extended(
onPressed: () => DbHelper.login(username.text),
label: const Text('READY'),
)
],
), ),
const Padding(padding: EdgeInsets.symmetric(vertical: 20)), ),
ElevatedButton(
onPressed: () => DbHelper.login(username.text),
child: const Text('Login'),
)
],
), ),
), ),
), ),