美文网首页flutter
Flutter之DecoratedBox组件

Flutter之DecoratedBox组件

作者: 习惯了_就好 | 来源:发表于2019-01-23 10:55 被阅读16次
    /**
     * 在子控件绘制之前或之后绘制一个装饰
        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),
                  ),
                ),
              )
    

    相关文章

      网友评论

        本文标题:Flutter之DecoratedBox组件

        本文链接:https://www.haomeiwen.com/subject/umkjjqtx.html