gpt4 book ai didi

flutter - 如何在 flutter 中为小部件添加阴影?

转载 作者:IT老高 更新时间:2023-10-28 12:31:31 32 4
gpt4 key购买 nike

如何向小部件添加阴影,如下图所示?

This是我当前的小部件代码。

Image with shadow

最佳答案

查看 BoxShadowBoxDecoration

Container 可以采用 BoxDecoration(脱离您最初发布的代码),它采用 boxShadow

return Container(
margin: EdgeInsets.only(left: 30, top: 100, right: 30, bottom: 50),
height: double.infinity,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10)
),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
),
)

关于flutter - 如何在 flutter 中为小部件添加阴影?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52227846/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com