1、width、height:宽和高

2、margin:外边距

设置所有的外边距
margin: EdgeInsets.all(20)

设置相应的外边距
margin: EdgeInsets.fromLTRB(20, 50, 0, 0)

3、padding:内间距

设置所有的内间距
padding:EdgeInsets.all(20),

设置相应的内间距
padding: EdgeInsets.fromLTRB(0, 20, 0, 0)

4、decoration:设置圆角和边框,不能和color同时使用,用在child下面会被覆盖,

      decoration: BoxDecoration(
        //边框
        color: Colors.pink,
        border: Border.all(
          color: Colors.black,
          width: 10.0,
        ),
        //圆角
        //设置其中的一个圆角
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(50),
        ),
        //设置所有的圆角
        borderRadius: BorderRadius.circular(50),
      ),

5、color:颜色,不能和decoration同时使用,

6、transform:移动、圆角、缩放等

//旋转 正值是顺时针 
transform: Matrix4.rotationZ(0.3),

//平移
transform: Matrix4.translationValues(20, 20, 0),

7、alignment:对齐方式

设置child的位置
alignment: Alignment.topCenter,

8、child:子组件

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