pull_to_refresh 1.4.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 95

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 and pull down
  • It's almost fit for all Scroll witgets,like GridView,ListView...
  • powerful Bouncing
  • support reverse ScrollView
  • provide more refreshStyle: Behind,Follow,UnFollow

ScreenShots #

Four RefreshStyle #

StyleFollowUnFollow
art
StyleBehindFront
art

Indicator #

StyleClassicIndicatorWaterDropHeader
art
StyleMaterialClassicHeaderWaterDropMaterialHeader
art

How to use? #

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.


   dependencies:
     pull_to_refresh: ^1.4.4


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() to end loading
   */
}

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

// 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: .....
    )

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 have found a problem that I need to modify the internal source code of NestedScrollView to solve. 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 there a empty space in the top or tail indicator after using CuperNavigationBar (not just in this case)?

    the reason may be SafeArea,the solution: wrap SmartRefresher in SafeArea

  • 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.

 

1.0.0 #

  • initRelease

1.0.1 #

  • Remove bottomColor

1.0.2 #

  • Add Failed RefreshMode when catch data failed
  • ReMake Default header and footer builder
  • Replace RefreshMode,loadMode to refreshing,loading
  • Replace onModeChange to onRefresh,onLoadMore

1.0.3 #

  • Fix error Props
  • Add interupt Scroll when failure status

1.0.4 #

  • Update README and demo

1.0.5 #

  • Remove headerHeight,footerHeight to get height inital
  • Make footer stay at the bottom of the world forever
  • replace idle to idel(my English mistake)
  • Fix defaultIndictor error Icon display

1.0.6 #

  • Use Material default LoadingBar
  • Add a bool paramter to onOffsetChange to know if pullup or pulldown
  • Fix Bug: when pulled up or pull-down, sizeAnimation and IOS elasticity conflict, resulting in beating.

1.0.7 #

  • Fix Bug1: The use of ListView as a container to cause a fatal error (continuous sliding) when the bottom control is reclaimed, using the SingleChildScrollView instead of preventing the base control from recovering many times from the exception
  • Fix Bug2: When the user continues to call at the same time in the two states of pull-down and drop down, the animation has no callback problem when it enters or fails.

1.0.8 #

  • Reproducing bottom indicator, no more manual drag to load more
  • Control property values change more,Mainly:1.onModeChange => onRefreshChange,onLoadChange, 2.Add enableAutoLoadMore,3.Remove bottomVisiableRange

1.1.0 #

Notice: This version of the code changes much, Api too

  • Transfer state changes to Wrapper of indicator to reduce unnecessary interface refresh.
  • No longer using Refreshmode or LoadMode,replaced int because the state is hard to determine.
  • Now support the ScrollView in the reverse mode
  • The indicators are divided into two categories, loadIndicator and refreshIndicator, and the two support header and footer
  • provided a controller to invoke some essential operations inside.
  • Move triggerDistance,completeTime such props to Config
  • Add ClassicIndicator Convenient construction indicator

1.1.1 #

  • Make triigerDistance be equally vaild for LoadWrapper
  • Add enableOverScroll attribute

1.1.2 #

  • Fix Bug:Refreshing the indicator requires multiple dragging to refresh
  • Fix ClassialIndicator syntax errors and display status when no data is added.

1.1.3 #

  • Fix contentList's item cannot be cached,Remove shrinkWrap,physics limit
  • Fix onOffsetChange callback error,In completion, failure, refresh state is also callback
  • Add unfollowIndicator implement in Demo(Example3)

1.1.4 #

  • Fix enableOverScroll does not work
  • Add default IndicatorBuilder when headerBuilder or footerBuilder is null
  • Fix cannot loading when user loosen gesture and listview enter the rebounding

1.1.5 #

  • Fix problem of offsetChange
  • Fix CustomScrollView didn't work
  • Fix refreshIcon not reference in ClassialIndicator

1.1.6 #

  • Fix Compile error after flutter update

1.2.0 #

  • Fixed the problem that ScrollController was not applied to internal controls
  • Optimize RefreshController
  • RefreshController changed to required now
  • Add feature:reuqestRefresh can jumpTo Bottom or Top
  • Fix problem: Refresh can still be triggered when ScrollView is nested internally
  • Remove rendered twice to get indicator height,replaced by using height attribute in Config
  • change RefreshStatus from int to enum

