Browse Source

列表更改2

remove_uniapp
w-R 3 years ago
parent
commit
70fd2c2e9d
  1. 12
      lib/community/headlines/article_page.dart
  2. 4
      lib/main_page.dart

12
lib/community/headlines/article_page.dart

@ -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(

4
lib/main_page.dart

@ -190,7 +190,9 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getString("token") == null || if (sharedPreferences.getString("token") == null ||
sharedPreferences.getString("token") == "") return; sharedPreferences.getString("token") == "") return;
String startIntent = await Bridge.getStartIntent(); String startIntent;
if(Platform.isAndroid)
startIntent = await Bridge.getStartIntent();
print("intent:$startIntent"); print("intent:$startIntent");
String pushData = ""; String pushData = "";
if (startIntent != null && startIntent != "") { if (startIntent != null && startIntent != "") {

Loading…
Cancel
Save