Skip to content

Commit 4de42cf

Browse files
committed
调整bloc
1 parent cbbf964 commit 4de42cf

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PODS:
3434
DEPENDENCIES:
3535
- connectivity (from `.symlinks/plugins/connectivity/ios`)
3636
- device_info (from `.symlinks/plugins/device_info/ios`)
37-
- Flutter (from `.symlinks/flutter/ios-release`)
37+
- Flutter (from `.symlinks/flutter/ios`)
3838
- flutter_statusbar (from `.symlinks/plugins/flutter_statusbar/ios`)
3939
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
4040
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
@@ -57,7 +57,7 @@ EXTERNAL SOURCES:
5757
device_info:
5858
:path: ".symlinks/plugins/device_info/ios"
5959
Flutter:
60-
:path: ".symlinks/flutter/ios-release"
60+
:path: ".symlinks/flutter/ios"
6161
flutter_statusbar:
6262
:path: ".symlinks/plugins/flutter_statusbar/ios"
6363
flutter_webview_plugin:

lib/bloc/base/base_bloc.dart

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ abstract class BlocListBase extends BlocBase {
6262
@override
6363
void initState() {
6464
_isShow = true;
65-
pullLoadWidgetControl.dispose();
6665
}
6766

6867
@mustCallSuper
@@ -87,15 +86,6 @@ abstract class BlocListBase extends BlocBase {
8786
return (res != null && res.data != null && res.data.length == Config.PAGE_SIZE);
8887
}
8988

90-
@protected
91-
resolveRefreshResult(res) {
92-
if (res != null && res.result) {
93-
if (_isShow) {
94-
refreshData(res.data);
95-
}
96-
}
97-
}
98-
9989
int get page => _page;
10090

10191
///列表数据长度
@@ -117,16 +107,16 @@ abstract class BlocListBase extends BlocBase {
117107
get dataList => pullLoadWidgetControl.dataList;
118108

119109
///刷新列表数据
120-
refreshData(List listData) {
121-
if (pullLoadWidgetControl.dataList != null) {
122-
pullLoadWidgetControl.dataList = listData;
110+
refreshData(res) {
111+
if (res != null) {
112+
pullLoadWidgetControl.dataList = res.data;
123113
}
124114
}
125115

126116
///加载更多数据
127-
loadMoreData(List listData) {
128-
if (listData != null) {
129-
pullLoadWidgetControl.addList(listData);
117+
loadMoreData(res) {
118+
if (res != null) {
119+
pullLoadWidgetControl.addList(res.data);
130120
}
131121
}
132122

lib/bloc/dynamic_bloc.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ class DynamicBloc extends BlocListBase {
1010
pageReset();
1111
var res = await EventDao.getEventReceived(userName, page: page, needDb: true);
1212
changeLoadMoreStatus(getLoadMoreStatus(res));
13+
refreshData(res);
1314
return res;
1415
}
1516

1617
requestLoadMore(String userName) async {
1718
pageUp();
1819
var res = await EventDao.getEventReceived(userName, page: page);
1920
changeLoadMoreStatus(getLoadMoreStatus(res));
21+
loadMoreData(res);
2022
return res;
2123
}
2224

lib/bloc/trend_bloc.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class TrendBloc extends BlocListBase {
1010
pageReset();
1111
var res = await ReposDao.getTrendDao(since: selectTime.value, languageType: selectType.value);
1212
changeLoadMoreStatus(getLoadMoreStatus(res));
13+
refreshData(res);
1314
return res;
1415
}
1516
}

lib/widget/gsy_bloc_list_state.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ mixin GSYListState<T extends StatefulWidget> on State<T>, AutomaticKeepAliveClie
2323

2424
///下拉刷新数据
2525
@protected
26-
requestRefresh();
26+
Future requestRefresh();
2727

2828
///上拉更多请求数据
2929
@protected
30-
requestLoadMore();
30+
Future requestLoadMore();
3131

3232
///是否需要第一次进入自动刷新
3333
@protected

0 commit comments

Comments
 (0)