Search Results

Loading preview

Starting the Flutter app

Filter/sort row, highlighted matching text

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

How it works

Search runs locally over the sample _results. Typing filters by title, and _highlight splits each title into TextSpans so matches show bold in the primary color. The FilterChips narrow results by type, one at a time, and the sort DropdownButton orders by daysOld on Date, keeping list order on Relevance. All three values live in state, and _visible recomputes them in build. An empty match shows No results.

Adapting it

  • Call your search endpoint from onChanged with a debounce, in place of _results.
  • Pass _filter and _sort as query parameters.
  • Add a loading state around the ListView.builder.