boxDecorationFromDetails function
BoxDecoration?
boxDecorationFromDetails({
- Color? color,
- Border? border,
- BoxShape? shape,
- BorderRadius? borderRadius,
- BlendMode? blendMode,
- List<
BoxShadow> ? boxShadow, - Gradient? gradient,
- DecorationImage? image,
Implementation
BoxDecoration? boxDecorationFromDetails({
Color? color,
Border? border,
BoxShape? shape,
BorderRadius? borderRadius,
BlendMode? blendMode,
List<BoxShadow>? boxShadow,
Gradient? gradient,
DecorationImage? image,
}) {
bool hasCustomProperties = color != null ||
border != null ||
borderRadius != null ||
gradient != null ||
shape != null ||
boxShadow != null ||
image != null;
// If no custom properties are provided, return null
if (!hasCustomProperties) {
return null;
}
return BoxDecoration(
color: color,
border: border,
backgroundBlendMode: color != null || gradient != null ? blendMode : null,
borderRadius: shape == BoxShape.circle ? null : borderRadius,
gradient: gradient,
shape: shape ?? BoxShape.rectangle,
boxShadow: boxShadow,
image: image,
);
}