Advertisement
Guest User

Untitled

a guest
May 20th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.59 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class LoginPage extends StatefulWidget {
  4.   @override
  5.   _LoginPageState createState() => _LoginPageState();
  6. }
  7.  
  8. class _LoginPageState extends State<LoginPage> {
  9.   TextStyle style = TextStyle(fontFamily: 'Montserrat', fontSize: 20.0);
  10.   String _email, _password;
  11.   final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
  12.   @override
  13.   Widget build(BuildContext context) {
  14.     return Scaffold(
  15.       body: Form(
  16.         key: _formKey,
  17.         child: Container(
  18.           margin: EdgeInsets.all(30),
  19.           padding: EdgeInsets.all(10),
  20.           child: Column(
  21.             mainAxisAlignment: MainAxisAlignment.center,
  22.             crossAxisAlignment: CrossAxisAlignment.center,
  23.             children: <Widget>[
  24.               TextFormField(
  25.                 validator: (input) {
  26.                   if (input.isEmpty) {
  27.                     return 'Please type an e-mail';
  28.                   }
  29.                 },
  30.                 onSaved: (input) => _email = input,
  31.                 decoration: InputDecoration(
  32.                   contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
  33.                   hintText: 'E-mail',
  34.                   border: OutlineInputBorder(
  35.                       borderRadius: BorderRadius.circular(32.0)),
  36.                 ),
  37.               ),
  38.               TextFormField(
  39.                 obscureText: true,
  40.                 validator: (input) {
  41.                   if (input.length < 6) {
  42.                     return 'Please provide password';
  43.                   }
  44.                 },
  45.                 onSaved: (input) => _password = input,
  46.                 decoration: InputDecoration(
  47.                   contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
  48.                   hintText: 'Password',
  49.                   border: OutlineInputBorder(
  50.                       borderRadius: BorderRadius.circular(32.0)),
  51.                 ),
  52.               ),
  53.               Material(
  54.                 elevation: 5.0,
  55.                 borderRadius: BorderRadius.circular(30.0),
  56.                 color: Color(0xff01A0C7),
  57.                 child: MaterialButton(
  58.                   minWidth: MediaQuery.of(context).size.width,
  59.                   padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
  60.                   onPressed: () {},
  61.                   child: Text("Login",
  62.                       textAlign: TextAlign.center,
  63.                       style: style.copyWith(
  64.                           color: Colors.white, fontWeight: FontWeight.bold)),
  65.                 ),
  66.               ),
  67.             ],
  68.           ),
  69.         ),
  70.       ),
  71.     );
  72.   }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement