Advertisement
Guest User

Untitled

a guest
Jan 10th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.29 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class LoginScreen extends StatefulWidget {
  4.  
  5.   @override
  6.    createState() {
  7.     return LoginScreenState();
  8.   }
  9.  
  10. }
  11.  
  12. class LoginScreenState extends State<LoginScreen> {
  13.  
  14.   final reset = GlobalKey<FormState>();
  15.  
  16.  
  17.   @override
  18.   Widget build(context) {
  19.     // TODO: implement build
  20.     return Container(
  21.       margin: EdgeInsets.all(20),
  22.       child: Form(
  23.         key: reset,
  24.         child: Column(
  25.           children: <Widget>[
  26.             emailField(),
  27.             passwordField(),
  28.             Container(margin: EdgeInsets.only(top: 25),),
  29.             submitButton(),
  30.           ],
  31.         ),
  32.       ),
  33.     );
  34.   }
  35.  
  36.   Widget emailField() {
  37.  
  38.     return TextField(
  39.       keyboardType: TextInputType.emailAddress,
  40.       decoration: InputDecoration(
  41.         labelText: 'Email',
  42.         hintText: 'you@example.com',
  43.  
  44.       ),
  45.     );
  46.  
  47.   }
  48.  
  49.   Widget passwordField() {
  50.  
  51.     return TextField(
  52.       decoration: InputDecoration(
  53.         labelText: 'Enter Pass',
  54.         hintText: 'Password',
  55.       ),
  56.  
  57.     );
  58.   }
  59.  
  60.   Widget submitButton() {
  61.  
  62.  
  63.     return RaisedButton(
  64.       color: Colors.blue.shade400,
  65.       child: Text('Войти'),
  66.       onPressed: () {
  67.         reset.currentState.reset();
  68.       },
  69.     );
  70.  
  71.   }
  72.  
  73.    
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement