Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class LoginPage extends StatefulWidget {
- @override
- _LoginPageState createState() => _LoginPageState();
- }
- class _LoginPageState extends State<LoginPage> {
- TextStyle style = TextStyle(fontFamily: 'Montserrat', fontSize: 20.0);
- String _email, _password;
- final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Form(
- key: _formKey,
- child: Container(
- margin: EdgeInsets.all(30),
- padding: EdgeInsets.all(10),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- TextFormField(
- validator: (input) {
- if (input.isEmpty) {
- return 'Please type an e-mail';
- }
- },
- onSaved: (input) => _email = input,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
- hintText: 'E-mail',
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(32.0)),
- ),
- ),
- TextFormField(
- obscureText: true,
- validator: (input) {
- if (input.length < 6) {
- return 'Please provide password';
- }
- },
- onSaved: (input) => _password = input,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
- hintText: 'Password',
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(32.0)),
- ),
- ),
- Material(
- elevation: 5.0,
- borderRadius: BorderRadius.circular(30.0),
- color: Color(0xff01A0C7),
- child: MaterialButton(
- minWidth: MediaQuery.of(context).size.width,
- padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
- onPressed: () {},
- child: Text("Login",
- textAlign: TextAlign.center,
- style: style.copyWith(
- color: Colors.white, fontWeight: FontWeight.bold)),
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement