Rows and Columns

Expand our layout: Create multiple widgets on page at once.

Rows

Columns

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Hello Shaun!"),
        centerTitle: true,
        backgroundColor: Colors.cyan[300],
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.end, // Must be in Row widget: not inside of any other widgets
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: <Widget>[
          Container(
            color: Colors.cyan,
            padding: EdgeInsets.all(20.0),
            child: Text("one"),
          ),
          Container(
            color: Colors.red,
            padding: EdgeInsets.all(30.0),
            child: Text("two"),
          ),
          Container(
            color: Colors.purple,
            padding: EdgeInsets.all(40.0),
            child: Text("three"),
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: Text('click'),
        backgroundColor: Colors.blueGrey[800],
      ),
    );
  }
}
class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Hello Shaun!"),
        centerTitle: true,
        backgroundColor: Colors.cyan[300],
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.end, // Must be in Row widget: not inside of any other widgets
        crossAxisAlignment: CrossAxisAlignment.end,
        children: <Widget>[
          Row( // Row takes full width of the column: therefore, it is on the top of rest of container.
            children: [
              Text("Hello,"),
              Text(" world"),
              Container(
                color: Colors.pinkAccent,
                padding: EdgeInsets.all(10.0),
                child: Text("zero"),
              ),
            ],
          ),
          Container(
            color: Colors.cyan,
            padding: EdgeInsets.all(20.0),
            child: Text("one"),
          ),
          Container(
            color: Colors.red,
            padding: EdgeInsets.all(30.0),
            child: Text("two"),
          ),
          Container(
            color: Colors.purple,
            padding: EdgeInsets.all(40.0),
            child: Text("three"),
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: Text('click'),
        backgroundColor: Colors.blueGrey[800],
      ),
    );
  }
}