Search packages, repositories and app categories

Package detailsv3.0.0

flutter_search_bar

A (mostly) automatic search bar inside an AppBar for flutter

30-day downloads
1.1K
Likes
121
Pub points
60

Install package

flutter pub add flutter_search_bar

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that provides a search bar integrated into an AppBar with minimal setup. It automatically handles search input, filtering, and UI updates, making it ideal for adding search functionality to apps with little boilerplate. The search bar supports real-time filtering and can be customized to fit various design needs. It is designed to work seamlessly within the AppBar, offering a clean and intuitive user experience. The package is maintained on GitHub and is suitable for developers seeking a straightforward solution for implementing search features in their Flutter applications.

Use cases

  • Implementing search in list views
  • Filtering data in real time
  • Enhancing app navigation with search
  • Integrating search into app bars
  • Building dynamic content filters

Key features

  • Auto-managed search state
  • Real-time filtering
  • AppBar integration
  • Minimal configuration
  • Customizable UI
  • Supports async filtering

Suitable for

  • Developers building search-heavy apps
  • Apps requiring quick search implementation
  • UI-focused projects needing clean search bars
  • Flutter beginners exploring search features
  • Projects with dynamic data sources

Considerations

  • Limited platform-specific customization
  • No built-in suggestions or autocomplete
  • Requires manual handling of async results
  • Not optimized for very large datasets
  • Depends on external state management for complex logic

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Archive Notice

This repository is archived. 3.0.0 is the last version that I will publish.

The SearchBar still works and it's pretty simple if you'd like to fork it. I just don't have the time to maintain it.

flutter_search_bar

A simple and mostly automatic material search bar for flutter (dart).

Note: use flutter_search_bar and not search_bar -- I own both packages but I'm just a tad bit locked out of search_bar, so it won't be updated.

Screenshots

Normal state (search is not active yet, only title and actions are set, with the only action being a search button)

Normal State

inBar set to false (background white, back button inherited):

inBar false

inBar set to true (background inherited):

inBar true

Usage

A simple usage example:

class _MyHomePageState extends State<MyHomePage> {
  SearchBar searchBar;
  
  AppBar buildAppBar(BuildContext context) {
    return new AppBar(
      title: new Text('My Home Page'),
      actions: [searchBar.getSearchAction(context)]
    );
  }  
  
  _MyHomePageState() {
    searchBar = new SearchBar(
      inBar: false,
      setState: setState,
      onSubmitted: print,
      buildDefaultAppBar: buildAppBar
    );
  }
  
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: searchBar.build(context)
    );
  }
}

This will create an AppBar with a search button as its only action, and on press the AppBar will turn white and have a TextField inside, allowing user input. Once the user has input something and pressed the "enter" button on their keyboard, it will close and the value will be printed to the debugger.

Using SearchBar

Essentially, this class returns two different app bars based on whether search is active.

The setState callback you pass the search bar can technically be any VoidCallback.

Features and bugs

Please file feature requests and bugs at the issue tracker.

We've recently added support for null-safety in 3.0.0 -- if you find any issues, please report them there!

Categories

Source repository

Projects using this package