flutter_staggered_grid_view 0.4.0 报错导致TabBarView只能展示第一个
来源:16-8 旅拍页面交互与我的页面实现
THEONEjyf
2022-11-16
看了下,这个库的最新版本是0.6.2,我用了一下最新版本,发现删掉了课程中的方法,并且无法设置滚动的_scrollViewController,也就无法实现上拉加载更多功能?麻烦老师给看下?
写回答
3回答
-
CrazyCodeBoy
2022-11-27
0.62的适配代码可参考下:
_gridView() {
//0.62.x及以上用法
return MasonryGridView.count(
controller: _scrollController,
crossAxisCount: 2,
itemCount: travelItems.length,
itemBuilder: (BuildContext context, int index) => _TravelItem(
index: index,
item: travelItems[index],
),
);
}
00 -
CrazyCodeBoy
2022-11-21
flutter_nested不支持瀑布流,可以照这样设置下防止溢出:
HiNestedScrollView(
controller: scrollController,
itemCount: dataList.length,
padding: EdgeInsets.only(top: 10, left: 10, right: 10),
headers: [
if (widget.bannerList != null)
Padding(
padding: EdgeInsets.only(bottom: 8),
child: _banner(widget.bannerList!))
],
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, childAspectRatio: 0.82),
itemBuilder: (BuildContext context, int index) {
return VideoCard(videoMo: dataList[index]);
});
然后给card设置下高度。022022-11-27 -
CrazyCodeBoy
2022-11-16
改成用flutter_nested吧,性能要比flutter_staggered_grid_view好些,https://pub.dev/packages/flutter_nested022022-11-18