Skip to content

Conversation

@hlvs-apps
Copy link
Contributor

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_keyboard package 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 and onChanged callbacks are consistently respected across all keyboard actions, and extend the OnscreenKeyboardFieldState interface to support these features.

Enhancements to text input handling:

  • The logic for updating text in _OnscreenKeyboardState now applies input formatters (if present) before updating the text, ensuring that all changes respect any formatting constraints. The onChanged callback is only called if the text actually changes. [1] [2] [3] [4]
  • For backspace, tab, and enter actions, the onChanged callback is triggered only when the text is modified, improving consistency in change notifications. [1] [2] [3]

Interface and implementation updates:

  • The OnscreenKeyboardFieldState interface now includes inputFormatters and onChanged getters, making these features available to all implementing widgets.
  • Both _OnscreenKeyboardTextFieldState and _OnscreenKeyboardTextFormFieldState implement the new inputFormatters and onChanged getters, passing through the corresponding widget properties. [1] [2]

Minor code cleanup:

  • Minor formatting and doc comment improvements in OnscreenKeyboardTextFormField for clarity.

File organization:

  • Minor reordering of part directives in onscreen_keyboard.dart for better clarity and maintainability.

@albinpk albinpk merged commit 9ea27c1 into albinpk:main Sep 15, 2025
1 of 2 checks passed
@albinpk
Copy link
Owner

albinpk commented Sep 15, 2025

Thanks for the fix 🎉.

This has now been released in: 0.4.0+1

@hlvs-apps hlvs-apps deleted the input-formatter-fix branch September 17, 2025 09:39
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