Question: New to flutter, can some one tells me whats wrong with below code[![enter image description here](https://i.stack.imgur.com/5b5lp.png)](https://i.stack.imgur.com/5b5lp.png)

```
  class GamePage extends StatelessWidget {
  int _row;
  int _column;

  GamePage(this._row,this._column);

  @override
  Widget build(BuildContext context) {
    return new Material(
      color: Colors.deepPurpleAccent,
      child:new Expanded(
          child:new GridView.count(crossAxisCount: _column,children: new List.generate(_row*_column, (index) {
        return new Center(
            child: new CellWidget()
        );
      }),) )

    );
  }
}

```

Attaching error screenshot.

Answer: 
Crash
=====

This crashes because Expanded is not a descendant of a Flex widget:

```
Container(
  child: Expanded(
    child: MyWidget(),
  ),
)

```

Acceptable
==========

Here Expanded *is* a descendant of Flex:

```
Flex(
  direction: Axis.horizontal,
  children: [
    Expanded(
      child: MyWidget(),
    ),
  ],
)

```

Row is also a Flex widget:

```
Row(
  children: [
    Expanded(
      child: MyWidget(),
    ),
  ],
)

```

And so is Column:

```
Column(
  children: [
    Expanded(
      child: MyWidget(),
    ),
  ],
)

```

Another option is to just get rid of the Expanded widget:

```
Container(
  child: MyWidget(),
)

```
You need to try using `Flex` Widget on that