Open Sarthak-22 opened 3 years ago
Are you sure matchbox-keyboard would work with flutter-pi if the automatic input detection worked? matchbox-keyboard actually shouldn't work with flutter-pi at all since it depends on X11, while flutter-pi is completely incompatible with X11.
I've thought about touchscreen keyboard input for some time, and while it's definitely something that needs to be implemented, currently there's no "nice" way to do it. I can maybe add a kind of loopback interface that could be used by the virtual keyboard package so you can use its text input just like you'd use real text input on any other platform. However it seems like the owner doesn't maintain it anymore, so I'm not sure that could work.
EDIT: There's an open flutter issue for this: https://github.com/flutter/flutter/issues/68988. If that issue gets resolved and virtual-keyboard gets updated to use it (or someone creates a fork and updates that), we can probably use virtual, in-app keyboards as if they were real keyboards when the next major flutter version is released.
I had the same issue and ended up forking https://github.com/Im-Kevin/cool_ui which intercepts the platform messages that would trigger a native keyboard. Its not a perfect solution though, as you can run into some conflicts between the virtual keyboard and various overlays, alerts, etc.
@mortenboye can you elaborate or provide a basic on screen keyboard example repo using cool-ui. Interested in how you got it to work!
@Taha-Firoz I mostly removed stuff I didn't need, as I was only interested in the keyboard. To get it to work I basically just followed the example setup, register the keyboard, insert a KeyboardRootWidget high in the widget hierarchy and specify the wanted keyboard types on your textfields. If you need new keyboard types you have too add them and their identifiers to the package.
What issues are you seeing?
I've tried a new approach (compared to the one described above), using the new TextInputControl features: https://github.com/flutter/flutter/pull/76072 https://api.flutter.dev/flutter/services/TextInputControl-mixin.html
These APIs makes it much easier to implement a virtual keyboard.
And while the onscreen keyboard works as intended, plugging in a HW keyboard and typing on that, does not result in any characters when running on the Pi (Yocto). It does work in Mac and Linux standalone Flutter apps.
On the Pi I get this in the terminal:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(illegalargument, Expected `arg[1]['inputType']['name']` to be a string-ification of `TextInputType`., null, null)
#0 JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:171:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:315:18)
<asynchronous suspension>
@ardera do you have any clue what causes this? My HW keyboard works fine in the shell.
Is there any way in which the virtual keyboard automatically comes up in Flutter without explicitly coding for virtual keyboard package using Dart.
I installed virtual keyboard in Raspbian OS with the command
sudo apt install matchbox-keyboard
. However, after runningflutter-pi
command and launching the flutter app, the matchbox-keyboard does not detect the input field/box in flutter app to automatically come up. Is there any solution for this (without coding for virtual-keyboard flutter package) ?