Flutter 需要了解如何限制网格视图行中的列数的帮助吗
您好,我正在使用一个名为的包,我正在使用,我不知道如何限制列数。我曾尝试将Flutter 需要了解如何限制网格视图行中的列数的帮助吗,flutter,dart,Flutter,Dart,您好,我正在使用一个名为的包,我正在使用,我不知道如何限制列数。我曾尝试将maxRowCount设置为2,但如果我这样做,它会添加额外的空项,因为我只需要4个,但每行会添加10、5个 我要找的是每行2个项目 这是我使用的代码 ResponsiveGridView.builder( shrinkWrap: true, gridDelegate: ResponsiveGridDelegate(
maxRowCount
设置为2,但如果我这样做,它会添加额外的空项,因为我只需要4个,但每行会添加10、5个
我要找的是每行2个项目
这是我使用的代码
ResponsiveGridView.builder(
shrinkWrap: true,
gridDelegate: ResponsiveGridDelegate(
crossAxisExtent: 300,
childAspectRatio: 3 / 4,
crossAxisSpacing: 50,
),
itemCount: people.length,
itemBuilder: (BuildContext bc, index) {
return Card(
child: ResponsiveRowColumn(
rowColumn: false,
children: [
ResponsiveRowColumnItem(
rowFlex: 1,
child: Image.network(
"https://thumbs.dreamstime.com/b/smartphone-hand-businessman-holding-mobile-phone-cell-arm-template-app-presentation-flat-vector-internet-application-blank-155035117.jpg",
scale: 1,
),
),
ResponsiveRowColumnItem(
child: Text(people[index].name),
),
],
),
);
}),
没有办法限制对象的数量,但您可以做的是将gridview放在一个容器中,并限制大小,从而得到我想要的结果