buildBoxShadow function

Widget buildBoxShadow(
  1. {GestureTapCallback onTap,
  2. AlignmentGeometry alignment,
  3. double height,
  4. double width,
  5. Offset offset,
  6. Color boxColor,
  7. double blurRadius = 10,
  8. BorderRadiusGeometry borderRadiusGeometry,
  9. Widget child,
  10. EdgeInsetsGeometry padding,
  11. BoxBorder border,
  12. EdgeInsets margin,
  13. double radius = 5}
)

阴影框

Implementation

Widget buildBoxShadow({GestureTapCallback onTap, AlignmentGeometry alignment, double height, double width, Offset offset, Color boxColor, double blurRadius = 10, BorderRadiusGeometry borderRadiusGeometry, Widget child, EdgeInsetsGeometry padding, BoxBorder border, EdgeInsets margin, double radius = 5}){
  return GestureDetector(
    onTap: onTap,
    child: Container(
        margin: margin,
        padding: padding,
        width: width,
        height: height,
        alignment: alignment,
        decoration: BoxDecoration(
            border: border,
            color: Theme.of(context).canvasColor,
            boxShadow: [
              BoxShadow(
                offset: offset??Offset(5.0, 5.0),
                color: boxColor??Color(0xff9cb3b3b3),//阴影颜色
                blurRadius: blurRadius,//阴影大小
              )
            ],
            borderRadius: borderRadiusGeometry??BorderRadius.all(Radius.circular(radius))
        ),
        child: child
    ),
  );
}