/**
* 在子控件绘制之前或之后绘制一个装饰
const DecoratedBox({
Key key,
@required this.decoration,//要绘制的装饰器
this.position = DecorationPosition.background,//绘制在子组件上面(DecorationPosition.background)还是下面(DecorationPosition.foreground)
Widget child
})
*/
body: DecoratedBox(
decoration: new BoxDecoration(
color: Color(0x6600ff00),
border: Border.all(
color: Color(0xff0000ff)
),
borderRadius: BorderRadius.circular(10.0),
),
position: DecorationPosition.foreground,
// position: DecorationPosition.background,
child: Container(
padding: EdgeInsets.all(50.0),
child: Container(
width: 200.0,
height: 200.0,
color: Color(0xffff0000),
),
),
)
网友评论