Skip to content

Commit

Permalink
release 1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
peng8350 committed Jun 11, 2019
1 parent d28df5a commit 485d870
Show file tree
Hide file tree
Showing 31 changed files with 595 additions and 525 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,10 @@ Notice: This version of the code changes much, Api too
* Fix triggerDistance error after 1.4.0-1.4.1

## 1.4.3
* change "child" attr limit type from ScrollView to Widget
* 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
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ If you are Chinese,click here([中文文档](https://github.com/peng8350/flutter

## 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.3
pull_to_refresh: ^1.4.4
```

Expand Down Expand Up @@ -128,10 +129,10 @@ the [example](https://github.com/peng8350/flutter_pulltorefresh/blob/master/exam
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。

* <h3>How to use it with NestedScrollView?</h3>
1.3.0 provides a new attribute isNestWrapped for compatibility. Note that when this attribute is opened, scollController depends on NestScrollView,
internally via PrimaryScrollController. of (context) To get scrollController, scrollController is placed in NestedScrollView。
(The isNestWrapped attribute is unnecessary after 1.3.8)
* <h3>Is Supporting NestedScrollView?</h3>
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.

* <h3>Why is there a empty space in the top or tail indicator after using CuperNavigationBar (not just in this case)?</h3>
the reason may be SafeArea,the solution: wrap SmartRefresher in SafeArea
Expand Down
10 changes: 5 additions & 5 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@

## 我该怎么用?


因1.3.0对内部进行了很大的变动,1.3.0~1.3.9版本不建议使用,Bug较多,1.4.0开始稳定
```
dependencies:
pull_to_refresh: ^1.4.3
pull_to_refresh: ^1.4.4
```

Expand Down Expand Up @@ -126,9 +126,9 @@ header和footer的重复性的工作,在RefreshConfiguration子树下的SmartRef
* <h3>IOS状态栏双击为什么ListView不自动滚动到顶部?</h3>
这个问题经测试不是我封装的失误,当ListView里的controller被替换后,这个问题就会出现,原因大概是Scaffold里的处理操作,请issue flutter。

* <h3>如何兼容NestedScrollView?</h3>
1.3.0提供了一个新属性isNestWrapped来兼容这东西,注意,这个属性打开后,scollController取决于NestScrollView,内部通过PrimaryScrollController.of(context)
来获取scrollController,所以scrollController要放在NestedScrollView里。(1.3.8后isNestWrapped就没必要使用了)
* <h3>NestedScrollView兼容性?</h3>
不建议使用NestedScrollView,目前我已经发现了一个问题,要修改NestedScrollView内部源代码才能解决,所以最好用CustomScrollView,避免使用它,
因为可能还有很多未知的问题我还没有发现。

* <h3>为什么使用CuperNavigationBar后(不只这一个情况),顶部或者尾部指示器有空白的地方?</h3>
很大可能是因为SafeArea,。解决方法一般是在SmartRefresher外围套用SafeArea
Expand Down
2 changes: 1 addition & 1 deletion example/lib/ui/Item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import 'package:flutter/material.dart';

class Item extends StatefulWidget {

final String title;

Item({this.title});

@override
_ItemState createState() => _ItemState();
}
Expand Down
86 changes: 55 additions & 31 deletions example/lib/ui/MainActivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,32 @@ class _MainActivityState extends State<MainActivity>
// TODO: implement build
return ResideMenu.scaffold(
controller: _menuController,
enable3dRotate: true,
enable3dRotate: true,
child: Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(_tabIndex == 0
? "指示器界面"
: _tabIndex == 1 ? "测试界面" : _tabIndex == 2 ? "样例界面" : "App界面"),
leading: GestureDetector(child: Icon(Icons.menu),onTap: (){
_menuController.openMenu(true);
},),
backgroundColor: Colors.greenAccent,
bottom: _tabIndex==2?TabBar(isScrollable: true,
tabs: [
Tab(child: Text("超大数据量性能测试")),
Tab(
child: Text("NestedScrollView兼容"),
),
Tab(child: Text("SliverAppbar+Sliverheader")),
Tab(child: Text("嵌套滚动视图")),
Tab(child: Text("动态变化指示器+Navigator")),
Tab(child: Text("主动刷新")),
],
controller: _tabController,
):null,
),
body:
RefreshConfiguration(
child: PageView(
Expand All @@ -78,9 +102,9 @@ class _MainActivityState extends State<MainActivity>
clickLoadingWhenIdle: true,
headerTriggerDistance: 80.0,
autoLoad: true,
hideFooterWhenNotFull: true,
hideFooterWhenNotFull: false,
headerBuilder: () => WaterDropHeader(waterDropColor: Colors.green,),
footerBuilder: () => ClassicFooter(),
footerBuilder: () => ClassicFooter(decoration: BoxDecoration(color: Colors.pink),),
),
),
decoration: BoxDecoration(color: Colors.purple),
Expand All @@ -95,39 +119,39 @@ class _MainActivityState extends State<MainActivity>
),
children: <Widget>[
buildItem("各种指示器", Icon(Icons.apps, size: 18, color: Colors.grey),
() {
setState(() {
_tabIndex = 0;
});
_pageController.jumpToPage(0);
_menuController.closeMenu();
}),
() {
setState(() {
_tabIndex = 0;
});
_pageController.jumpToPage(0);
_menuController.closeMenu();
}),
buildItem("测试",
Icon(Icons.airplanemode_active, size: 18, color: Colors.grey),
() {
setState(() {
_tabIndex = 1;
});
_menuController.closeMenu();
_pageController.jumpToPage(1);
}),
() {
setState(() {
_tabIndex = 1;
});
_menuController.closeMenu();
_pageController.jumpToPage(1);
}),
buildItem("样例", Icon(Icons.scanner, size: 18, color: Colors.grey),
() {
setState(() {
_tabIndex = 2;
});
_menuController.closeMenu();
_pageController.jumpToPage(2);
}),
() {
setState(() {
_tabIndex = 2;
});
_menuController.closeMenu();
_pageController.jumpToPage(2);
}),
buildItem(
"App界面", Icon(Icons.format_underlined, size: 18, color: Colors.grey),
() {
setState(() {
_tabIndex = 3;
});
_menuController.closeMenu();
_pageController.jumpToPage(3);
}),
() {
setState(() {
_tabIndex = 3;
});
_menuController.closeMenu();
_pageController.jumpToPage(3);
}),
],
),
);
Expand Down
1 change: 1 addition & 0 deletions example/lib/ui/SecondActivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';

class SecondActivity extends StatefulWidget {
SecondActivity({Key key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
Expand Down
25 changes: 10 additions & 15 deletions example/lib/ui/indicator/base/IndicatorActivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ class IndicatorActivity extends StatefulWidget {

final LoadIndicator footer;


final bool enableOverScroll;
final bool reverse;

IndicatorActivity(
{this.title,
this.header,
this.reverse:false,
this.reverse: false,
this.footer,
this.enableOverScroll: true});

Expand All @@ -41,20 +40,20 @@ class _IndicatorActivityState extends State<IndicatorActivity> {

void _init() {
for (int i = 0; i < 5; i++) {
items.add(Item(title: "Data$i",));
items.add(Item(
title: "Data$i",
));
}
}



ScrollController _scrollController;

@override
void initState() {
// TODO: implement initState
_scrollController = new ScrollController();
_refreshController = RefreshController();
Future.delayed(Duration(milliseconds: 3000)).then((_){
Future.delayed(Duration(milliseconds: 3000)).then((_) {
// _jumpTo(0.0);
});
_init();
Expand Down Expand Up @@ -104,10 +103,7 @@ class _IndicatorActivityState extends State<IndicatorActivity> {
print("onRefresh");
Future.delayed(Duration(milliseconds: 1000)).then((_) {
items.add(Item(title: "Data"));
if(mounted)
setState(() {

});
if (mounted) setState(() {});
_refreshController.refreshCompleted();
});
}
Expand All @@ -116,13 +112,12 @@ class _IndicatorActivityState extends State<IndicatorActivity> {
print("onLoading");
Future.delayed(Duration(milliseconds: 1000)).then((_) {
int index = items.length;
if(mounted)
setState(() {});
items.add(Item(title: "Data$index",));
if (mounted) setState(() {});
items.add(Item(
title: "Data$index",
));
;
_refreshController.loadComplete();

});
}
}

10 changes: 4 additions & 6 deletions example/lib/ui/sample/Appbar_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_sticky_header/flutter_sticky_header.dart';


class AppBarHeader extends StatefulWidget {
@override
_AppBarHeaderState createState() => new _AppBarHeaderState();
Expand Down Expand Up @@ -39,7 +38,7 @@ class _AppBarHeaderState extends State<AppBarHeader> {
List<Widget> buildList() {
List<Widget> items = [];

for (int i = 0; i < 100; i++) {
for (int i = 0; i < 10; i++) {
items.add(Text('样例数据'));
}
return items;
Expand All @@ -60,9 +59,9 @@ class _AppBarHeaderState extends State<AppBarHeader> {
child: SmartRefresher(
headerInsertIndex: 1,
enablePullDown: true,
enablePullUp: true,
child: CustomScrollView(
slivers: [

SliverAppBar(
backgroundColor: Colors.greenAccent,
expandedHeight: 200.0,
Expand All @@ -78,11 +77,10 @@ class _AppBarHeaderState extends State<AppBarHeader> {
],
),
controller: _refreshController,
onRefresh: (){
onRefresh: () {
_refreshController.refreshCompleted();
},
header: ClassicHeader(
),
header: ClassicHeader(),
),
);
}
Expand Down
23 changes: 11 additions & 12 deletions example/lib/ui/sample/BigData.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,34 @@ class DataSmall extends StatefulWidget {
}

class _DataSmallState extends State<DataSmall> {

List<Widget> items = [];
RefreshController _refreshController;

void _init() {
for (int i = 0; i < 5000; i++) {
items.add(Item(title: "Data$i",));
items.add(Item(
title: "Data$i",
));
}
}

@override
void initState() {
// TODO: implement initState
_init();
_refreshController = RefreshController();
_refreshController = RefreshController();
super.initState();
}

_onLoading(){
_onLoading() {
_refreshController.loadComplete();
}

_onRefresh(){

items.add(Item(title: "Data",));
if(mounted)
setState(() {

});
_onRefresh() {
items.add(Item(
title: "Data",
));
if (mounted) setState(() {});
_refreshController.refreshCompleted();
}

Expand All @@ -57,7 +56,7 @@ class _DataSmallState extends State<DataSmall> {
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullDown: true,
enablePullUp:true,
enablePullUp: true,
controller: _refreshController);
}

Expand Down
Loading

0 comments on commit 485d870

Please sign in to comment.