Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final _loginFormKey = GlobalKey<FormState>();
- final _emailKey = GlobalKey<FormFieldState>();
- final _passwordKey = GlobalKey<FormFieldState>();
- .
- .
- .
- void _validateEmail() {
- if (_emailKey.currentState.validate()) {
- print('valid');
- } else {
- print('invalid');
- }
- }
- void _validatePassword() {
- _passwordKey.currentState.validate();
- }
- .
- .
- .
- Widget loginWidget() {
- return Column(
- children: [
- Form(
- key: _loginFormKey,
- child:
- Column(
- children: [
- Padding(
- padding: EdgeInsets.only(bottom: 7),
- child: EltaFormField(
- key: _emailKey,
- placeholderText: 'Ваш email',
- keyboardType: TextInputType.emailAddress,
- type: EltaFormFieldType.normal,
- validator: this.widget.emailValidator.validate,
- onSaved: (String value) {
- _email = value;
- },
- onEditingComplete: () {
- _validateEmail();
- },
- onTap: () {
- _pushToTextField();
- },
- ),
- ),
- EltaFormField(
- key: _passwordKey,
- placeholderText: 'Ваш пароль',
- type: EltaFormFieldType.obscure,
- validator: this.widget.passwordValidator.validate,
- onSaved: (String value) {
- _password = value;
- },
- onEditingComplete: () {
- _validatePassword();
- },
- onTap: () {
- _pushToTextField();
- },
- )
- ],
- ),
- )
- ],
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement