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),
),
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM