Skip to content

Commit c6de284

Browse files
author
xuelongqy
committed
更新至1.0.3;修复使用CustomScrollView加载报错问题,修复部分视图在非SafeArea中偏移问题,添加CustomScrollView使用示例
1 parent 427667e commit c6de284

16 files changed

+377
-243
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License](https://img.shields.io/badge/license-MIT-green.svg)](/LICENSE)
44
[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://stackoverflow.com/questions/tagged/flutter?sort=votes)
5-
[![Pub](https://img.shields.io/badge/pub-v1.0.2-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)
5+
[![Pub](https://img.shields.io/badge/pub-v1.0.3-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)
66

77
## [English](https://github.com/xuelongqy/flutter_easyrefresh/blob/master/README_EN.md) | 中文
88

@@ -54,7 +54,7 @@
5454
```
5555
//pub方式
5656
dependencies:
57-
flutter_easyrefresh: ^1.0.2
57+
flutter_easyrefresh: ^1.0.3
5858
5959
//导入方式
6060
dependencies:

README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License](https://img.shields.io/badge/license-MIT-green.svg)](/LICENSE)
44
[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://stackoverflow.com/questions/tagged/flutter?sort=votes)
5-
[![Pub](https://img.shields.io/badge/pub-v1.0.2-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)
5+
[![Pub](https://img.shields.io/badge/pub-v1.0.3-orange.svg)](https://pub.dartlang.org/packages/flutter_easyrefresh)
66

77
## English | [中文](https://github.com/xuelongqy/flutter_easyrefresh/blob/master/README.md)
88

@@ -54,7 +54,7 @@ Just like the name, EasyRefresh can easily implement pull-down refresh and uploa
5454
```
5555
//pub
5656
dependencies:
57-
flutter_easyrefresh: ^1.0.2
57+
flutter_easyrefresh: ^1.0.3
5858
5959
//import
6060
dependencies:

art/md/cn/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@
1616
>调整:上拉加载阻力系数
1717
>修复:多次上拉有可能卡住的问题
1818
>修复:自动触发BallPulse没有动画问题
19+
20+
## V 1.0.3
21+
>修复:使用CustomScrollView加载报错问题
22+
>修复:部分视图在非SafeArea中偏移问题
23+
>添加:CustomScrollView使用示例

art/md/en/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@
1616
>Adjustment:Drag coefficient of pull-up loading
1717
>Repair:Problem of multiple pull-ups that may get stuck
1818
>Repair:Automatic triggering BallPulse without animation problems
19+
20+
## V 1.0.3
21+
>Adjustment:Using CustomScrollView load error
22+
>Adjustment:Partial view than SafeArea deviation
23+
>Add:CustomScrollView usage examples

art/pkg/EasyRefresh.apk

37.6 KB
Binary file not shown.

example/assets/locale/i18n_en.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"floatViewDescribe": "At the top or bottom view floating on the list",
2424
"userProfile": "User Profile",
2525
"userProfileDescribe": "User Profile with the springback effect",
26+
"customScrollViewDescribe": "List with AppBar Folding",
2627
"qqGroup": "QQ group",
2728
"github": "Github",
2829
"name": "Name",

example/assets/locale/i18n_zh.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"floatViewDescribe": "顶部或底部视图浮动在列表上",
2424
"userProfile": "个人中心",
2525
"userProfileDescribe": "带回弹效果的个人中心",
26+
"customScrollViewDescribe": "带头部折叠的列表",
2627
"qqGroup": "QQ群",
2728
"github": "Github",
2829
"name": "名字",

example/lib/page/sample_page.dart

+21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:example/generated/translations.dart';
22
import 'package:example/page/auto_load_page.dart';
33
import 'package:example/page/basic_page.dart';
44
import 'package:example/page/float_page.dart';
5+
import 'package:example/page/sliver_page.dart';
56
import 'package:example/page/user_profile_page.dart';
67
import 'package:example/widget/list_item.dart';
78
import 'package:flutter/material.dart';
@@ -96,6 +97,26 @@ class _SamplePageState extends State<SamplePage> {
9697
color: Colors.orange,
9798
),
9899
),
100+
Container(
101+
width: double.infinity,
102+
height: 0.5,
103+
padding: EdgeInsets.only(left: 5.0, right: 5.0),
104+
child: Container(
105+
color: Colors.black12,
106+
),
107+
),
108+
ListItem(
109+
title: Translations.of(context).text("CustomScrollView"),
110+
describe: Translations.of(context).text("customScrollViewDescribe"),
111+
onPressed: () {
112+
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
113+
return SliverPage();
114+
}));
115+
},
116+
icon: Icon(Icons.format_line_spacing,
117+
color: Colors.orange,
118+
),
119+
),
99120
],
100121
),
101122
),

example/lib/page/sliver_page.dart

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import 'package:example/generated/translations.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:flutter_easyrefresh/easy_refresh.dart';
4+
5+
/// CustomScrollView示例页面
6+
class SliverPage extends StatefulWidget {
7+
@override
8+
_SliverPageState createState() => _SliverPageState();
9+
}
10+
11+
class _SliverPageState extends State<SliverPage> {
12+
13+
List<String> addStr=["1","2","3","4","5","6","7","8","9","0"];
14+
List<String> str=["1","2","3","4","5","6","7","8","9","0"];
15+
GlobalKey<EasyRefreshState> _easyRefreshKey = new GlobalKey<EasyRefreshState>();
16+
GlobalKey<RefreshHeaderState> _headerKey = new GlobalKey<RefreshHeaderState>();
17+
GlobalKey<RefreshFooterState> _footerKey = new GlobalKey<RefreshFooterState>();
18+
19+
@override
20+
Widget build(BuildContext context) {
21+
return Scaffold(
22+
body: new EasyRefresh(
23+
key: _easyRefreshKey,
24+
refreshHeader: ClassicsHeader(
25+
key: _headerKey,
26+
refreshText: Translations.of(context).text("pullToRefresh"),
27+
refreshReadyText: Translations.of(context).text("releaseToRefresh"),
28+
refreshingText: Translations.of(context).text("refreshing") + "...",
29+
refreshedText: Translations.of(context).text("refreshed"),
30+
moreInfo: Translations.of(context).text("updateAt"),
31+
bgColor: Colors.orange,
32+
textColor: Colors.black,
33+
),
34+
refreshFooter: ClassicsFooter(
35+
key: _footerKey,
36+
loadHeight: 50.0,
37+
loadText: Translations.of(context).text("pushToLoad"),
38+
loadReadyText: Translations.of(context).text("releaseToLoad"),
39+
loadingText: Translations.of(context).text("loading"),
40+
loadedText: Translations.of(context).text("loaded"),
41+
noMoreText: Translations.of(context).text("noMore"),
42+
moreInfo: Translations.of(context).text("updateAt"),
43+
bgColor: Colors.orange,
44+
textColor: Colors.black,
45+
),
46+
onRefresh: () async{
47+
await new Future.delayed(const Duration(seconds: 1), () {
48+
setState(() {
49+
str.clear();
50+
str.addAll(addStr);
51+
});
52+
});
53+
},
54+
loadMore: () async {
55+
await new Future.delayed(const Duration(seconds: 1), () {
56+
if (str.length < 20) {
57+
setState(() {
58+
str.addAll(addStr);
59+
});
60+
}
61+
});
62+
},
63+
child: CustomScrollView(
64+
// 手动维护semanticChildCount,用于判断是否没有更多数据
65+
semanticChildCount: str.length,
66+
slivers: <Widget>[
67+
SliverAppBar(
68+
floating: false,
69+
pinned: true,
70+
expandedHeight: 180.0,
71+
flexibleSpace: FlexibleSpaceBar(
72+
title: Text("CustomScrollView"),
73+
),
74+
),
75+
SliverPadding(
76+
padding: EdgeInsets.all(0.0),
77+
sliver: SliverFixedExtentList(
78+
itemExtent: 70.0,
79+
delegate: SliverChildBuilderDelegate((context, index){
80+
return new Container(
81+
height: 70.0,
82+
child: Card(
83+
child: new Center(
84+
child: new Text(str[index],style: new TextStyle(fontSize: 18.0),),
85+
),
86+
)
87+
);
88+
},
89+
childCount: str.length,
90+
)
91+
),
92+
)
93+
],
94+
)
95+
)
96+
);
97+
}
98+
}