1.3.0 #

Total #

  • Support reverse ScrollView

  • Remove RefreshConfig,LoadConfig,Move to indicator setting

  • Add isNestWrapped to Compatible NestedScrollView

  • replace headerBuilder,footerBuilder attribute to header,footer

  • Separate header and footer operations:onRefresh and onLoading Callback,RefreshStatus is separated into RefreshStatus.LoadStatus

  • Fix Bug: twice loading (the footer state change before the ui update)

RefreshController #

  • Remove sendBack method,replaced by LoadComplete,RefreshComplete ,RefreshFailed,LoadNoData
  • Separate refresh and load operations
  • Add dispose method for Safety in some situation

Indicator #

  • Use another way to achieve drop-down refresh
  • Add drop-down refresh indicator style(Follow,UnFollow,Behind)
  • Add WaterDropIndicator,CustomIndicator
  • Make Custom Indicator easily

1.3.1 #

  • Add onClick CallBack for LoadIndicator
  • Fix enablepullUp or down invalid
  • Fix error Loading after 1.3.0 updated

1.3.2 #

  • Fix WaterDropHeader some attributes invalid
  • Fix enablePullUp and enablePullDown Dynamic set
  • implements auto hide FooterView when less than one page,no need to set enablePullUp to false
  • improve safety after disposed

1.3.3 #

  • Fixed the request Refresh problem: Sometimes it takes two times to be effective
  • Add child key support
  • Fix Bug:Pull-down triggers need to be pulled down more distances to trigger
  • Add resetNoData to resume footer state to idle

1.3.5 #

  • Add hideWhenNotFull bool to disable auto hide footer when data not enough one page
  • Add one new RefreshStyle:Front(just like RefreshIndicator)
  • Fix a bug: When the head overflows the view area, there is no clipping operation
  • Add material header(two indicator for FrontStyle)
  • Remove enableOverScroll

1.3.6 #

  • Fix NestedScrollView issue in 1.3.5
  • decrease default triggerDistance from 100.0 to 80.0
  • improve dragging scrolling speed of Front Style
  • Add offset attr in Front Style

1.3.7 #

  • Adding an asSlivers constructor can be inserted into slivers as a Sliver
  • Fix FrontStyle cannot support dynamic change enablePullDown
  • Fix FrontStyle cannot enter refresh state when init
  • Optimize indicator internal code to avoid locking widgets
  • Fix iOS click status cannot roll back without ScrollController in child
  • Fix one ignored situation after finish refresh -> completed(not in visual range)

1.3.8 #

  • Temporary fix deadly bug: PrimaryScrollController cannot shared by multiple Indicators

1.3.9 #

  • Avoid inner inject padding by buildSlivers in child(ListView,GridView)
  • Add initialRefresh in RefreshController(when you need to requestRefresh in initState)
  • Fix exception RefreshBouncingPhysics velocity value
  • Add IndicatorConfiguration for build indicator for subtrees SmartRefresher
  • Add SkipCanRefresh,CompleteDuration attr in header
  • Fix trigger more times loading when no data come in and too fast loadComplete
  • remove center,anchor in CustomScrollView to Compatible with old versions

1.4.0 #

  • Fix one serious Bug after 1.3.8 upgrade to 1.3.9:enablePullDown = false throw error

1.4.1 #

  • Remove isNestedWrapped(deprecated from 1.3.8)
  • Add headerInsertIndex attr in SmartRefresher
  • Rename IndicatorConfiguration to RefreshConfiguration
  • Move some attr from Indicator to RefreshConfiguration:offset,skipCanRefresh,triggerDistance,autoLoad,hideWhenNotFull
  • Add decoration for classicIndicator(both header and footer)
  • Add Fade effect for WaterDropHeader when dismiss
  • Simplify reverse operation,Add MaterialClassicHeader,WaterDropMaterialHeader reverse feature

1.4.2 #

  • Improving hideWhenNotFull judgment mechanism
  • Fix triggerDistance error after 1.4.0-1.4.1

1.4.3 #

  • change "child" attr limit type from ScrollView to Widget

1.4.4 #

  • Fix Bug:Multiples ScrollPositions shared one ScrollController,when calling controller.requestRefresh cause refresh together( such as keepAlive Widget )
  • When the user Dragging ScrollView(pull up), disable make it change to loading state
  • Add one new LoadStatus:failed(provide click to retry loading)
  • Fix some defaultIcon:noMoreIcon default Invisible

