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: 
You do not have a `Flex` ancestor. 

> 
> An Expanded widget must be a descendant of a Row, Column, or Flex, and the path from the Expanded widget to its enclosing Row, Column, or Flex must contain only StatelessWidgets or StatefulWidgets (not other kinds of widgets, like RenderObjectWidgets).
> 
> 
> 

I am not sure about the need for `Expanded` in your case. But removing it or wrapping it in a `Column` should fix the problem.
sometimes it can also happen if you have an expended widget inside the SingleChildScrollView widget, then it shows the blank screen. If you have any expended widget inside SingleChildScrollView remove it and it will solve the problem.

**Before**

```
  body: SingleChildScrollView(
     child: Column(
     children: [
      Container(),
       Expanded(
       child: Container(),
        ),
       ],
      ),
      ),

```

**After**

```
  body: SingleChildScrollView(
     child: Column(
     children: [
      Container(),
      Container(),
       ],
      ),
      ),

```