【Flutter】Container 设置外边距margin

代码格式:

Container(
      margin: EdgeInsets.all(6.0),
      //'6.0'为外边距宽度,根据调整大小,4边等宽
    )

EdgeInsets可选参数:

EdgeInsets.fromLTRB(this.left, this.top, this.right, this.bottom)
示例
 margin: EdgeInsets.fromLTRB(2, 2, 2, 4),

可分别设置4边宽度,按顺序为分别为左,上,右,下

EdgeInsets.only({
    this.left = 0.0,
    this.top = 0.0,
    this.right = 0.0,
    this.bottom = 0.0,
  });
margin: EdgeInsets.only(top: 1,left: 2,bottom: 3,right: 4),

Ed4 N 2geInsets.only传递一个数组,可根据需要设置指定外边距,顺序可自由排列

参数
top上边距
left左边距
right右边距
bottom下边距
© 版权声明
THE END
喜欢就支持一下吧
分享
评论 抢沙发

请登录后发表评论

    暂无评论内容