如何给边框加渐变?
在Container()
外面套一个Container()
,加上padding: EdgeInsets.all(),
就可以,all()
中写边框的大小。
注意: child:
中的 Container()
, padding
正常写,margin
属性写在父级 Container()
中
Container(
padding: EdgeInsets.all(1.0),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xFFFFE4BA),
Color(0xFFAFF0B5),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Container(
// 代码内容
),
),