FLUTTER ECOSYSTEM

dharmendraiosdev/flutter_section_list_view

支援類似 iOS UITableView 分區的擴展 Flutter ListView

flutter_section_list_view 專案封面
Stars
7
Forks
3
最近推送(UTC)
2023年11月14日
專案狀態
未封存
dharmendraiosdev GitHub avatar
語言DartSwiftKotlinObjective-C

此儲存庫發佈的套件

使用的依賴

依賴清單 2 項
  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

flutter_section_list_view

A flutter list view which supports sections like iOS UITableView with no overhead

Usage

To use this plugin, add flutter_section_list_view as a dependency in your pubspec.yaml file.

Getting Started

Import this class
import 'flutter_section_list_view/flutter_section_list_view.dart';
Add flutter_section_list_view Widget

After importing this plugin to your project, you can simply use it as a normal widget


FlutterSectionListView(
        numberOfSection: 4,
        numberOfRowsInSection: (section) {
          return section * 3 + 1;
        },
        sectionWidget: (section) {
          return Container(child: Padding(
            padding: const EdgeInsets.all(8),
            child: Text('Section $section'),
          ), color: Colors.grey,);
        },
        rowWidget: (section, row) {
          return Container(
            child: Padding(
              padding: EdgeInsets.all(8),
              child: Text('Row $section - $row'),
            ),
          );
        },
      )

To use Pull-To-Refresh feature, simply provide value to attribute 'refresh', a callback function

listView.refresh = () async {
      await new Future.delayed(new Duration(seconds: 3));
      print('List Refreshed');
    };

For Pagination feature, provide value to attribute 'loadMoreData', a callback function

listView.loadMoreData = () async {
      await new Future.delayed(new Duration(seconds: 2));
      print('More Data loaded and List refreshed');
      /// set 'isMoreAvailable' attribute to 'false' when there are no more pages to return 
      listView.isMoreAvailable = false;
    };