fluttercandies / loading_more_list

A loading more list which supports ListView,GridView,WaterfallFlow and Slivers.
MIT License
357 stars 45 forks source link

瀑布流布局异常 #33

Closed lsfern closed 1 month ago

lsfern commented 3 years ago

修改TuChongRepository类的loadData方法,第一页加载一条,第二页加载4条

Future<bool> loadData([bool isloadMoreAction = false]) async { String url = ''; if (isEmpty) { url = 'https://api.tuchong.com/feed-app'; } else { final int lastPostId = this[length - 1].postId; url = 'https://api.tuchong.com/feed-app?post_id=$lastPostId&page=$_pageIndex&type=loadmore'; } bool isSuccess = false; try { List<TuChongItem> feedList; feedList = mockSource.feedList.toList(); if (_pageIndex == 1) { clear(); } if (_pageIndex == 1) { add(feedList[0]); } else { add(feedList[0]); add(feedList[0]); add(feedList[0]); add(feedList[0]); } _pageIndex++; _hasMore = _pageIndex <= 2; isSuccess = true; } catch (exception, stack) { isSuccess = false; print(exception); print(stack); } return isSuccess; }

zmtzawqlp commented 2 years ago

试试最新的版本