Closed lsfern closed 1 month ago
Flutter 版本:1.22.6
插件版本:3.2.0
机型:iPhone xs / 小米 10
重现步骤
修改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; }
导致的结果:瀑布流布局异常,第二列的第一条未顶到第一列上
期望结果:上图中第二列数据的第一条放到第一列的第二条
试试最新的版本
Flutter 版本:1.22.6
插件版本:3.2.0
机型:iPhone xs / 小米 10
重现步骤
修改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; }
导致的结果:瀑布流布局异常,第二列的第一条未顶到第一列上
期望结果:上图中第二列数据的第一条放到第一列的第二条