【发布时间】:2021-06-06 19:21:00
【问题描述】:
我正在尝试使列表中的项目发光。为此,我在项目的装饰中使用 box-shadow。但它出现在其他项目之上,而不是作为背景。如何在兄弟项目后面绘制 boxshadow。
class ShadowItem extends StatelessWidget {
const ShadowItem({required this.isWithGlow});
final bool isWithGlow;
@override
Widget build(BuildContext context) {
return Container(
height: 100,
decoration: BoxDecoration(
boxShadow: (isWithGlow)
? [
BoxShadow(
color: Colors.blue,
blurRadius: 42.0,
spreadRadius: 0.0,
offset: Offset(
0.0,
12.0,
),
),
]
: [],
),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(19),
),
),
);
}
}
【问题讨论】: