container with multiple child flutter code example

Example 1: create a row with two child in flutter

import 'package:flutter/material.dart';



class MemberProfile extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return Scaffold(
 body: Container(
    decoration: BoxDecoration(
      gradient: LinearGradient(
        colors: [Color.fromRGBO(1, 89, 99, 1.0), Colors.grey],
        begin: Alignment.bottomLeft,
        end: Alignment.topRight,
      ),
    ),
    width: MediaQuery.of(context).size.width,
    //height: 1500.0,
    child: Row(
      mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget> [
          Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[

              Text("Name : Sam Cromer",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),

              Text("Sex : Male",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
              Text("Age : 42",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
              Text("Status : Divorced",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
              Text("Event : Motorcycle",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
              Text("Bio :",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
                       Text("Bio :",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
                       Text("Bio :",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),
                       Text("Bio :",
                  style: TextStyle(
                      color: Colors.white70,
                      fontWeight: FontWeight.bold,
                      fontSize: 19.0)),

            ],
          ),
          Column(
            children: <Widget>[

              SizedBox(
                width: 200.0,
                height: 200.0,
                child: Image.asset('lib/img/darth-vader_small.jpg'),  // Your image widget here
              ),

            ],
          ),
        ]
    ),
      ),
   );
 }
}

Example 2: create a row with two child in flutter

class MemberProfile extends StatelessWidget {
   @override
    Widget build(BuildContext context) {
   return Scaffold(
    appBar:  LBAppBar().getAppBar(),
    drawer:  LBDrawer().getDrawer(),
     body: 
      Container(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: [Color.fromRGBO(1, 89, 99, 1.0), Colors.grey],
            begin: Alignment.bottomLeft,
            end: Alignment.topRight,
          ),
        ),
        child:     
         Container(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Container(
                margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                child: Text("Name : Sam Cromer",
                    style: TextStyle(
                        color: Colors.white70,
                        fontWeight: FontWeight.bold,
                        fontSize: 19.0)),
              ),
              Container(
                  margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                  child: Text("Sex : Male",
                      style: TextStyle(
                          color: Colors.white70,
                          fontWeight: FontWeight.bold,
                          fontSize: 19.0))),
              Container(
                  margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                  child: Text("Age : 42",
                      style: TextStyle(
                          color: Colors.white70,
                          fontWeight: FontWeight.bold,
                          fontSize: 19.0))),
              Container(
                  margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                  child: Text("Status : Divorced",
                      style: TextStyle(
                          color: Colors.white70,
                          fontWeight: FontWeight.bold,
                          fontSize: 19.0))),
              Container(
                  margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                  child: Text("Trumatic Event : ",
                      style: TextStyle(
                          color: Colors.white70,
                          fontWeight: FontWeight.bold,
                          fontSize: 19.0))),
              Container(
                  margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                  child: Text("Motorcycle Accident July 2005, TBI",
                      style: TextStyle(
                          color: Colors.white70,
                          fontWeight: FontWeight.bold,
                          fontSize: 19.0))),
              Container(
                  margin: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20.0),
                  child: Text("Bio :",
                      style: TextStyle(
                          color: Colors.white70,
                          fontWeight: FontWeight.bold,
                          fontSize: 19.0))),
              Container(
                margin: EdgeInsets.only(
                    left: 30.0, top: 150.0, bottom: 30.0, right: 30.0),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: <Widget>[
                    Container(
                      margin: EdgeInsets.all(20.0),
                      child: OutlineButton(
                        child: Text('Offer support'),
                        textColor: Colors.white,
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(30.0)),
                        onPressed: () {
                          // Navigator.of(context).push( MaterialPageRoute(builder: (BuildContext context) =>  CheckInQ()));
                        },
                      ),
                    )
                  ],
                ),
              )
            ],
          ),

        ),
        //here
      ),

);
  }
}

Tags:

Misc Example