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

table_sticky_headers 표지
패키지 상세v2.0.5

table_sticky_headers

두 방향의 고정 헤더를 가진 2차원 표입니다. 좌우 및 상하로 스크롤할 수 있습니다. 고정 헤더는 항상 보입니다. 범례 셀(좌상단)도 항상 보입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.6천
좋아요
191
Pub 점수
150

패키지 설치

flutter pub add table_sticky_headers

패키지 개요

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

수평 및 수직 스크롤 중에도 고정 헤더가 항상 보이도록 하는 2차원 표를 생성하기 위한 플러터 패키지입니다. 상단 왼쪽의 '범례' 셀도 고정되어 일관된 참조 지점을 보장합니다. 헤더 컨텍스트를 스크롤 중에도 유지해야 하는 데이터 중심 인터페이스에 적합합니다. 모바일, 웹, 데스크톱을 포함한 모든 주요 플랫폼을 지원합니다.

사용 사례

  • 지속적인 헤더를 가진 데이터 그리드
  • 재무 또는 재고 대시보드
  • 내비게이션을 포함한 복잡한 테이블 레이아웃
  • 대규모 데이터셋을 갖춘 보고 도구
  • 고정된 참조 지점을 요구하는 사용자 인터페이스

주요 기능

  • 스티키 열과 행 헤더
  • 왼쪽 상단 모서리에 고정된 범례 셀
  • 부드러운 수평 및 수직 스크롤링
  • 크로스 플랫폼 호환성
  • 사용자 정의 스타일 및 레이아웃
  • 다양한 화면 크기에 대응하는 반응형 디자인

적합한 대상

  • 복잡한 데이터 테이블을 구축하는 개발자
  • 지속적인 헤더 표시가 필요한 앱
  • 대규모 데이터 세트를 가진 대시보드
  • 표 형식 데이터를 갖춘 데스크톱 및 모바일 애플리케이션
  • 직관적인 데이터 탐색이 필요한 UI

고려 사항

  • 매우 큰 데이터 세트와 함께 성능에 영향을 줄 수 있습니다
  • 최적의 UX를 위해 신중한 레이아웃 계획이 필요합니다
  • 제한된 내장 정렬/필터링 기능
  • 스타일 맞춤 설정은 고급 플러터 지식이 필요할 수 있습니다
  • 간단한 일차원 목록에 적합하지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Table Sticky Headers

This package for Flutter allows you to display two-dimension table with both sticky headers.

Key of this package is sticky headers. You can scroll table any direction and headers (top and left) will always stay. Cells themselves are fully customizable as you can fill them with Widgets.

To work with table you need to fill it with data. It has three builders for generating title column (List), title row (List) and content itself (List.

Simplest UseCase. You have two-dimensional array of Strings. Builder takes value from array and generates Text widget:

contentCellBuilder: (i, j) => Text(data[i][j]),

For more advanced usage - decorate Text with other widgets like borders, cell colors, etc. Check decorated_example.dart to see it in action. You can also wrap cell with tap listeners and add custom behavior on tap. Check tap_handler_example.dart.

The cell dimensions can be customized using the cellDimensions property of StickyHeadersTable. Use:

  • CellDimensions.base: Default fixed values.
  • CellDimensions.uniform: Same dimensions for each cell.
  • CellDimensions.fixed: Custom fixed width and height for each content cell.
  • CellDimensions.variableColumnWidth: Different width for each column.
  • CellDimensions.variableRowHeight: Different height for each row.
  • CellDimensions.variableColumnWidthAndRowHeight: Different width for each column and different height for each row.

The alignment of the cell contents can be customized using the cellAlignments property of StickyHeadersTable. Use:

  • CellAlignments.base: Default alignment value (Alignment.center).
  • CellAlignments.uniform: Same alignment for each cell.
  • CellAlignments.fixed: Same alignment for each content cell, but different alignment for the sticky column, row and legend.
  • CellAlignments.variableColumnAlignment: Different alignment for each column.
  • CellAlignments.variableRowAlignment: Different alignment for each row.
  • CellAlignments.variable: Different alignment for every cell.

You can provide functions that execute when tapping a cell by setting the properties:

  • onStickyLegendPressed: () => print('Sticky legend pressed.'),
  • onColumnTitlePressed: (i) => print('Column $i title pressed.'),
  • onRowTitlePressed: (j) => print('Row $j title pressed.'),
  • onContentCellPressed: (i, j) => print('Cell at column $i, row $j pressed.'),

You can provide offset to the table for X and Y, by using either double offset or cell index offset:

  • initialScrollOffsetX
  • initialScrollOffsetY or
  • scrollOffsetIndexX
  • scrollOffsetIndexY

You can also set a callback for when the scrolling ends by setting the onEndScrolling property.

By combining the two above features, you can return to the previous scroll position after a rebuild. See example below:

double _scrollOffsetX = 0.0;
double _scrollOffsetY = 0.0;

StickyHeadersTable(
  // ... other properties ...
  initialScrollOffsetX: _scrollOffsetX,
  initialScrollOffsetY: _scrollOffsetY,
  onEndScrolling: (scrollOffsetX, scrollOffsetY) {
    _scrollOffsetX = scrollOffsetX;
    _scrollOffsetY = scrollOffsetY;
  },
)

You can also define a custom set of scroll controllers for both title and body with the scrollControllers property. IMPORTANT: don't forget to dispose your scroll controllers if you are using this field. Otherwise table will take care of disposal.

Feature requests and PRs are welcome.

Examples

Widget usage example:

// titleColumn - List<String> (title column)
// titleColumn - List<String> (title row)
// titleColumn - List<List<String>> (data)

StickyHeadersTable(
          columnsLength: titleColumn.length,
          rowsLength: titleRow.length,
          columnsTitleBuilder: (i) => Text(titleColumn[i]),
          rowsTitleBuilder: (i) => Text(titleRow[i]),
          contentCellBuilder: (i, j) => Text(data[i][j]),
          legendCell: Text('Sticky Legend'),
        ),

Visit examples to see it in details

Support

Please file issues and feature requests.

Project is on support-only mode. Feel free to contact me so I can share access rights to publish updates and maintain.

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

카테고리

소스 저장소

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