color: Colors.redAccent,
offset: Offset(20, 20),
blurRadius: 10,
),
]
复制代码
上面的例子很难看,因为我们可能不知道阴影实际应该设置多大,这点可以参考官方文档的例子:
DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(colors:[Colors.red,Colors.orange[700]]), //背景渐变
borderRadius: BorderRadius.circular(3.0), //3像素圆角
boxShadow: [ //阴影
BoxShadow(
color:Colors.black54,
offset: Offset(2.0,2.0),
blurRadius: 4.0
)
]
),
child: Padding(padding: EdgeInsets.symmetric(horizontal: 80.0, vertical: 18.0),
child: Text(“Login”, style: TextStyle(color: Colors.white),),
)
)
复制代码
gradient 渐变
这部分和 android