Skip to content

Commit

Permalink
🐛 Fix error status trigger in post controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Feb 19, 2020
1 parent fcfa7a3 commit f27aaaa
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/controller/post_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,30 @@ class _PostListState extends State<PostList> with AutomaticKeepAliveClientMixin
});

_emptyChild = GestureDetector(
onTap: () {},
onTap: _refreshData,
child: Container(
child: Center(
child: Text(
'这里空空如也~',
style: TextStyle(color: currentThemeColor),
'这里空空如也~轻触重试',
style: TextStyle(
fontSize: suSetSp(30.0),
color: currentThemeColor,
),
),
),
),
);

_errorChild = GestureDetector(
onTap: () {
setState(() {
_isLoading = false;
_refreshData();
});
},
onTap: _refreshData,
child: Container(
child: Center(
child: Text(
'加载失败,轻触重试',
style: TextStyle(color: currentThemeColor),
style: TextStyle(
fontSize: suSetSp(30.0),
color: currentThemeColor,
),
),
),
),
Expand Down Expand Up @@ -179,6 +180,7 @@ class _PostListState extends State<PostList> with AutomaticKeepAliveClientMixin
} else {
return;
}
error = false;
_lastValue = 0;

try {
Expand Down Expand Up @@ -223,6 +225,7 @@ class _PostListState extends State<PostList> with AutomaticKeepAliveClientMixin
_canLoadMore = _idList.length < _total && _count != 0;
_lastValue = _idList.isEmpty ? 0 : widget._postController.lastValue(_idList.last);
} catch (e) {
error = true;
debugPrint('Failed when refresh post list: $e');
}

Expand Down

0 comments on commit f27aaaa

Please sign in to comment.