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

sticky_and_expandable_list のカバー
パッケージ詳細v1.1.3

sticky_and_expandable_list

セクションの展開/折りたたみとスタックヘッダーをサポートするグループ化リストを作成し、スリバーウィジェットと併用できるようにします。

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

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

flutter pub add sticky_and_expandable_list

パッケージ概要

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

階層的なコンテンツの整理に適した、折りたたみ可能なセクションとスタックヘッダーを備えたグループ化リストの作成を可能にするFlutterパッケージです。Sliverウィジェットとシームレスに統合されており、CustomScrollViewなどのカスタムスクロールビューでの使用に適しています。Android、iOS、Web、macOS、Windows、Linuxなどすべての主要プラットフォームをサポートし、デバイス間で一貫した体験を提供します。最小限のボイラープレートコードで複雑なリスト操作を簡略化します。

用途

  • グループ化されたデータ表示
  • 折りたたみ可能なセクションリスト
  • スタティックヘッダーのナビゲーション
  • カスタムスクロールビュー
  • 動的コンテンツの整理
  • 長いリスト用の拡張ユーザーインターフェース

主な機能

  • 展開可能/折りたたみ可能なセクション
  • スタックされたセクションヘッダー
  • Sliver ウィジェットの互換性
  • クロスプラットフォーム対応
  • 最小限のセットアップが必要
  • スムーズなアニメーション

適している対象

  • 複雑なリストを構築する開発者
  • インタラクティブなレイアウトを必要とするUIデザイナー
  • 階層データを持つアプリケーション
  • ヘッダー付きのスクロール可能なインターフェース
  • モバイルおよびWebアプリケーション

注意事項

  • Sliver ウィジェットの理解が必要です
  • 非常に大きなデータセットではパフォーマンスに影響を与える可能性があります
  • 基本的なスタイリングを超えるカスタマイズが限られている
  • 中程度のグループ化データに最適
  • 単純なフラットリストには推奨されません

元の README

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

sticky_and_expandable_list

Flutter implementation of sticky headers and expandable list.Support use it in a CustomScrollView.

Pub README i18n:中文说明

Screenshot

Features

  • Build a grouped list, which support expand/collapse section and sticky header.
  • Use it with CustomScrollView、SliverAppBar.
  • Listen the scroll offset of current sticky header, current sticky header index and switching header index.
  • Only use one list widget, so it supports large data and a normal memory usage.
  • More section customization support, you can return a new section widget by sectionBuilder, to customize background,expand/collapse animation, section layout, and so on.
  • Support add divider.
  • Support overlap content.
  • Support scroll to index like ListView, by scroll-to-index.
  • Pull to refresh and load more, by pull_to_refresh.

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  sticky_and_expandable_list: ^1.1.3

Basic Usage

sectionList is a custom data source for ExpandableListView. We should create a model list to store the information of each section, the model must implement ExpandableListSection.

    //In this example, we create a custom model class(ExampleSection).
    //class ExampleSection implements ExpandableListSection<String> {}
    //so: SliverExpandableChildDelegate<String, ExampleSection>()
    List<ExampleSection> sectionList = List<ExampleSection>();
    return ExpandableListView(
      builder: SliverExpandableChildDelegate<String, ExampleSection>(
          sectionList: sectionList,
          headerBuilder: (context, sectionIndex, index) =>
              Text("Header #$sectionIndex"),
          itemBuilder: (context, sectionIndex, itemIndex, index) {
            String item = sectionList[sectionIndex].items[itemIndex];
            return ListTile(
              leading: CircleAvatar(
                child: Text("$index"),
              ),
              title: Text(item),
            );
          }),
    );

Detail Examples

If you want to use it with sliver widget, use SliverExpandableList instead of ExpandableListView.

FAQ

How to expand/collapse item?
setState(() {
  sectionList[i].setSectionExpanded(true);
});

Example

How to listen current sticky header or the sticky header scroll offset?
  @override
  Widget build(BuildContext context) {
    ExpandableListView(
      builder: SliverExpandableChildDelegate<String, ExampleSection>(
        headerController: _getHeaderController(),
      ),
    )
  }

  _getHeaderController() {
    var controller = ExpandableListController();
    controller.addListener(() {
      print("switchingSectionIndex:${controller.switchingSectionIndex}, stickySectionIndex:" +
          "${controller.stickySectionIndex},scrollPercent:${controller.percent}");
    });
    return controller;
  }
How to set background for each section?

Use sectionBuilder

Customize expand/collapse animation support?

Example

Change Log

CHANGELOG

カテゴリー

ソースリポジトリ

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