Flutter 如何使用scrollDirection:Axis.horizontal设置颤振中gridview项的宽度和高度?

Flutter 如何使用scrollDirection:Axis.horizontal设置颤振中gridview项的宽度和高度?,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,我需要在Flatter中创建一个gridview,以在水平方向上列出具有特定高度和宽度的卡片项,当我尝试时,我总是在gridview中获得一个方形单元格,如果我更改容器高度和宽度,则没有任何效果 我试着像下面一样 child: GridView.count( scrollDirection: Axis.horizontal, // Create a grid with 2 columns. If you change the scrollDire

我需要在Flatter中创建一个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),
                  ),
                ),
              );
            })),

有没有办法用我自己的固定尺寸显示我的卡?我尝试了颤振交错网格视图,但当我切换到水平方向时,运气不佳。

尝试给出
childAspectRatio:YOUR\u值,

例如

...
 GridView.count(
                physics: NeverScrollableScrollPhysics(),
                scrollDirection: Axis.vertical,
                shrinkWrap: true,
                crossAxisCount: 4,
                childAspectRatio: 1 / 1.1,
...

谢谢你的回答,我需要创建一个特定的卡片并显示网格的水平方向。我试过了,但没有达到预期效果。我需要为每个gridview项目制作宽度为130、高度为100的卡片,并水平滚动。我只是使用listview进行管理,将列作为listview项并添加了两张卡,但我必须管理数据,不像gridview那样简单。我想如果我能为网格视图项设置宽度和高度,那将是一个最好的解决方案。我认为除了使用childAspectRatio之外,没有其他解决方案,使用这种组合时,宽度比高度占用更多的空间。谢谢你的回复,我会尝试:)我也在尝试解决这个问题,我相信childAspectRatio不是一个解决方案。你可以让它为一个设备工作,但如果你改变屏幕大小,你就完蛋了。