example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Easy refresh example.
77
# Both the version and the builder number may be overridden in flutter
88
# build by specifying --build-name and --build-number, respectively.
99
# Read more about versioning at semver.org.
10-
version: 1.0.0+1
10+
version: 1.0.3+1
1111

1212
environment:
1313
sdk: ">=2.0.0-dev.68.0 <3.0.0"

lib/ball_pulse_footer.dart

+48-50
Original file line numberDiff line numberDiff line change
@@ -129,61 +129,59 @@ class BallPulseFooterState extends RefreshFooterState<BallPulseFooter> with Tick
129129
@override
130130
Widget build(BuildContext context) {
131131
return new Container(
132-
color: widget.backgroundColor,
133-
height: this.height,
134-
child: ListView(
132+
color: widget.backgroundColor,
133+
height: this.height,
134+
child: SingleChildScrollView(
135+
child: Container(
136+
height: this.height > 30.0 ? this.height : 30.0,
137+
child: new Row(
138+
mainAxisAlignment: MainAxisAlignment.center,
135139
children: <Widget>[
136-
Container(
137-
height: this.height > 30.0 ? this.height : 30.0,
138-
child: new Row(
139-
mainAxisAlignment: MainAxisAlignment.center,
140-
children: <Widget>[
141-
SizedBox (
142-
width: 20.0,
143-
height: 20.0,
144-
child: Center(
145-
child: ClipOval (
146-
child: Container(
147-
color: widget.color,
148-
height: ballSize1,
149-
width: ballSize1,
150-
),
151-
),
152-
)
140+
SizedBox (
141+
width: 20.0,
142+
height: 20.0,
143+
child: Center(
144+
child: ClipOval (
145+
child: Container(
146+
color: widget.color,
147+
height: ballSize1,
148+
width: ballSize1,
149+
),
153150
),
154-
Container (width: 5.0,),
155-
SizedBox (
156-
width: 20.0,
157-
height: 20.0,
158-
child: Center(
159-
child: ClipOval (
160-
child: Container(
161-
color: widget.color,
162-
height: ballSize2,
163-
width: ballSize2,
164-
),
165-
),
166-
)
151+
)
152+
),
153+
Container (width: 5.0,),
154+
SizedBox (
155+
width: 20.0,
156+
height: 20.0,
157+
child: Center(
158+
child: ClipOval (
159+
child: Container(
160+
color: widget.color,
161+
height: ballSize2,
162+
width: ballSize2,
163+
),
167164
),
168-
Container (width: 5.0,),
169-
SizedBox (
170-
width: 20.0,
171-
height: 20.0,
172-
child: Center(
173-
child: ClipOval (
174-
child: Container(
175-
color: widget.color,
176-
height: ballSize3,
177-
width: ballSize3,
178-
),
179-
),
180-
)
165+
)
166+
),
167+
Container (width: 5.0,),
168+
SizedBox (
169+
width: 20.0,
170+
height: 20.0,
171+
child: Center(
172+
child: ClipOval (
173+
child: Container(
174+
color: widget.color,
175+
height: ballSize3,
176+
width: ballSize3,
177+
),
181178
),
182-
],
183-
),
184-
)
185-
]
179+
)
180+
),
181+
],
182+
),
186183
)
184+
)
187185
);
188186
}
189187
}

0 commit comments

Comments
 (0)