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

套件詳情v4.0.0

easy_refresh

一個提供下拉刷新和上拉載入的 Flutter 小部件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
4.7萬
喜歡數
573
Pub 分數
150

安裝套件

flutter pub add easy_refresh

套件介紹

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

EasyRefresh 是一個 Flutter 套件,可簡化在列表和可捲動元件中實作下拉刷新與下拉載入更多功能。它提供順暢且可自訂的刷新與載入指示器,設定簡單,支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。此套件透過在資料載入與重新整理作業期間提供即時回饋,提升使用者體驗。它能無縫整合至 ListView、GridView 及其他可捲動元件,非常適合用於動態內容顯示,例如資訊流或聊天介面。

適用情境

  • 在列表視圖中實現下拉刷新
  • 添加無限滾動和上拉加載
  • 建立響應式資料來源
  • 建構聊天或新聞應用介面
  • 增強可滾動內容的使用者體驗
  • 支援離線優先應用程式的同步指示器

主要特色

  • 下拉刷新,支援自訂指示器
  • 可設定閾值的上拉載入更多
  • 跨平台相容性
  • 可自定義的動畫和樣式
  • 內建的載入狀態和回呼
  • 與 ScrollViews 的簡單整合

適合對象

  • 開發清單密集型應用的開發者
  • 注重流暢使用者體驗的團隊
  • 需要無限滾動的項目
  • 具有即時資料更新的應用程式
  • 尋求快速實現的前端開發人員

使用建議

  • 可能需要額外的狀態管理
  • 自訂選項可能會增加複雜性
  • 如果未優化,大資料集會帶來效能影響
  • 對複雜嵌套滾動的內建支援有限
  • 依賴於對異步數據來源的正確處理

原始 README

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

flutter_easy_refresh

License Platform Flutter Pub

English | 中文

Just like the name, EasyRefresh can easily implement pull-down refresh and pull-up load on Flutter applications. It supports almost all Flutter Scrollable widgets. Its function is very similar to Android's SmartRefreshLayout, and it also absorbs the advantages of many third-party libraries. EasyRefresh integrates various styles of Header and Footer, but it has no limitations, you can easily customize it. Using Flutter's powerful animations, even just a simple control can be done. The goal of EasyRefresh is to create a powerful, stable and mature pull-to-refresh framework for Flutter.

Online demo
APK download
API reference

Features:

  • Supports all scrollable widgets
  • Scrolling physics scope, exactly matching scrollable widgets
  • Integrate multiple cool Header and Footer
  • Support custom styles to achieve various animation effects
  • Support pull-down refresh, pull-up load (Can be triggered and finished with a controller)
  • Support indicator position setting, combined with listeners can also be placed in any position
  • Support refresh when the page starts, and customize the view
  • Support safe area, no more occlusion
  • Customize scroll parameters to allow lists to have different scrolling feedback and inertia

Companion Packages

For pagination helpers, use the standalone easy_paging Pub package.

import 'package:easy_paging/easy_paging.dart';
import 'package:easy_refresh/easy_refresh.dart';

Sample implementation: example/lib/page/sample/paging_page.dart

Sample

1. Default constructor
  • In the child scope, all scrolling components will share one physics. If there is scroll nesting, use EasyRefresh.builder or set the scope with ScrollConfiguration
  EasyRefresh(
    onRefresh: () async {
      ....
    },
    onLoad: () async {
      ....
    },
    child: ListView(),
  );
2. Builder constructor
  EasyRefresh.builder(
    onRefresh: () async {
      ....
      return IndicatorResult.success;
    },
    onLoad: () async {
      ....
    },
    childBuilder: (context, physics) {
      return ListView(
        physics: physics,
      );
    },
  );
3. Indicator locate
  EasyRefresh(
    header: Header(
      position: IndicatorPosition.locator,
    ),
    footer: Footer(
      position: IndicatorPosition.locator,
    ),
    onRefresh: () async {
      ....
    },
    onLoad: () async {
      ....
      return IndicatorResult.noMore;
    },
    child: CustomScrollView(
      slivers: [
        SliverAppBar(),
        const HeaderLocator.sliver(),
        ...
        const FooterLocator.sliver(),
      ],
    ),
  );
4. Use controller
  EasyRefreshController _controller = EasyRefreshController(
    controlFinishRefresh: true,
    controlFinishLoad: true,
  );
  ....
  EasyRefresh(
    controller: _controller,
    onRefresh: () async {
      ....
      _controller.finishRefresh();
      _controller.resetFooter();
    },
    onLoad: () async {
      ....
      _controller.finishLoad(IndicatorResult.noMore);
    },
    ....
  );
  ....
  _controller.callRefresh();
  _controller.callLoad();
5. Specify Header and Footer
  EasyRefresh(
    header: MaterialHeader(),
    footer: MaterialFooter(),
    child: ListView(),
    ....
  );
  // Global
  EasyRefresh.defaultHeaderBuilder = () => ClassicHeader();
  EasyRefresh.defaultFooterBuilder = () => ClassicFooter();
6. NestedScrollView
  EasyRefresh.builder(
    header: MaterialHeader(
      clamping: true,
    ),
    onRefresh: () async {
      ....
    },
    onLoad: () async {
      ....
    },
    childBuilder: (context, physics) {
      return NestedScrollView(
        physics: physics,
        body: ListView(
          physics: physics,
        );
      );
    },
  );
  // or
  EasyRefresh.builder(
    header: MaterialHeader(
      clamping: true,
      position: IndicatorPosition.locator,
    ),
    onRefresh: () async {
      ....
    },
    onLoad: () async {
      ....
    },
    childBuilder: (context, physics) {
      return NestedScrollView(
        physics: physics,
        headerSliverBuilder: (context, innerBoxIsScrolled) {
          return [
            const HeaderLocator.sliver(clearExtent: false),
            ....
          ];
        },
        body: ListView(
          physics: physics,
        );
      );
    },
  );

Style Packages

Package Pub
easy_refresh_bubbles Pub
easy_refresh_bow Pub
easy_refresh_halloween Pub
easy_refresh_skating Pub
easy_refresh_space Pub
easy_refresh_squats Pub

Feel free to contribute

One's maintenance is lonely. If you have good suggestions and changes, feel free to contribute your code. If you have really cool styles, It's even cooler to share with everyone.

Thanks to all the people who already contributed!

QQ Group - 554981921

Into the group of instructions

The group is not only solve the problem of EasyRefresh, any Flutter related issues can be discussed. Just as its name, craigslist, as long as there is time, group of Lord will help you solve problems together.

Thanks

SmartRefreshLayout
flutter_spinkit

Licenses


MIT License

Copyright (c) 2018 xuelongqy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案