Flutter Gridview in Column. What's solution..?

后端 未结 5 1296
小鲜肉
小鲜肉 2021-02-02 09:16

I have a problem with gridview and column. In this case, i want put an image in upper of gridview. Please give me a solution..

return new Container(
  child: new         


        
5条回答
  •  -上瘾入骨i
    2021-02-02 09:50

    You just need to put your grid view into Expanded widget, for example:

    body: new Column(
      children: [
        new Expanded(
          child: GridView.count(
            // Create a grid with 2 columns. If you change the scrollDirection to
            // horizontal, this would produce 2 rows.
            crossAxisCount: 2,
            // Generate 100 Widgets that display their index in the List
            children: List.generate(10, (index) {
              return _buildCard(index);
            }),
          ),
        ),
        new Text("text")
      ],
    ),
    

提交回复
热议问题