Container(
width: 300,
height: 100,
margin: EdgeInsets.all(10),
decoration: new BoxDecoration(
border: new Border.all(width: 0, color: Colors.red),
color: Colors.blue,
boxShadow: [
BoxShadow(
color: Colors.yellow,
offset: Offset(0, 1),
blurRadius: 20,
spreadRadius: 10
),
BoxShadow(
color: Colors.yellow,
offset: Offset(-1, 0),
blurRadius: 2,
spreadRadius: 0
),
]),
),
封装
class ShadowContainerUtils {
static shadowContainerUtils(Widget child,{Function ? callback}) {
return GestureDetector(
onTap: (){
if(callback != null){
callback();
}
},
child: Container(
margin: EdgeInsets.only(top: 30.rpx),
padding: EdgeInsets.symmetric(horizontal: 15.rpx),
width: double.infinity,
decoration: BoxDecoration(
color: const Color(0xffffffff),
borderRadius: BorderRadius.circular(10.rpx),
boxShadow: const [
BoxShadow(
color: Colors.black12,
offset: Offset(0.0, 5.0),
blurRadius: 15.0,
spreadRadius: 1.0
)
]),
child: child),
);
}
}