Skip to content

Instantly share code, notes, and snippets.

@derekedelaney
Last active June 4, 2021 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derekedelaney/8bcd744ade4d118618de8db3762b376a to your computer and use it in GitHub Desktop.
Save derekedelaney/8bcd744ade4d118618de8db3762b376a to your computer and use it in GitHub Desktop.
Sign in form with forgot password on bottom
import 'package:flutter/material.dart';
void main() {
runApp(App());
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Home(),
);
}
}
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) =>
SingleChildScrollView(
child: Container(
padding: const EdgeInsets.all(20),
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: IntrinsicHeight(
child: Column(
children: [
Icon(Icons.shield, color: Colors.green, size: 100),
TextFormField(
decoration: InputDecoration(labelText: 'Email'),
),
TextFormField(
decoration: InputDecoration(labelText: 'Password'),
),
Padding(
padding: const EdgeInsets.all(20),
child: Center(
child: ElevatedButton(
child: Text('Sign In'),
onPressed: () {},
),
),
),
Spacer(),
Text('forgot password'),
],
),
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment