Skip to content

Make suggestionsBuilder in SearchAnchor async #126531

@ips-jm

Description

@ips-jm

Is there an existing issue for this?

Use case

Hey,
I really like the new SearchBar / SearchAnchor.bar Widget!
However I think most of the suggestions will come from an async api call based on the input instead of prepared datasets.

Proposal

Something like this would be really nice:

SearchAnchor.bar(
  suggestionsBuilder: (context, controller) async {
    final suggestionList = await getSuggestions(controller.text);
    return suggestionList.map((suggestion) => 
      ListTile(
        title: Text(suggestion),
        onTap: () {
          //Some action
        },
      )
    );
  })

Metadata

Metadata

Assignees

Labels

Bot is counting down the days until it unassigns the issuec: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions