答案 0 :(得分:1)
可以这样做
Container(
height:100,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.white],
begin: Alignment.topCenter,
end: Alignment.bottomCenter
)
),
),
您正在寻找结果吗?
答案 1 :(得分:1)
这主要取决于您的用例,例如,如果要显示阴影,可以直接使用
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 100,
width: 100,
color: Colors.blue,
),
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black,
offset: Offset(0, 1),
blurRadius: 10,
spreadRadius: 0.5,
),
],
),
height: 10,
width: 100,
)
],
)
输出:
答案 2 :(得分:1)