Skip to content

Conversation

@manonfiZ
Copy link
Contributor

@manonfiZ manonfiZ commented Oct 8, 2025

Description

This PR adds real-time validation support to OnscreenKeyboardTextFormField by introducing a new formFieldKey property. This enhancement allows developers to access the form field state and implement real-time validation more effectively.

Key changes:

  • Added formFieldKey parameter to OnscreenKeyboardTextFormField
  • Implemented real-time validation in the example app
  • Added comprehensive test coverage for the new functionality

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The changes have been verified through the following tests:

  • Added test case for real-time validation using formFieldKey
  • Verified validation state changes on text input
  • Tested both valid and invalid input scenarios

Test Configuration:

  • Package Version: 0.4.0+1
  • Flutter SDK: 3.35.4
  • Operating System: Linux Mint 22.2

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

- Add test case for real-time validation using formFieldKey
- Verify validation state changes on text input
- Test both valid and invalid input scenarios
@manonfiZ manonfiZ changed the title test: add real-time validation test for OnscreenKeyboardTextFormField feat: add form field key and improve validation Oct 8, 2025
@albinpk
Copy link
Owner

albinpk commented Oct 9, 2025

Thanks for the PR! 🙌

I see you’re trying to validate using FormFieldState. You can achieve the same behavior by wrapping the field in a Form widget and using the form’s key to call validate() or save() for all fields. Could you confirm if that works for your use case?

@manonfiZ
Copy link
Contributor Author

manonfiZ commented Oct 9, 2025

Yes it works @albinpk

The thing in my case is that I have to refactor all my entire codebase and wrap all FormField by a Form. ​😅​
I had a custom formfield on top of the flutter formfield. That what was there and to use the feature provided by your package, i have just replaced the flutter form field and then use OnscreenKeyboardTextFormField, in my custom widget.

And then the problem is that every this custom widget was used and and had a validation based on FormFieldState start crying cause this one is null.

In addition to my concern, i think it will be useful to validate single TextFormField without having to wrap with a form.

@albinpk
Copy link
Owner

albinpk commented Oct 10, 2025

Thanks for explaining your use case. I’ll merge the PR.

@albinpk albinpk changed the title feat: add form field key and improve validation feat: add formFieldKey and improve validation Oct 10, 2025
@albinpk albinpk merged commit bf74319 into albinpk:main Oct 10, 2025
2 checks passed
albinpk added a commit that referenced this pull request Oct 10, 2025
#23)

- Add test case for real-time validation using formFieldKey
- Verify validation state changes on text input
- Test both valid and invalid input scenarios

Co-authored-by: Albin PK <[email protected]>
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.

2 participants