Skip to content

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

Open

Description

@victorsanni

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.

Activity

  1. self-assigned this
    on Apr 25, 2024
  2. justinmc commented on May 2, 2024

    @justinmc
    Contributor

    Related: #108258

  3. removed their assignment
    on Jul 26, 2024
  4. added
    in triagePresently being triaged by the triage team
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Jul 29, 2024
  5. added and removed on Aug 6, 2024
  6. added
    P2Important issues not at the top of the work list
    on Aug 8, 2024
  7. victorsanni commented on May 8, 2026

    @victorsanni
    ContributorAuthor

    Hi @chrisbobbe, will #183705 also fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions