Skip to content
pubscout

search_page

2.3.0, released 4 years ago by jesusrp98.com

Build custom search experiences using Flutter's SearchDelegate foundation.

WASM-readyCopyleft license
$ flutter pub add search_page
Source repository

What it does

Provides a SearchPage class to easily filter lists of items, customize suggestions, handle empty results, and build Material search views.

AI-written summary of version 2.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to add a search view to an existing list of objects with minimal boilerplate.
  • You need custom filtering logic over multiple fields of an object.

Skip it when

  • You require complex asynchronous server-side search paging out of the box.
  • You are not using the Material design paradigm for your search UI.

Strengths

  • Simple API leveraging Flutter's native SearchDelegate.
  • Easy list filtering using custom string representation selectors.

Weaknesses

  • Limited to Flutter's Material search UI workflow.
  • GPL-3.0 license may restrict usage in certain proprietary contexts.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
FloatingActionButton(
  child: Icon(Icons.search),
  tooltip: 'Search people',
  onPressed: () => showSearch(
    context: context,
    delegate: SearchPage<Person>(
      items: people,
      searchLabel: 'Search people',
      suggestion: Center(
        child: Text('Filter people by name, surname or age'),
      ),
      failure: Center(
        child: Text('No person found :('),
      ),
      filter: (person) => [
        person.name,
        person.surname,
        person.age.toString(),
      ],
      builder: (person) => ListTile(
        title: Text(person.name),
        subtitle: Text(person.surname),
        trailing: Text('${person.age} yo'),
      ),
    ),
  ),
),

Alternatives

Packages that do the same job and could replace search_page.