Skip to content

Instantly share code, notes, and snippets.

@VB10
Last active June 27, 2019 18:07
Show Gist options
  • Save VB10/8ad552763365cf2956f3e98e0d094aa6 to your computer and use it in GitHub Desktop.
Save VB10/8ad552763365cf2956f3e98e0d094aa6 to your computer and use it in GitHub Desktop.
Login UI
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: "hwa@gmail.com",
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