fix: TextInputFormatter is not applied to the edits of the onscreen_keyboard and onChanged is not triggered on changes thorugh the onscreen_keyboard #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I took the liberty and let github copilot (Claude Sonnet 4) fix the issue. All the contents of this PR execpt this message are AI generated. I looked at the code and it seems like it did a good job.
AI generated Summary:
This pull request enhances the
flutter_onscreen_keyboardpackage by improving how text input changes are handled and propagated, especially with respect to input formatters and change notifications. The changes ensure that input formatters andonChangedcallbacks are consistently respected across all keyboard actions, and extend theOnscreenKeyboardFieldStateinterface to support these features.Enhancements to text input handling:
_OnscreenKeyboardStatenow applies input formatters (if present) before updating the text, ensuring that all changes respect any formatting constraints. TheonChangedcallback is only called if the text actually changes. [1] [2] [3] [4]onChangedcallback is triggered only when the text is modified, improving consistency in change notifications. [1] [2] [3]Interface and implementation updates:
OnscreenKeyboardFieldStateinterface now includesinputFormattersandonChangedgetters, making these features available to all implementing widgets._OnscreenKeyboardTextFieldStateand_OnscreenKeyboardTextFormFieldStateimplement the newinputFormattersandonChangedgetters, passing through the corresponding widget properties. [1] [2]Minor code cleanup:
OnscreenKeyboardTextFormFieldfor clarity.File organization:
partdirectives inonscreen_keyboard.dartfor better clarity and maintainability.