Skip to content

Commit f15c9bc

Browse files
committed
empty list
1 parent 1fd7239 commit f15c9bc

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

‎RECORD.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ https://github.com/flutter/flutter/issues/19030 没有webview,残念
3131

3232
https://github.com/flutter/flutter/issues/19030#issuecomment-406656714
3333

34-
https://github.com/flutter/flutter/issues/19809
35-
https://github.com/flutter/flutter/issues/11895 tab alive
3634

3735
https://github.com/flutter/flutter/issues/19030 没有webview,残念
3836

39-
_debugUltimatePreviousSiblingOf
4037

38+
//升级到0.5.7 对三个以上tab还是有问题,TabBarView放弃,使用PageView,实现两个control同步,GlobalKey也没问题了。
39+
https://github.com/flutter/flutter/issues/19809
40+
https://github.com/flutter/flutter/issues/11895 tab alive
41+
_debugUltimatePreviousSiblingOf
4142
GlobalKey可以记录state,但是需要跟随build创建
42-
43-
4443
https://stackoverflow.com/questions/49862572
4544

4645
readme等view的loading

‎lib/common/style/GSYStyle.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class GSYStrings {
185185
static const String app_name = "GSYGithubAppFlutter";
186186
static const String app_ok = "确定";
187187
static const String app_cancel = "取消";
188+
static const String app_empty = "目前什么也没有哟";
188189

189190
static const String nothing_now = "目前什么都没有。";
190191
static const String loading_text = "加载中···";

‎lib/widget/GSYPullLoadWidget.dart‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class _GSYPullLoadWidgetState extends State<GSYPullLoadWidget> {
5555
if (control.needHeader) {
5656
return (control.dataList.length > 0) ? control.dataList.length + 2 : control.dataList.length + 1;
5757
} else {
58+
if(control.dataList.length == 0) {
59+
return 1;
60+
}
5861
return (control.dataList.length > 0) ? control.dataList.length + 1 : control.dataList.length;
5962
}
6063
}
@@ -71,6 +74,8 @@ class _GSYPullLoadWidgetState extends State<GSYPullLoadWidget> {
7174
return _buildProgressIndicator();
7275
} else if (control.needHeader && index == _getListCount() - 1 && control.dataList.length != 0) {
7376
return _buildProgressIndicator();
77+
} else if (!control.needHeader && control.dataList.length == 0) {
78+
return _buildEmpty();
7479
} else {
7580
return itemBuilder(context, index);
7681
}
@@ -81,11 +86,31 @@ class _GSYPullLoadWidgetState extends State<GSYPullLoadWidget> {
8186
);
8287
}
8388

89+
Widget _buildEmpty() {
90+
return new Container(
91+
height: MediaQuery.of(context).size.height - 100,
92+
child: new Column(
93+
mainAxisAlignment: MainAxisAlignment.center,
94+
children: <Widget>[
95+
FlatButton(
96+
onPressed: () {},
97+
child: new Image(image: new AssetImage('static/images/logo.png'), width: 70.0, height: 70.0),
98+
),
99+
Container(
100+
child: Text(GSYStrings.app_empty, style: GSYConstant.normalText),
101+
),
102+
],
103+
),
104+
);
105+
}
106+
84107
Widget _buildProgressIndicator() {
85108
Widget bottomWidget = (control.needLoadMore)
86109
? new Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
87110
new SpinKitRotatingCircle(color: Color(GSYColors.primaryValue)),
88-
new Container(width: 5.0,),
111+
new Container(
112+
width: 5.0,
113+
),
89114
new Text(
90115
GSYStrings.load_more_text,
91116
style: GSYConstant.smallTextBold,

0 commit comments

Comments
 (0)