패키지, 저장소 및 앱 카테고리 검색

searchable_listview 표지
패키지 상세v2.19.5

searchable_listview

간단한 구현으로 ListView를 필터링하는 새로운 쉬운 방법이며, 검색 필드와 빈 위젯을 사용자 정의할 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
7.8천
좋아요
267
Pub 점수
160

패키지 설치

flutter pub add searchable_listview

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

내장된 검색 바를 사용하여 ListView를 필터링하는 것을 간편하게 만드는 플러터 패키지입니다. 최소한의 코드로 빠르게 검색 가능한 목록을 구현할 수 있으며, 검색 필드와 빈 상태 위젯에 대한 커스터마이징 옵션을 제공합니다. 이 패키지는 모든 주요 플랫폼을 지원하며, 사용하기 쉬운 설계로 동적 콘텐츠 필터링이 필요한 앱에 적합합니다. 직관적인 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.