Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear text field #13

Closed
JEuler opened this issue Sep 23, 2020 · 4 comments
Closed

Clear text field #13

JEuler opened this issue Sep 23, 2020 · 4 comments
Labels
question Further information is requested

Comments

@JEuler
Copy link

JEuler commented Sep 23, 2020

How I can clear text field after onEditingComplete callback? Setting defaultText not working

@fayeed
Copy link
Owner

fayeed commented Sep 23, 2020

You could just set a key for the FlutterMention widget & then just use these two ways to clear the field.

  1. Using the controller's clear method:
    key.currentState.controller.clear();

  2. Using the controller's text property:
    key.currentState.controller.text = '';

@fayeed fayeed added the question Further information is requested label Sep 23, 2020
@JEuler
Copy link
Author

JEuler commented Sep 24, 2020

Thank you very much!

@JEuler JEuler closed this as completed Sep 24, 2020
@loic-hamdi
Copy link

@fayeed

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
Copy link

loic-hamdi commented Oct 26, 2020

@fayeed

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants