flutter 学习内边距panding 外边距margin

6,483 阅读1分钟

只是设置内边距(padding)的代码示例

body: Center(
  child: Container(
    child:  new Text("hello zzl ",
    style: TextStyle(
      fontSize: 40.0,
    ),
      textAlign: TextAlign.center,
    ),
    alignment: Alignment.topCenter,
    width: 500.0,
    height: 400.0,
    color: Colors.blue,
    padding: const EdgeInsets.all(50.0),//外边距
   // margin: const EdgeInsets.all(100.0),//内边距
  ),
  ),

效果图如下:

设置内边距(padding)和外边距(margin)的代码示例

body: Center(
  child: Container(
    child:  new Text("hello zzl ",
    style: TextStyle(
      fontSize: 40.0,
    ),
      textAlign: TextAlign.center,
    ),
    alignment: Alignment.topCenter,
    width: 500.0,
    height: 400.0,
    color: Colors.blue,
    padding: const EdgeInsets.all(50.0),//外边距
   // margin: const EdgeInsets.all(100.0),//内边距
  ),
  ),

效果图如下:

对于前端的程序员,这些属性应该是很熟悉的,学起来也简单容易。对于我一个iOS开发出身的码农来说,我要从头学起!请您们多多指教,谢谢,我是哪个奔跑在代码里的小学生!