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

added key to text_field, checkbox, checkbox_list #165

Closed
wants to merge 5 commits into from
Closed

Conversation

yuzurihaaa
Copy link

Hi, thanks for this superb library. It helps a lot in building a form, especially a sophisticated one!

However, I might want to add something that seems pretty useful (I guess) which is using key from the attribute for widget testing.

I've added Key to these three fields
FormBuilderTextField,
FormBuilderCheckbox,
FormBuilderCheckboxList

Also, I added widget test for example for those who may find it beneficial.

@yuzurihaaa
Copy link
Author

yuzurihaaa commented Nov 3, 2019

this could be helpful for #155, #151 but I will add integration test will flutter_driver whenever I am free later.

@danvick
Copy link
Collaborator

danvick commented Nov 3, 2019

Hi @yuzurih4,
I'm not an expert on Widget testing.

I've realized you've wrapped the fields in a Container and added Keys to them.
Since the fields already have GlobalKeys that identify them, is it possible to use these already available GlobalKeys instead of creating another key?

So that instead of having final nameInputField = find.byKey(Key('name'));, we have final nameInputField = find.byKey(GlobalKey('name'));?

@yuzurihaaa
Copy link
Author

Ahh I see, let me try with that and see if this PR is still valid. Thanks for pointing it out :)

@yuzurihaaa
Copy link
Author

Hi @danvick,

Actually I am not an expect on Widget testing too, but my finding is I can't use GlobalKey since GlobalKey comes with short hash.

With final nameInputField = find.byKey(GlobalKey(debugLabel: 'name')); I get error like

  Expected: exactly one matching node in the widget tree
  Actual: ?:<zero widgets with key [GlobalKey#9aa62 name] (ignoring offstage widgets)>
   Which: means none were found but one was expected

yuzuriha and others added 4 commits November 4, 2019 00:11
remove checkbox container

fix indent
 into danvick-master

# Conflicts:
#	lib/src/fields/form_builder_text_field.dart
Danvick master to zaralockheart master
@shashikantshaale
Copy link
Contributor

Duplicate of #184

@yuzurihaaa
Copy link
Author

yuzurihaaa commented Dec 2, 2019

@shashikantshaale ahhh I see that you add key argument, I am trying to reuse the name as the key so that developers don't have to add Key argument to it. Alright, I'll close this.

@yuzurihaaa yuzurihaaa closed this Dec 2, 2019
@danvick
Copy link
Collaborator

danvick commented Dec 2, 2019

Hi @zaralockheart,
Your contribution is still highly appreciated.
You guys are making my work easier.

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

Successfully merging this pull request may close these issues.

3 participants