Skip to content

Commit

Permalink
添加: key 和 EasyRefresh.custom listKey [issues#273](#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoyo committed Apr 14, 2020
1 parent 02448d3 commit c4e11ee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Next
>Fix: BezierCircleHeader progress bar is occasionally not hidden
>Update: TaurusHeader add backgroundColor parameter
>Update: TaurusHeader add backgroundColor parameter [issues#269](https://github.com/xuelongqy/flutter_easyrefresh/issues/269)
>Add: key and EasyRefresh.custom listKey [issues#273](https://github.com/xuelongqy/flutter_easyrefresh/issues/273)
## V 2.1.0
>Fix: After using firstRefreshWidget, pull down refresh does not take effect [issues#250](https://github.com/xuelongqy/flutter_easyrefresh/issues/250),[issues#256](https://github.com/xuelongqy/flutter_easyrefresh/issues/256)
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# 更新日志

## 下个版本
>修复: BezierCircleHeader进度条偶尔不隐藏
>更新: TaurusHeader添加背景色设置
>修复:BezierCircleHeader进度条偶尔不隐藏
>更新:TaurusHeader添加背景色设置 [issues#269](https://github.com/xuelongqy/flutter_easyrefresh/issues/269)
>添加:key 和 EasyRefresh.custom listKey [issues#273](https://github.com/xuelongqy/flutter_easyrefresh/issues/273)
## V 2.1.0
>修复:使用firstRefreshWidget后,下拉刷新不生效 [issues#250](https://github.com/xuelongqy/flutter_easyrefresh/issues/250),[issues#256](https://github.com/xuelongqy/flutter_easyrefresh/issues/256)
Expand Down
22 changes: 16 additions & 6 deletions lib/src/refresher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class EasyRefresh extends StatefulWidget {
/// 底部回弹(onLoad为null时生效)
final bool bottomBouncing;

/// CustomListView Key
final Key listKey;

/// Slivers集合
final List<Widget> slivers;

Expand Down Expand Up @@ -104,7 +107,7 @@ class EasyRefresh extends StatefulWidget {
/// 默认构造器
/// 将child转换为CustomScrollView可用的slivers
EasyRefresh({
key,
Key key,
this.controller,
this.onRefresh,
this.onLoad,
Expand All @@ -131,12 +134,15 @@ class EasyRefresh extends StatefulWidget {
this.cacheExtent = null,
this.slivers = null,
this.semanticChildCount = null,
this.dragStartBehavior = null;
this.dragStartBehavior = null,
this.listKey = null,
super(key: key);

/// custom构造器(推荐)
/// 直接使用CustomScrollView可用的slivers
EasyRefresh.custom({
key,
Key key,
this.listKey,
this.controller,
this.onRefresh,
this.onLoad,
Expand All @@ -163,12 +169,13 @@ class EasyRefresh extends StatefulWidget {
this.bottomBouncing = true,
@required this.slivers,
}) : this.builder = null,
this.child = null;
this.child = null,
super(key: key);

/// 自定义构造器
/// 用法灵活,但需将physics、header和footer放入列表中
EasyRefresh.builder({
key,
Key key,
this.controller,
this.onRefresh,
this.onLoad,
Expand All @@ -195,7 +202,9 @@ class EasyRefresh extends StatefulWidget {
this.dragStartBehavior = null,
this.headerIndex = null,
this.firstRefreshWidget = null,
this.emptyWidget = null;
this.emptyWidget = null,
this.listKey = null,
super(key: key);

@override
_EasyRefreshState createState() {
Expand Down Expand Up @@ -378,6 +387,7 @@ class _EasyRefreshState extends State<EasyRefresh> {
listBody = widget.builder(context, _physics, header, footer);
} else if (widget.slivers != null) {
listBody = CustomScrollView(
key: widget.listKey,
physics: _physics,
slivers: slivers,
scrollDirection: widget.scrollDirection,
Expand Down

0 comments on commit c4e11ee

Please sign in to comment.