flutter Container颜色渐变(背景图,边框,形状,阴影)

Container(
        decoration: BoxDecoration(
          boxShadow: [
            BoxShadow(
                color: Colors.yellow, blurRadius: 10.0, spreadRadius: 10.0),
          ],
          gradient: new LinearGradient(
              begin: Alignment.bottomCenter,
              end: Alignment.topCenter,
              colors: [
                Colors.amber,
                Colors.yellow,
              ]),
        ),
        padding: EdgeInsets.fromLTRB(0.00, 6.00, 0.00, 6.00),
        width: MediaQuery.of(context).size.width,
        child:

效果 : 

 

const BoxDecoration({
this.color,
this.image,
this.border,
this.borderRadius,
this.boxShadow,
this.gradient,
this.backgroundBlendMode,
this.shape = BoxShape.rectangle,
}) : assert(shape != null),

其他属性的一些例子 :

decoration: BoxDecoration(
color: Colors.green,
border: Border.all(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(3.0),
),
 

posted on 2018-12-20 11:50  --LP--  阅读(8154)  评论(0)    收藏  举报

导航