udContainerBoxDecoration function

BoxDecoration udContainerBoxDecoration({
  1. required BuildContext context,
  2. Color? backgroundColor,
  3. double? borderRadius,
  4. BorderRadius? customBorderRadius,
  5. Color? borderColor,
  6. double? borderWidth,
  7. bool? disableShadow,
  8. Color? shadowColor,
  9. Offset? shadowOffset,
  10. double? shadowBlurRadius,
  11. double? shadowSpreadRadius,
  12. bool? gradientEnable,
  13. Gradient? gradient,
})

Box decoration for container is now more easy with udContainerBoxDecoration. Just check parameters and pass values.

Implementation

BoxDecoration udContainerBoxDecoration({
  required BuildContext context,
  Color? backgroundColor,
  double? borderRadius,
  BorderRadius? customBorderRadius,
  Color? borderColor,
  double? borderWidth,
  bool? disableShadow,
  Color? shadowColor,
  Offset? shadowOffset,
  double? shadowBlurRadius,
  double? shadowSpreadRadius,
  bool? gradientEnable,
  Gradient? gradient,
}) {
  double _design = doNotUseThisDesignValue(context: context);
  return BoxDecoration(
    color: gradientEnable != true ? backgroundColor ?? Colors.white : null,
    gradient: gradientEnable == true
        ? gradient != null
            ? gradient
            : LinearGradient(
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
                colors: [
                  DoNotUseThisPackageColors.theme,
                  DoNotUseThisPackageColors.green,
                ],
              )
        : null,
    border: borderColor != null
        ? Border.all(
            color: borderColor,
            width: borderWidth != null ? borderWidth : 1,
          )
        : null,
    borderRadius: customBorderRadius ??
        BorderRadius.all(
          Radius.circular(borderRadius ?? _design * 2),
        ),
    boxShadow: disableShadow != true
        ? [
            BoxShadow(
              color: shadowColor ?? Colors.black.withOpacity(0.06),
              offset: shadowOffset ?? Offset(0, 1),
              blurRadius: shadowBlurRadius ?? 3,
              spreadRadius: shadowSpreadRadius ?? 0,
            ),
          ]
        : [],
  );
}