【flutter】padding和margin

child: Container(

    //如果你使用了decoration属性,就不能再使用color属性。这个color参数只是“decoration: new BoxDecoration(color:color)”的简写。    

    //因此,以下代码运行会提示错误,二者不能同时出现

    //color: Colors.green,

    padding: EdgeInsets.fromLTRB(10, 10, 15, 20),//内边距,里边的蓝块,需要给宽高

    margin: EdgeInsets.fromLTRB(100, 10, 15, 15),//外边距,父容器本身相对外部容器的移动

    width: 200,

    height: 200,

    decoration: new BoxDecoration(

        border: new Border.all(width: 2.0, color: Colors.red),

        color: Colors.green,

        borderRadius: new BorderRadius.all(new Radius.circular(20.0)),

        image: new DecorationImage(

            image: new NetworkImage('http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),

            centerSlice: new Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),

        ),

    ),

    //子容器,如果父容器给了内变局,子容器的宽高好像没什么用了

    child: Container(

        width: 10,

        height: 10,

        color: Colors.blue,

        child: Text('我是随便点内容'),

        alignment: Alignment.centerLeft,

    ),    

    //alignment: Alignment.center,

),