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

searchable_listview のカバー
パッケージ詳細v2.19.5

searchable_listview

簡単な実装でListViewをフィルタリングする新しい方法。検索フィールドと空のウィジェットをカスタマイズ可能。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
7820
いいね数
267
Pub ポイント
160

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

flutter pub add searchable_listview

パッケージ概要

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

組み込みの検索バーを使用してListViewをフィルタリングするのを簡単にするFlutterパッケージです。最小限のコードで検索可能なリストを迅速に実装でき、検索フィールドと空状態ウィジェットのカスタマイズオプションを提供します。このパッケージはすべての主要プラットフォームをサポートしており、使いやすさを重視して設計されており、動的なコンテンツフィルタリングが必要なアプリに最適です。シンプルなAPIにより、既存のプロジェクトにスムーズに統合できます。

用途

  • 連絡先リストのフィルタリング
  • 製品カタログの検索
  • ダッシュボードでの動的データ検索
  • ユーザー主導のコンテンツフィルタリング
  • アプリインターフェースでのリアルタイム検索

主な機能

  • シンプルな実装
  • カスタマイズ可能な検索フィールド
  • 設定可能な空状態
  • クロスプラットフォーム対応
  • 組み込みのフィルターロジック
  • 最小限のボイラープレート

適している対象

  • 迅速な検索統合を求める開発者
  • 大規模なデータセットを含むアプリ
  • UI重視のアプリケーション
  • 検索機能のプロトタイピング
  • 初心者向けのFlutterプロジェクト

注意事項

  • 限定的な高度なフィルタリングオプション
  • 組み込みのページネーションなし
  • 複雑なデータ構造の手動処理が必要です
  • 追加の最適化なしでは、非常に大きなデータセットには最適化されていません
  • 動的更新には外部の状態管理に依存しています

元の README

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

Searchable ListView

Searchable ListView

An easy-to-use Flutter widget for adding a searchable, sortable, and paginated list UI. Supports synchronous lists, asynchronous data sources, expansion groups, slivers, pull-to-refresh, and many customization options.

Package: searchable_listview

Features

  • Filter lists on edit or submit
  • Support for async data sources and async filtering
  • Expansion-group lists with searchable group contents
  • Optional sort widget and custom sort predicate
  • Pagination and onPaginate callback
  • Pull-to-refresh support
  • Sliver-based scrolling effect
  • Customizable loading / error / empty widgets
  • Customizable search field (decoration, input type, icons, width/height)
  • Auto-complete hints and secondary widgets next to the search field

Installation

Add the package to your pubspec.yaml:

dependencies:
  searchable_listview: ^2.19.5

Then run:

flutter pub get

Quick Start

Basic synchronous list example:

SearchableList<Actor>(
  initialList: actors,
  itemBuilder: (actor) => ActorItem(actor: actor),
  filter: (query) => actors
      .where((a) => a.name.toLowerCase().contains(query.toLowerCase()))
      .toList(),
  emptyWidget: const Center(child: Text('No results')),
  inputDecoration: InputDecoration(labelText: 'Search actor'),
)
Async list example

Use the .async constructor when data comes from a Future and you need to filter the returned list:

SearchableList<Actor>.async(
  asyncListCallback: () async => await fetchActors(),
  asyncListFilter: (query, list) =>
      list.where((a) => a.name.contains(query)).toList(),
  itemBuilder: (actor) => ActorItem(actor: actor),
  loadingWidget: const Center(child: CircularProgressIndicator()),
  errorWidget: const Center(child: Icon(Icons.error)),
)
Expansion groups

For grouped/expansion lists use the .expansion constructor:

SearchableList<Actor>.expansion(
  expansionListData: mapOfActors,
  expansionTitleBuilder: (key) => Text(key.toString()),
  filterExpansionData: (query) => {
    for (final entry in mapOfActors.entries)
      entry.key: (mapOfActors[entry.key] ?? [])
          .where((a) => a.name.contains(query))
          .toList()
  },
  expansionListBuilder: (index, actor) => ActorItem(actor: actor),
)
Sliver list

Use .sliver to embed a searchable list inside sliver scroll views:

SearchableList<Actor>.sliver(
  initialList: actors,
  itemBuilder: (actor) => ActorItem(actor: actor),
  filter: (q) => actors.where((a) => a.name.contains(q)).toList(),
)

Common Parameters

  • initialList — initial synchronous list of items
  • filter — synchronous filter callback (String -> List)
  • asyncListCallback — Future that returns a List
  • asyncListFilter — filter that applies to results from asyncListCallback
  • itemBuilder — builder for list item widgets
  • emptyWidget, loadingWidget, errorWidget — custom widgets for states
  • onPaginate — callback when list reaches the end (for pagination)
  • inputDecoration, textStyle, textInputType — search field customization
  • sortWidget, sortPredicate — optional sorting UI and comparator
  • closeKeyboardWhenScrolling — whether scrolling hides the keyboard

For a complete list of available parameters and detailed API, see the library documentation or the source code in lib/searchable_listview.dart.

Example App

See the example/ folder for a runnable demo with multiple configurations and screenshots.

Example

Contributing

Contributions, issues and feature requests are welcome. Feel free to check the example/ folder for usage examples and open a pull request.

  • Report bugs by opening an issue
  • Suggest features by opening an issue
  • Submit pull requests for fixes and improvements

Repository: https://github.com/koukibadr/Searchable-Listview

License

This project is licensed under the terms in the LICENSE file.

Contributors

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

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

データはまだありません。