example/README.md

demo #

A new Flutter project.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pull_to_refresh: ^1.4.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pull_to_refresh/pull_to_refresh.dart';
  
Version Uploaded Documentation Archive
1.4.4 Jun 11, 2019 Go to the documentation of pull_to_refresh 1.4.4 Download pull_to_refresh 1.4.4 archive
1.4.3 Jun 7, 2019 Go to the documentation of pull_to_refresh 1.4.3 Download pull_to_refresh 1.4.3 archive
1.4.2 Jun 6, 2019 Go to the documentation of pull_to_refresh 1.4.2 Download pull_to_refresh 1.4.2 archive
1.4.1 Jun 4, 2019 Go to the documentation of pull_to_refresh 1.4.1 Download pull_to_refresh 1.4.1 archive
1.4.0 May 29, 2019 Go to the documentation of pull_to_refresh 1.4.0 Download pull_to_refresh 1.4.0 archive
1.3.9 May 27, 2019 Go to the documentation of pull_to_refresh 1.3.9 Download pull_to_refresh 1.3.9 archive
1.3.8 May 24, 2019 Go to the documentation of pull_to_refresh 1.3.8 Download pull_to_refresh 1.3.8 archive
1.3.7 May 24, 2019 Go to the documentation of pull_to_refresh 1.3.7 Download pull_to_refresh 1.3.7 archive
1.3.6 May 21, 2019 Go to the documentation of pull_to_refresh 1.3.6 Download pull_to_refresh 1.3.6 archive
1.3.5 May 20, 2019 Go to the documentation of pull_to_refresh 1.3.5 Download pull_to_refresh 1.3.5 archive

All 31 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
98
Health:
Code health derived from static analysis. [more]
86
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
95
Learn more about scoring.

We analyzed this package on Jun 12, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.17
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/internals/indicator_wrap.dart. (-8.17 points)

Analysis of lib/src/internals/indicator_wrap.dart reported 17 hints, including:

line 8 col 8: Unused import: 'package:flutter/semantics.dart'.

line 104 col 19: The member 'activity' can only be used within instance members of subclasses of 'package:flutter/src/widgets/scroll_position.dart'.

line 104 col 19: The member 'activity' can only be used within 'package:flutter/src/widgets/scroll_position.dart' or a test.

line 105 col 19: The member 'activity' can only be used within instance members of subclasses of 'package:flutter/src/widgets/scroll_position.dart'.

line 105 col 19: The member 'activity' can only be used within 'package:flutter/src/widgets/scroll_position.dart' or a test.

Fix lib/src/smart_refresher.dart. (-3.45 points)

Analysis of lib/src/smart_refresher.dart reported 7 hints, including:

line 92 col 25: 'scrollController' is deprecated and shouldn't be used.

line 94 col 25: 'scrollController' is deprecated and shouldn't be used.

line 99 col 7: Avoid empty statements.

line 175 col 45: The member 'buildChildLayout' can only be used within instance members of subclasses of 'package:flutter/src/widgets/scroll_view.dart'.

line 199 col 35: The member 'buildSlivers' can only be used within instance members of subclasses of 'package:flutter/src/widgets/scroll_view.dart'.

Fix lib/src/internals/refresh_physics.dart. (-1.99 points)

Analysis of lib/src/internals/refresh_physics.dart reported 4 hints:

line 75 col 26: The member 'activity' can only be used within instance members of subclasses of 'package:flutter/src/widgets/scroll_position.dart'.

line 75 col 26: The member 'activity' can only be used within 'package:flutter/src/widgets/scroll_position.dart' or a test.

line 81 col 26: The member 'activity' can only be used within instance members of subclasses of 'package:flutter/src/widgets/scroll_position.dart'.

line 81 col 26: The member 'activity' can only be used within 'package:flutter/src/widgets/scroll_position.dart' or a test.

Fix lib/src/indicator/material_indicator.dart. (-0.50 points)

Analysis of lib/src/indicator/material_indicator.dart reported 1 hint:

line 217 col 23: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/indicator/waterdrop_header.dart. (-0.50 points)

Analysis of lib/src/indicator/waterdrop_header.dart reported 1 hint:

line 10 col 8: Unused import: 'package:flutter/material.dart'.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test