[英]How to remove flutter gridView spacing
I found that when I set my crossAxisCount
to 2 n the gridView
will have a white divider, as soon as I start scrolling, it will flicker.我发现当我将
crossAxisCount
设置为 2 n 时, gridView
将有一个白色分隔线,一旦我开始滚动,它就会闪烁。 If my crossAxisCount
is 2 n+1, that won't happen, I tested the official demo as well,but I don't want these dividers, so how do I get rid of them?如果我的
crossAxisCount
是 2 n+1,那不会发生,我也测试了官方的演示,但是我不想要这些分隔符,那么我该如何摆脱它们呢?
2n items: 2n 项:
2n+1 items: 2n+1 件:
This is my code:这是我的代码:
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0,
mainAxisSpacing: 0,
),
Its is because as first image, There is 2 items in a row.这是因为作为第一张图片,连续有 2 个项目。 And In your code
在你的代码中
crossAxisCount:2
交叉轴计数:2
crossAxisCount is denoted for The number of children in the cross axis. crossAxisCount 表示交叉轴上的子节点数。
So, If you want to show lines in grid item set this exact number of items in row.因此,如果您想在网格项目中显示行,请设置此行中的确切项目数。 If you dont want this set zero.
如果你不想要这个设置为零。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.