Skip to content

Commit

Permalink
release 1.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
peng8350 committed May 27, 2019
1 parent 04ba7a9 commit e103f8a
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 31 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@ Notice: This version of the code changes much, Api too
* 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 attr in header
* 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
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ a widget provided to the flutter scroll component drop-down refresh and pull up
If you are Chinese,click here([中文文档](https://github.com/peng8350/flutter_pulltorefresh/blob/master/README_CN.md))

## Features
* Android and iOS both supported
* pull up and pull down
* It's almost fit for all Scroll witgets,like GridView,ListView...
* High extensibility,High degree of freedom
* powerful Bouncing
* support reverse ScrollView
* provide more refreshStyle: Behind,Follow,UnFollow
Expand Down Expand Up @@ -39,11 +37,11 @@ If you are Chinese,click here([中文文档](https://github.com/peng8350/flutter


## How to use?
the first way,use SmartRefresher and RefreshController
the first way,use SmartRefresher and RefreshController(Advice use this)
```
dependencies:
pull_to_refresh: ^1.3.8
pull_to_refresh: ^1.3.9
```

Expand All @@ -56,14 +54,13 @@ RefreshController _refreshController;
initState(){
super.initState();
_refreshController = RefreshController();
// if you need refreshing when init
// if you need refreshing when init,notice:initialRefresh is new after 1.3.9
_refreshController = RefreshController(initialRefresh:true);
/*
// before 1.3.9
SchedulerBinding.instance.addPostFrameCallback((_) {
_refreshController.requestRefresh();
});
*/
}
Expand Down
18 changes: 9 additions & 9 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,22 @@
```
dependencies:
pull_to_refresh: ^1.3.8
pull_to_refresh: ^1.3.9
```

第一种使用方法,使用SmartRefresh和RefreshController
第一种使用方法,使用SmartRefresh和RefreshController(建议)
```
RefreshController _refreshController;
initState(){
super.initState();
_refreshController = RefreshController();
// 如果你需要开始就请求一次刷新
/*
// initialRefresh可以在组件初始化时执行一次刷新操作
_refreshController = RefreshController(initialRefresh:true);
// 如果你需要开始就请求一次刷新,1.3.9版本之前要这么做
/*
SchedulerBinding.instance.addPostFrameCallback((_) {
_refreshController.requestRefresh();
Expand Down Expand Up @@ -142,30 +143,29 @@ void dispose(){
```


## 更多
- [SmartRefresher,RefreshController](refresher_controller.md)
- [自定义指示器](custom_indicator.md)
- [指示器内部属性介绍](indicator_attribute.md)
- [更新日志](CHANGELOG.md)
- [注意地方](notice.md)

## F.P.S
## F.A.Q
* <h3>IOS状态栏双击为什么ListView不自动滚动到顶部?</h3>
这个问题经测试不是我封装的失误,当ListView里的controller被替换后,这个问题就会出现,原因大概是Scaffold里的处理操作,请issue flutter。

* <h3>如何兼容NestedScrollView?</h3>
1.3.0提供了一个新属性isNestWrapped来兼容这东西,注意,这个属性打开后,scollController取决于NestScrollView,内部通过PrimaryScrollController.of(context)
来获取scrollController,所以scrollController要放在NestedScrollView里。

* <h3>为什么使用CuperNavigationBar后(不只这一个情况),顶部或者尾部指示器有空白的地方?</h3>
* <h3>为什么使用CuperNavigationBar后(不只这一个情况),顶部或者尾部指示器有空白的地方?Or why is top of listView blocked?</h3>
很大可能是因为SafeArea,。解决方法一般是在SmartRefresher外围套用SafeArea

* <h3>兼容性方面?</h3>
自1.3.0换了一套新的方法去实现指示器,内部指示器实现是通过监听scrollController位置变化来实现的,并没有使用到类如NotificationListener和GestureDector这类可能引起滑动手势冲突的方法,
所以应该可以兼容大多需要利用到手势之间的库。但是,可能不兼容一些库需要改写ScrollPhysics,内部的FrontStyle就很明显需要用到这个。



## 感谢

[SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout)
Expand Down
2 changes: 1 addition & 1 deletion example/lib/ui/MainActivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class _MainActivityState extends State<MainActivity>
physics: NeverScrollableScrollPhysics(),
),
headerBuilder: () => WaterDropHeader(waterDropColor: Colors.green,skipCanRefresh: true,),
footerBuilder: () => ClassicFooter(autoLoad: false,),
footerBuilder: () => ClassicFooter(),
),
),
decoration: BoxDecoration(color: Colors.purple),
Expand Down
5 changes: 3 additions & 2 deletions example/lib/ui/test/Example3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Example3State extends State<Example3> with TickerProviderStateMixin {
_refreshController.requestLoading();
}, child: Text("请求加载数据"))
],));
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 13; i++) {
data.add(GestureDetector(
child: Container(
color: Color.fromARGB(255, 250, 250, 250),
Expand Down Expand Up @@ -170,7 +170,8 @@ class Example3State extends State<Example3> with TickerProviderStateMixin {
onLoading: () {
print("onload");

Future.delayed(const Duration(milliseconds: 100)).then((val) {
Future.delayed(const Duration(milliseconds: 2000)).then((val) {
data.add(Card());
if(mounted)
setState(() {});
_refreshController.loadComplete();
Expand Down
2 changes: 2 additions & 0 deletions indicator_attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* double height: 指的是指示器占用多少高度。这个属性对于不同指示器风格意义不太一样。这个属性不会约束布局大小,子布局可以溢出这个值的范围。
* double triggerDistance: 触发刷新的越界距离
* refreshStyle: 用于限定头部刷新指示器的风格,四种:Front,Behind,Follow,UnFollow
* skipCanRefresh: 跳过canRefresh状态直接进入刷新状态
* completeDuration: 完成或者失败状态停留的时间


## 底部通用属性
Expand Down
6 changes: 3 additions & 3 deletions indicator_attribute_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
This property does not constrain the layout size, and sublayout can overflow the range of this value.
* double triggerDistance: the distance to triiger refresh
* refreshStyle: Styles used to define header refresh indicators,There is four style:Front,Behind,Follow,UnFollow
* completeDuration: stop time when state in success or fail


## ommon Footer attributes
## common Footer attributes
* double triggerDistance: the distance to trigger loading(extentAfter<=triggerDistance),need autoLoad = true
* bool hideWhenNotFull:Whether to automatically hide the bottom indicator when the page is less than one page, default to true
* () => {} onClick:Click on the callback method of the indicator to manually load data or reset the status of no data
Expand All @@ -23,7 +23,7 @@
* double spacing: Spacing between icons and text
* TextStyle textStyle: textStyle
* IconPosition iconPos:IconPosition(Left,Top,Right,Bottom)
* RefeshStyle refreshStyle,height,triggerDistance,autoLoad: the same Above
* RefreshStyle refreshStyle,height,triggerDistance,autoLoad: the same Above



Expand Down
6 changes: 2 additions & 4 deletions lib/src/smart_refresher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
createTime:2018-05-01 11:39
*/

import 'package:flutter/material.dart' as prefix0;
import 'package:flutter/widgets.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'internals/default_constants.dart';
Expand All @@ -13,7 +12,6 @@ import 'package:pull_to_refresh/src/internals/indicator_wrap.dart';
import 'package:pull_to_refresh/src/internals/refresh_physics.dart';
import 'indicator/classic_indicator.dart';
import 'indicator/material_indicator.dart';
import 'package:flutter/scheduler.dart';

typedef void OnOffsetChange(bool up, double offset);

Expand Down Expand Up @@ -271,13 +269,13 @@ class RefreshController {

void loadComplete() {
// change state after ui update,else it will have a bug:twice loading
SchedulerBinding.instance.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
footerMode?.value = LoadStatus.idle;
});
}

void loadNoData() {
SchedulerBinding.instance.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
footerMode?.value = LoadStatus.noMore;
});
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pull_to_refresh
description: a widget provided to the flutter scroll component drop-down refresh and pull up load.
version: 1.3.8
version: 1.3.9
author: Jpeng <peng8350@gmail.com>
homepage: https://github.com/peng8350/flutter_pulltorefresh

Expand Down
7 changes: 6 additions & 1 deletion refresher_controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@
// 内部暴露ScrollController,是为了某一种很特殊的情况需要去获取它,比如NestedScrollView,要获取innerScrollController,可以使用到它
ScrollController scrollController;
```
```

# IndicatorConfiguration(1.3.9新增)
增加这个功能,主要是考虑到一个App都是同样的顶部和底部指示器,或者多个页面之间拥有同样的指示器。所以使用IndicatorConfiguration,可以减少重复的工作。
在这个组件的子树下的SmartRefresher都会去引用IndicatorConfiguration里的指示器,假如SmartRefresher内部拥有header或者footer,则不会使用IndicatorConfiguration
里的指示器,而是使用自身的header和footer
7 changes: 6 additions & 1 deletion refresher_controller_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@
// Internal exposure of ScrollController is required for a very special situation, such as NestedScrollView, which can be used to obtain innerScrollController.
ScrollController scrollController;
```
```

# IndicatorConfiguration(1.3.9 new)
The main reason for adding this feature is that an App has the same top and bottom indicators, or that multiple pages have the same indicators. So using Indicator Configuration can reduce duplication of work.
Under the subtree of this component, Smart Refresher will refer to the indicator in Indicator Configuration. If Smart Refresher has a header or footer inside, it will not use Indicator Configuration.
Instead of using its own header and footer

0 comments on commit e103f8a

Please sign in to comment.