pull_to_refresh 1.4.9 copy "pull_to_refresh: ^1.4.9" to clipboard
pull_to_refresh: ^1.4.9 copied to clipboard

outdated

a widget provided to the flutter scroll component drop-down refresh and pull up load.

flutter_pulltorefresh #

Intro #

a widget provided to the flutter scroll component drop-down refresh and pull up load.support android and ios. If you are Chinese,click here(中文文档)

Features #

  • pull up load and pull down refresh
  • It's almost fit for all Scroll witgets,like GridView,ListView...
  • provide global setting of default indicator and property
  • provide some most common indicators
  • Support Android and iOS default ScrollPhysics,the overScroll distance can be controlled
  • horizontal and vertical refresh,support reverse ScrollView also(four direction)
  • provide more refreshStyle: Behind,Follow,UnFollow,Front,provide more loadmore style
  • Support twoLevel refresh,implments just like TaoBao twoLevel,Wechat TwoLevel
  • enable link indicator which placing other place,just like Wechat FriendCircle refresh effect

Usage #

tips:
1.Because 1.3.0 has made great changes to the internal, version 1.3.0-1.3.9 is not recommended to use,there has a lot of Bug , 1.4.0 began to stabilize.
2.Make sure flutter sdk version >= 1.2.1


   dependencies:
     pull_to_refresh: ^1.4.9


import 'package:pull_to_refresh/pull_to_refresh.dart';

RefreshController _refreshController;

initState(){

    super.initState();
    // if you need refreshing when init,notice:initialRefresh is new  after 1.3.9
    _refreshController = RefreshController(initialRefresh:true);

}

void _onRefresh(){

   /*.  after the data return,
        use _refreshController.refreshComplete() or refreshFailed() to end refreshing
   */
}

void _onLoading(){
   /*
        use _refreshController.loadComplete() or loadNoData(),loadFailed() to end loading
   */
}

build(){
...
SmartRefresher(
      enablePullDown: true,
      enablePullUp: true,
      header: defaultTargetPlatform == TargetPlatform.iOS?WaterDropHeader():WaterDropMaterialHeader(),
      controller: _refreshController,
      onRefresh: _onRefresh,
      onLoading: _onLoading,
      child: "child",
    )
....
}

// don't forget to dispose refreshController
void dispose(){
    _refreshController.dispose();
    super.dispose();
}

In addition, if you have almost the same header and tail indicators for each page, consider using RefreshConfiguration , which reduces the repeatability of constructing headers and footers for each new page. At the same time, you can also set some global properties, such as whether to turn on automatic loading, refresh the trigger distance, whether to automatically hide the tail indicator should not meet a page. the example in my demo


    RefreshConfiguration(
        headerBuilder: () => WaterDropHeader(),
        footerBuilder:  () => ClassicFooter(),
        clickLoadingWhenIdle: true,
         headerTriggerDistance: 80.0,
         hideFooterWhenNotFull: true,
        child: .....
    )

ScreenShots #

Examples #

Style basic usage header in other place
art
Style reverse + horizontal twoLevel refresh
art
Style use with other widgets empty View
art
Style simple custom header(使用SpinKit) dragableScrollSheet+LoadMore
art

Indicator #

Refresh Style Loading Style
跟随 不跟随 永远显示 永远隐藏
背部 前面悬浮 当加载中才显示,其它隐藏
Style ClassicIndicator WaterDropHeader
art
Style MaterialClassicHeader WaterDropMaterialHeader
art
Style ShimmerIndicator
art

More #

Frequent problems #

  • IOS Status Bar Double-click Why ListView does not automatically scroll to the top?

    This problem is not my encapsulation error after testing. When the controller in ListView is replaced, this problem will occur, probably because of the processing operation in Scaffold.,please issue flutter。
  • Is Supporting NestedScrollView?

    It's not recommended to use NestedScrollView. Now I've found a problem (in conflict with Bouncing ScrollPhysics), which is similar in flutter issue (33367, 34316) and can only be solved by flutter. So it's better to use CustomScrollView to avoid using it, because there may be many unknown problems that I haven't found yet.
  • Why is it that after using Cuper Navigation Bar (and not just this case), part of the list header is obscured?

    Because I use CustomScrollView internally, and CustomScrollView doesn't inject padding like BoxScrollView does, so you need to inject padding or SafeArea yourself.
  • Compatibility?

    1.3.0 replaces a new method to implement the indicator. The internal indicator is implemented by monitoring scroll Controller position changes. There are no methods such as NotificationListener and GestureDector that may cause sliding gesture conflicts. So it should be compatible with most of the libraries that need to be used between gestures. However, some libraries may not be compatible and ScrollPhysics needs to be rewritten, which is clearly required for internal FrontStyle.

Thanks #

SmartRefreshLayout

LICENSE #


MIT License

Copyright (c) 2018 Jpeng

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.


2582
likes
0
pub points
99%
popularity

Publisher

unverified uploader

a widget provided to the flutter scroll component drop-down refresh and pull up load.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on pull_to_refresh