Container({
Key key,
this.alignment, // 内部对齐方式
this.padding, // padding值
this.color, // 背景色 和 decorator 不能共存
this.decoration,
this.foregroundDecoration,
double width, // 宽
double height,//高
BoxConstraints constraints,
this.margin,
this.transform, // 设置旋转什么的
this.child,
this.clipBehavior = Clip.none,
})
Demo
截屏2020-05-12 下午10.04.39.png
Container(
height: 200,
width: 200,
// color: Colors.green,
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
border: new Border.all(width: 5), // 边色与边宽度
color: Color(0xFF9E9E9E), // 底色
borderRadius: new BorderRadius.vertical(top: Radius.elliptical(20, 50)),
),
transform: Matrix4.rotationZ(0.3),
child: Container(
color: Colors.red,
width: 100,
height: 100,
alignment: Alignment.center,
child: Text("Hello world"),
),
);
网友评论