搜尋套件、儲存庫與 APP 分類

loadmore 封面
套件詳情v2.1.0

loadmore

ListView 滾動到底部時,可以載入更多資料。幫助開發者實作分頁載入資料。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1萬
喜歡數
226
Pub 分數
150

安裝套件

flutter pub add loadmore

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

loadmore 套件透過偵測 ListView 到達底部時觸發分頁資料載入,簡化了在 Flutter 應用中實作無限捲動。它幫助開發者有效管理內容的延遲載入,減少記憶體使用並提升大資料集呈現時的效能。此套件專為與 ListView 及其他可捲動元件無縫整合而設計,支援 Android、iOS、Web、macOS、Windows 與 Linux 多個平台。該套件輕量且易於使用,僅需最少設定即可實現使用者滾動時順暢按需取得資料。

適用情境

  • 無限滾動資訊流
  • 懶加載清單
  • 分頁資料檢索
  • 動態內容加載
  • 電子商務產品網格

主要特色

  • 自動滾動檢測
  • 與 ListView 的輕鬆整合
  • 支援多個平台
  • 最少的樣板程式碼
  • 可設定的載入指示器

適合對象

  • 開發可捲動內容的開發者
  • 大型資料集的應用程式
  • 分頁密集型 UI
  • 跨平台行動與Web應用
  • 高效的資料載入實作

使用建議

  • 需要手動處理資料狀態
  • 不適用於固定長度的清單
  • 可能需要自定義錯誤處理
  • 依賴外部資料來源
  • 對複雜滾動行為的自訂有限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

loadmore

pub package GitHub

A loadMore library

Support ListView and SliverList

中文构思思路和使用说明可以看简书

screenshot

img

whole example

show https://github.com/CaiJingLong/flutter_listview_loadmore

install

in pubspec.yaml

dependencies:
  loadmore: ^2.0.1

import in dartfile:

import 'package:loadmore/loadmore.dart';

use in build:

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: Container(
        child: LoadMore(
          isFinish: count >= 60,
          onLoadMore: _loadMore,
          child: ListView.builder(
            itemBuilder: (BuildContext context, int index) {
              return Container(
                child: Text(list[index].toString()),
                height: 40.0,
                alignment: Alignment.center,
              );
            },
            itemCount: count,
          ),
        ),
      ),
    );
  }

  Future<bool> _loadMore() async {
    print("onLoadMore");
    await Future.delayed(Duration(seconds: 0, milliseconds: 100));
    load();
    return true;
  }

properties use:

child: Widget ,required , support ListView ListView.builder ListView.separated, other is not support.
onLoadMore:required A Function , `typedef Future<bool> FutureCallBack();` , reture true is success and status delay,return false or null ,then the status will change to fail.
isFinish: bool, optional, if true, then the status will change to finish ,default is false
delegate: LoadMoreDelegate,optional, see the LoadMoreDelegate class,default is DefaultLoadMoreDelegate
textBuilder: optional, the result will show in loading view ,if you use default delegate. default is DefaultLoadMoreText.chinese,
whenEmptyLoad: bool ,optional, default is true, when [whenEmptyLoad] is true, and when listView children length is 0,or the itemCount is 0,not build loadMoreWidget.
abstract class LoadMoreDelegate {
  const LoadMoreDelegate();

  double widgetHeight(LoadMoreStatus status) => _defaultLoadMoreHeight; // the loadMore height. default is 80.0

  Duration loadMoreDelay() => Duration(milliseconds: _loadMoreDelay);// When widget is created, the refresh delay time is triggered.

  Widget buildChild(LoadMoreStatus status); // build your widget in the loadmore widget.
}

other

homePage: https://github.com/CaiJingLong/flutter_listview_loadmore emailto me : cjl_spy@163.com

LICENSE

APACHE 2.0

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。