Skip to content

Provide api to decouple cursor and keyboard for an editable text#22468

Closed
kangwang1988 wants to merge 2 commits intoflutter:masterfrom
XianyuTech:alf_beta_v0.8.2_custom_keyboard
Closed

Provide api to decouple cursor and keyboard for an editable text#22468
kangwang1988 wants to merge 2 commits intoflutter:masterfrom
XianyuTech:alf_beta_v0.8.2_custom_keyboard

Conversation

@kangwang1988
Copy link
Contributor

@kangwang1988 kangwang1988 commented Sep 29, 2018

Provide new api so that a cursor could be decoupled from the keyboard when specified disableKeyboard, this is helpful especially when the developers need a customized keyboard, where the cursor is needed but the keyboard would be always hidden.

What is was before:
img_5024

What we want:
img_5025

… when specified disableKeyboard, this is helpful especially when the developers need a customized keyboard, where the cursor is needed but the keyboard would be always hidden.
@goderbauer
Copy link
Member

goderbauer commented Oct 1, 2018

Hey @kangwang1988,

what's your use case for a customized keyboard? From the screenshots It looks like you could just set the keyboardType [1] of the TextField to something like const TextInputType.numberWithOptions(decimal: true) and rely on the system keyboard.

[1] https://master-docs-flutter-io.firebaseapp.com/flutter/material/TextField/keyboardType.html

@kangwang1988
Copy link
Contributor Author

@goderbauer
It's not only a number keyboard, but a customized one. As below:

@goderbauer
Copy link
Member

This still feels like a numeric keyboard. The more idiomatic way of doing this would probably be to show the properly configured (numeric) system keyboard and display a custom view with the custom keys hovering just above the keyboard (which seem to just be the "hide keyboard" key and the yellow key). This way would respect the keyboard choice that the user made on the system, e.g. some accessibility users may have chosen a morse keyboard to enter information that way. With this approach you're making life more difficult for them.

Your current implementation would also break people who have a physical keyboard attached to their device because you're no longer opening an input connection with the OS. A better way to implement this may be to add a new type none to TextInputType [1], which you can pass in to the TextField's keyboardType property [2]. This type should still properly configure an input connection to allow input from physical keyboards, but prevent the on-screen keyboard from coming up on the native side (I haven't looked into how to do that).

Even better: iOS seems to have support for "Custom Views for Data Input" [3], which seems to be what you want. It would be cool if we could make that API useable from flutter as well. We'd have to check if there's an Android equivalent. This solution would require some more design work. Might be worth filing an issue for it.

[1] https://master-docs-flutter-io.firebaseapp.com/flutter/services/TextInputType-class.html
[2] https://master-docs-flutter-io.firebaseapp.com/flutter/material/TextField/keyboardType.html
[3] https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/InputViews/InputViews.html

@kf6gpe kf6gpe added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 7, 2018
@zoechi zoechi added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Nov 28, 2018
@Im-Kevin
Copy link
Contributor

Im-Kevin commented Dec 8, 2018

https://github.com/Im-Kevin/cool_ui
This is the plugin I wrote. Custom keyboard can be implemented based on TextField

@goderbauer
Copy link
Member

I am closing this for now as there hasn't been any activity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants