Last active
June 27, 2019 18:07
-
-
Save VB10/8ad552763365cf2956f3e98e0d094aa6 to your computer and use it in GitHub Desktop.
Login UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoginView extends StatefulWidget { | |
@override | |
_LoginViewState createState() => _LoginViewState(); | |
} | |
class _LoginViewState extends State<LoginView> { | |
@override | |
Widget build(BuildContext context) { | |
return BaseView<LoginModel>( | |
onModelReady: (model) { | |
model.setContext(context); | |
}, | |
builder: (context, model, child) => Form( | |
key: model.formKey, | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Column( | |
mainAxisSize: MainAxisSize.max, | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Placeholder( | |
fallbackHeight: 150, | |
color: Colors.green, | |
), | |
TextFormField( | |
controller: model.userEmail, | |
validator: ValidatorHelper.emailValidator, | |
decoration: InputDecoration( | |
helperText: "Write mail adress.", | |
hintText: "[email protected]", | |
labelText: "Email", | |
), | |
), | |
TextFormField( | |
obscureText: true, | |
controller: model.userPassword, | |
validator: ValidatorHelper.passwordValidator, | |
decoration: InputDecoration( | |
helperText: "Write mail password.", | |
hintText: "*****", | |
labelText: "Password"), | |
), | |
Row( | |
children: <Widget>[ | |
Expanded( | |
child: RaisedButton( | |
child: Icon(Icons.mail), | |
onPressed: () {}, | |
), | |
), | |
UIHelper.horizontalSpaceSmall(), | |
Expanded( | |
child: RaisedButton( | |
color: Colors.blue, | |
child: model.state == ViewState.Idle | |
? Text( | |
"Login", | |
style: loginButtonStyle, | |
) | |
: CircularProgressIndicator(), | |
onPressed: model.login, | |
), | |
), | |
], | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment