'Flutter: Get currently active TextEditingController without explicitly creating Controllers or Nodes
ATTENTION: Windows-Development here.
I want to use a virtual keyboard (on screen). I can not rely on a hardware-keyboard.
My goal is to securely get any TextEditingController if I e.g. tap on a TextFormField so I can use it in my virtual keyboard (I use this plugin).
Currently my VirtualKeyboard is wrapped in a Stack as a Positioned and only shown if a Focus-change has been detected. This already works:
Focus(
onFocusChange: ((value) {
BlocProvider.of<KeyboardCubit>(context).setShow(value);
}),
child: Stack(...),
)
But I'm stuck on the part to get the TextEditingController. I do not want to add custom code for every TextFormField. Flutter achieves it somehow when pressing on something that may be focusable, so why can't I?
Maybe I am missing something. I am glad to hear your opinions.
Best regards.
Alternative Question: Is there any good Virtual Keyboard plugin that handles this use case safely?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
