Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormBuilderTextField location of error message #326

Closed
ialameh opened this issue Jun 16, 2020 · 3 comments
Closed

FormBuilderTextField location of error message #326

ialameh opened this issue Jun 16, 2020 · 3 comments

Comments

@ialameh
Copy link

ialameh commented Jun 16, 2020

The location of the error message is coming above the textfield, is there a way to make it below the text field? is it to do with my code?

Container(
                                height: 42,
                                margin: EdgeInsets.only(top: 5),
                                decoration: BoxDecoration(
                                  color: AppColors.primaryElement,
                                  border: Border.fromBorderSide(
                                      Borders.primaryBorder),
                                  borderRadius: Radii.k4pxRadius,
                                ),
                                child: FormBuilderTextField(
                                  attribute: 'email',
                                  decoration: InputDecoration(
                                    errorStyle: TextStyle(
                                      height: 0,
                                    ),
                                    hintText: "youremail@yourdomain.com",
                                    errorText: 'invalid email',
                                    border: InputBorder.none,
                                  ),
                                  validators: [
                                    FormBuilderValidators.email(),
                                    FormBuilderValidators.required()
                                  ],
                                  style: TextStyle(
                                    color: AppColors.secondaryText,
                                    fontFamily: "Nunito Sans",
                                    fontWeight: FontWeight.w400,
                                    fontSize: 15,
                                  ),
                                  maxLines: 1,
                                  autocorrect: false,
                                ),
                              ),

image

@awhitford
Copy link
Collaborator

Maybe this is a problem that should be removed:

     errorStyle: TextStyle(
                                      height: 0,
                                    ),

@ialameh
Copy link
Author

ialameh commented Jun 16, 2020

I solved it by moving the borders inside the field itself, and removed the height from the container

Container(
                          margin: EdgeInsets.only(top: 5),
                          child: FormBuilderTextField(
                            attribute: 'password',
                            decoration: InputDecoration(
                              hintText: "••••••••••",
                              isDense: true,
                              border: OutlineInputBorder(
                                borderRadius: Radii.k4pxRadius,
                                borderSide: new BorderSide(
                                  color: AppColors.primaryElement,
                                ),
                              ),
                              suffixIcon: IconButton(
                                icon: Icon(Icons.visibility),
                                onPressed: () =>
                                    onVisibilityPressed(context, user),
                              ),
                            ),
                            obscureText: user.isPasswordHidden,
                            validators: [FormBuilderValidators.required()],
                            style: TextStyle(
                              color: AppColors.secondaryText,
                              fontFamily: "Nunito Sans",
                              fontWeight: FontWeight.w400,
                              fontSize: 15,
                            ),
                            maxLines: 1,
                            autocorrect: false,
                          ),
                        ),

@awhitford
Copy link
Collaborator

Fantastic! So I am closing this issue. Thank you for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants