【发布时间】:2020-12-31 07:18:58
【问题描述】:
我尝试向圆形容器添加阴影,但 Flutter 会添加阴影,就好像容器是垂直矩形一样,这是我不想要的。我在 Google 上查找了这个问题,但找不到任何合适的解决方案,请帮助我。
容器代码
Container(
width: MediaQuery.of(context).size.width * 0.82,
height: MediaQuery.of(context).size.height * 0.28,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
color: Color(0xFFF9D276),
borderRadius: BorderRadius.circular(35),
boxShadow: [
BoxShadow(
offset: Offset(0, 4),
color: Color(0xFFF9D276).withOpacity(0.15),
spreadRadius: 4,
blurRadius: 50
)
]
),
)
更新 @HardikKumar 的回答以及我真正想要的方式
【问题讨论】:
-
你想要什么样的影子?你希望影子只在一侧?
标签: flutter user-interface widget hybrid-mobile-app shadow