Giter VIP home page Giter VIP logo

giampaologabba / flutter_easy_refresh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xuelongqy/flutter_easy_refresh

0.0 0.0 0.0 122.6 MB

A flutter widget that provides pull-down refresh and pull-up load.

Home Page: https://xuelongqy.github.io/flutter_easy_refresh/

License: MIT License

Ruby 0.45% C++ 3.25% C 0.12% Objective-C 0.01% Kotlin 0.30% Dart 93.60% Swift 0.23% HTML 0.32% CMake 1.72%

flutter_easy_refresh's Introduction

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.

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

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,
        );
      );
    },
  );

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.

 

flutter_easy_refresh's People

Contributors

xuelongqy avatar laiiihz avatar giampaologabba avatar lay523 avatar linxunfeng avatar pwuts avatar hwh97 avatar hqwlkj avatar notbucai avatar imhansai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.