Container
小部件,并从其decoration
属性设置boxShadow
属性。
示例代码
Container(
height: 75,
width: 150,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
offset: Offset(0, 1),
blurRadius: 5,
color: Colors.black.withOpacity(0.3),
),
],
),
);
Container(
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
offset: Offset(0, 1),
blurRadius: 5,
spreadRadius: 0,
)
],
),
child: Container(),
);
}