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

Make Autocomplete show a custom options view while optionsBuilder future is being resolved #147377

Open
victorsanni opened this issue Apr 25, 2024 · 1 comment
Assignees

Comments

@victorsanni
Copy link
Contributor

Use case

Currently in RawAutocomplete, when the field is changed, updateOptionsViewVisibility is only called after the optionsBuilder future has resolved:

  // Called when _textEditingController changes.
  Future<void> _onChangedField() async {
    final TextEditingValue value = _textEditingController.value;
    final Iterable<T> options = await widget.optionsBuilder(value);
    ...

    // Make sure the options are no longer hidden if the content of the field
    // changes (ignore selection changes).
    if (value.text != _lastFieldText) {
      _lastFieldText = value.text;
      _updateOptionsViewVisibility();
    }
  }

This means that users cannot currently display a custom options view while waiting for options from optionsBuilder. This might be useful, for example, if the user wants to display a loading message while waiting for options:

ScreenRecording2024-04-25at9 53 14AM-ezgif com-video-to-gif-converter

Proposal

Allow users display a custom options view while waiting for options from optionsBuilder.

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

No branches or pull requests

2 participants