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

sticky_and_expandable_list 표지
패키지 상세v1.1.3

sticky_and_expandable_list

섹션 전개/접기 및 스티키 헤더를 지원하는 그룹화된 목록을 만들고, 슬리버 위젯과 함께 사용할 수 있도록 합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
7.8천
좋아요
175
Pub 점수
140

패키지 설치

flutter pub add sticky_and_expandable_list

패키지 개요

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

계층적으로 콘텐츠를 정리하는 데 적합한 그룹화된 목록을 만들 수 있게 해주는 플러터 패키지입니다. 접을 수 있는 섹션과 스틱 헤더를 지원하며, Sliver 위젯과 원활하게 통합되어 CustomScrollView와 같은 사용자 지정 스크롤 뷰에서 사용하기에 적합합니다. Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원하며 장치 간 일관된 경험을 제공합니다. 최소한의 보일러플레이트 코드로 복잡한 리스트 상호작용을 단순화합니다.

사용 사례

  • 그룹화된 데이터 표시
  • 접을 수 있는 섹션 목록
  • 스티키 헤더 탐색
  • 사용자 정의 스크롤 뷰
  • 동적 콘텐츠 구성
  • 긴 목록을 위한 개선된 사용자 인터페이스

주요 기능

  • 확장 가능/접을 수 있는 섹션
  • 스티키 섹션 헤더
  • Sliver 위젯 호환성
  • 크로스 플랫폼 지원
  • 필요한 설정 최소화
  • 부드러운 애니메이션

적합한 대상

  • 복잡한 목록을 구축하는 개발자
  • 인터랙티브 레이아웃이 필요한 UI 디자이너
  • 계층적 데이터를 가진 앱
  • 헤더가 있는 스크롤 가능한 인터페이스
  • 모바일 및 웹 애플리케이션

고려 사항

  • 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

카테고리

소스 저장소

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