パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v3.0.0

flutter_search_bar

Flutter の AppBar 内に(ほとんど)自動的な検索バー

30日間ダウンロード
1110
いいね数
121
Pub ポイント
60

パッケージをインストール

flutter pub add flutter_search_bar

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

最小限の設定でAppBarに統合された検索バーを提供するFlutterパッケージです。検索入力、フィルタリング、UI更新を自動的に処理し、ボイラープレートをほとんど必要とせずにアプリに検索機能を追加できます。リアルタイムでのフィルタリングをサポートしており、さまざまなデザイン要件に合わせてカスタマイズ可能です。AppBar内でのスムーズな動作を考慮して設計されており、洗練された直感的なユーザー体験を提供します。このパッケージはGitHubでメンテナンスされており、Flutterアプリに検索機能を実装したい開発者にとって適しています。

用途

  • リストビューでの検索の実装
  • リアルタイムでのデータフィルタリング
  • 検索によるアプリナビゲーションの向上
  • アプリバーへの検索の統合
  • 動的コンテンツフィルタの構築

主な機能

  • 自動管理された検索状態
  • リアルタイムフィルタリング
  • AppBar 統合
  • 最小構成
  • カスタマイズ可能なUI
  • 非同期フィルタリングをサポート

適している対象

  • 検索中心のアプリを開発する開発者
  • 迅速な検索実装を必要とするアプリ
  • クリーンな検索バーを必要とするUI中心のプロジェクト
  • Flutterの初心者が検索機能を探求しています
  • 動的データソースを持つプロジェクト

注意事項

  • 制限されたプラットフォーム固有のカスタマイズ
  • 組み込みの提案や自動補完なし
  • 非同期結果の手動処理が必要です
  • 非常に大きなデータセットには最適化されていません
  • 複雑な論理のための外部状態管理に依存しています

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

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!

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト