Clear text field
JEuler opened this issue · 4 comments
JEuler commented
How I can clear text field after onEditingComplete callback? Setting defaultText
not working
fayeed commented
You could just set a key
for the FlutterMention
widget & then just use these two ways to clear the field.
-
Using the controller's clear method:
key.currentState.controller.clear();
-
Using the controller's text property:
key.currentState.controller.text = '';
JEuler commented
Thank you very much!
loic-hamdi commented
Bringing the key in the parent widget creates me this error:
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
Multiple widgets used the same GlobalKey.
How can we please access the key
from a different widget ?
loic-hamdi commented
Bringing the key in the parent widget creates me this error:
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
Multiple widgets used the same GlobalKey.
How can we please access the key
from a different widget ?