Flutter之BoxShadow组件

/** 阴影效果
    const BoxShadow({
    Color color = const Color(0xFF000000),//阴影默认颜色,不能与父容器同时设置color
    Offset offset = Offset.zero,//延伸的阴影,向右下偏移的距离
    double blurRadius = 0.0,//延伸距离,会有模糊效果
    this.spreadRadius = 0.0 //延伸距离,不会有模糊效果
    })
 */
body: ListView(
          children: [
            Container(
              width: 100.0,
              height: 100.0,
              margin: EdgeInsets.all(20.0),
//          color: Color(0xfff1f1f1),
              decoration: BoxDecoration(
                  color: Color(0xffffffff),
                  boxShadow: [
                    BoxShadow(
                      color: Color(0xffff0000),
                      blurRadius: 5.0,
                    ),
                  ]
              ),
            ),
            Container(
              width: 100.0,
              height: 100.0,
              margin: EdgeInsets.all(20.0),
              decoration: BoxDecoration(
                  color: Color(0xffffffff),
                  boxShadow: [
                    BoxShadow(
                      color: Color(0xffff0000),
                      spreadRadius: 5.0,
                    ),
                  ]
              ),
            ),
            Container(
              width: 100.0,
              height: 100.0,
              margin: EdgeInsets.all(20.0),
              decoration: BoxDecoration(
                  color: Color(0xffffffff),
                  boxShadow: [
                    BoxShadow(
                      color: Color(0xffff0000),
                      spreadRadius: 5.0,
                      offset: Offset(3.0, 3.0),
                    ),
                  ],
              ),
            ),
          ],
        ),

码云地址:https://gitee.com/xgljh/Flutter.git

你可能感兴趣的:(Flutter之BoxShadow组件)