In Android, we can call setOnFocusChangeListener(), do something in onFocusChanged() method, but flutter does not provider onFocus() interface like onTap() in GestureDetector or onKey() in RawKeyboardListener.
setOnFocusChangeListener()
onFocusChanged()
onFocus()
onTap()
onKey()
I have read flutter api about focus, https://docs.flutter.io/flutter/widgets/FocusManager-class.html but I can't find a way to realize my request, anyone who can give me a hand?
In addtion you can use Focus widget.
Focus( child: TextFormField(...), onFocusChange: (hasFocus) { if(hasFocus) { // do stuff } }, )
2.1m questions
2.1m answers
60 comments
57.0k users