有没有办法在 GridView 中为 child 获取固定大小?

Is there a way to get fixed size for child inside GridView?

有没有办法让 GridView 里面的 child 有一个固定的大小?我想让红色的高度相同。我尝试使用 Expanded 或为 Container 指定大小,但它不起作用。 GridView 只是使 child 大小相同。

注意:我尝试为红色容器指定高度。没用。

这就是我得到的。

这就是我所做的。

    return GridView.count(
      crossAxisCount: 2,
      children: List.generate(drinksData.length, (index) {
        return Container(
          padding: EdgeInsets.all(20.0),
          child: Column(
            children: [
              Expanded(
                child: Container(
                  color: Colors.red,
                ),
              ),
              Text(drinksData[index].label),
            ],
          ),
        );
      }),
    );
GridView.count(
     crossAxisCount: 2,
     children: List.generate(drinksData.length, (index) {
       return Container(
         padding: const EdgeInsets.all(20.0),
         child: Column(
           children: [
             Expanded(
               child: Container(
                // height:90,//or whatever size you want!
                 color: Colors.red,
               ),
             ),
             SizedBox(
               height: 45,
                 child: Text(drinksData[index])
             ),
           ],
         ),
       );
     }),
   )
   ```