|
|
@ -44,6 +44,7 @@ class _ArticlePage extends State<ArticlePage> |
|
|
|
List<Article> articleTop = []; |
|
|
|
List<Article> articleTop = []; |
|
|
|
List<HeadlinesList> headlines = []; |
|
|
|
List<HeadlinesList> headlines = []; |
|
|
|
int pageNum = 1; |
|
|
|
int pageNum = 1; |
|
|
|
|
|
|
|
bool isLoading = false; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
@ -95,6 +96,11 @@ class _ArticlePage extends State<ArticlePage> |
|
|
|
|
|
|
|
|
|
|
|
///文章列表 |
|
|
|
///文章列表 |
|
|
|
queryArticleList(bool isHot) async { |
|
|
|
queryArticleList(bool isHot) async { |
|
|
|
|
|
|
|
if(!isHot && isLoading){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
}else if(!isHot && !isLoading){ |
|
|
|
|
|
|
|
isLoading = true; |
|
|
|
|
|
|
|
} |
|
|
|
if (apiService == null) { |
|
|
|
if (apiService == null) { |
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
apiService = ApiService( |
|
|
|
apiService = ApiService( |
|
|
@ -132,7 +138,9 @@ class _ArticlePage extends State<ArticlePage> |
|
|
|
refreshController.loadNoData(); |
|
|
|
refreshController.loadNoData(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pageNum += 1; |
|
|
|
pageNum += 1; |
|
|
|
|
|
|
|
refreshController.loadComplete(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
isLoading = false; |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
@ -165,6 +173,8 @@ class _ArticlePage extends State<ArticlePage> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_onRefresh() { |
|
|
|
_onRefresh() { |
|
|
|
|
|
|
|
isLoading = true; |
|
|
|
|
|
|
|
pageNum = 1; |
|
|
|
queryHeadlinesBanner(); |
|
|
|
queryHeadlinesBanner(); |
|
|
|
queryHeadlinesList(); //分类列表 |
|
|
|
queryHeadlinesList(); //分类列表 |
|
|
|
queryArticleList(false); |
|
|
|
queryArticleList(false); |
|
|
@ -180,7 +190,7 @@ class _ArticlePage extends State<ArticlePage> |
|
|
|
child: Container( |
|
|
|
child: Container( |
|
|
|
child: SmartRefresher( |
|
|
|
child: SmartRefresher( |
|
|
|
controller: refreshController, |
|
|
|
controller: refreshController, |
|
|
|
enablePullDown: false, |
|
|
|
enablePullDown: true, |
|
|
|
enablePullUp:true, |
|
|
|
enablePullUp:true, |
|
|
|
header: MyHeader(), |
|
|
|
header: MyHeader(), |
|
|
|
footer: CustomFooter( |
|
|
|
footer: CustomFooter( |
|
|
|