三星设备Flutter应用滚动时动态Container边框断裂问题求助
三星设备上AlignedGridView动态边框滚动断裂问题
在所有三星设备的商品页面中,我通过列表项的奇偶索引计算为Container设置动态边框,但上下滚动时,三星手机上的边框会出现断裂。设置静态全边框时功能正常,但我需要实现合并上下、左右边框并区分明暗的样式。使用的依赖包是flutter_staggered_grid_view: ^0.6.2。
相关代码
静态边框代码
decoration: BoxDecoration(border: Border.all(width: 0.5, color: Theme.of(context).dividerColor),color: Colors.transparent),
AlignedGridView实现代码
AlignedGridView.count( controller: _controller, primary: false, shrinkWrap: true, crossAxisCount: orientation == Orientation.portrait ? 2 : 4, mainAxisSpacing: 0, crossAxisSpacing: 0, itemCount: paginationProvider.photos.length, itemBuilder: (context, index) { final border1 = index.isEven ? Border( top: index == 0 || index == 1 ? border : BorderSide.none, left: border, right: border, bottom: border, ) : Border(top: index == 0 || index == 1 ? border : BorderSide.none, right: border, bottom: border); buyNowLoaded.add(false); cartNowLoaded.add(false); wishlistLoader.add(false); specialPriceFoundCategoriesProduct.add("0.0"); for(int i = 0 ; i < paginationProvider.photos[index].customAttributes!.length;i++) { if(paginationProvider.photos[index].customAttributes![i].attributeCode == 'special_price') { specialPriceFoundCategoriesProduct[index] = paginationProvider.photos[index].customAttributes![i].value; break; } } if (index == paginationProvider.photos.length) { return const Center( child: CircularProgressIndicator(), ); } return Container( decoration: BoxDecoration(border: border1), child: Container(), ); }, ),
内容的提问来源于stack exchange,提问作者Alpesh Kukadiya
相关产品推荐
相关产品推荐

