Skip to content

feat: add defaultMode to specify initial keyboard layout on focus#30

Merged
albinpk merged 5 commits intoalbinpk:mainfrom
luizfern12:feature/specify-mode-textfield
Feb 10, 2026
Merged

feat: add defaultMode to specify initial keyboard layout on focus#30
albinpk merged 5 commits intoalbinpk:mainfrom
luizfern12:feature/specify-mode-textfield

Conversation

@luizfern12
Copy link
Copy Markdown
Contributor

Description

Added defaultMode to onscreen_keyboard_text_field and onscreen_keyboard_text_form_field.
Also added it to layout so the textFields can default to the correct user defined mode when defaultMode isn't specified on a textField.

Added tests for defaultMode.

This change aims to add a easier way of switching the keyboard mode without having to use setModeNamed manually for every textField.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Checked for regressions using the provided sample.
  • Tested locally with an modified version of the provided sample implementing the defaultMode field on the textFields.

Test Configuration:

  • Package Version: 0.4.3+2
  • Flutter SDK: 3.38.9
  • Operating System: Linux 6.18.6-arch1-1 (Arch Linux)

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
  • 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

@albinpk
Copy link
Copy Markdown
Owner

albinpk commented Feb 7, 2026

Thanks for the PR. This is a nice improvement.

I have a couple of suggestions:

  • I think the defaultMode field on KeyboardLayout can be avoided. The default mode can simply be the first entry in the modes map, as it works today. Adding a separate defaultMode forces users to either always specify it or ensure the modes contain a specific key "default", which adds extra constraints.
  • For the text field widgets, the property name defaultMode might be a bit generic. Using a more explicit name that clearly refers to the on-screen keyboard mode would improve clarity.

The approach makes sense; I just think these tweaks would simplify the API.

@luizfern12
Copy link
Copy Markdown
Contributor Author

I'm leaving home right now, when i come back i'll look into implementing your suggestions:

About the naming, what do you think of 'OnscreenKeyboardMode'?

@albinpk albinpk merged commit b7ebfd5 into albinpk:main Feb 10, 2026
1 check passed
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