【发布时间】:2020-03-19 03:43:43
【问题描述】:
我需要在flutter中制作一个gridview以在水平方向上列出具有特定高度和宽度的卡片项目,当我尝试时,我总是在我的gridview中得到一个方形单元格,如果我改变我的容器高度和宽度则没有效果。
我尝试如下
child: GridView.count(
scrollDirection: Axis.horizontal,
// Create a grid with 2 columns. If you change the scrollDirection to
// horizontal, this produces 2 rows.
crossAxisCount: 2,
// Generate 100 widgets that display their index in the List.
children: List.generate(cuisineListAll.length, (index) {
return Card(
child: Container(
width: 330,
height: 100,
child: Text(
myListAll[index].name,
style: TextStyle(fontSize: 15),
),
),
);
})),
有没有办法以我自己的固定尺寸显示我的卡片?我尝试了flutter_staggered_grid_view,但是当我改为水平方向时,没有运气。
【问题讨论】:
标签: flutter dart flutter-layout