size property
Size
get
size
The size that this CustomPaint should aim for, given the layout constraints, if there is no child.
If there's a child, this is ignored, and the size of the child is used instead.
Implementation
Size get size {
double? width;
double? height;
RenderStyle renderStyle = renderBoxModel!.renderStyle;
double? styleWidth = renderStyle.width.isAuto ? null : renderStyle.width.computedValue;
double? styleHeight = renderStyle.height.isAuto ? null : renderStyle.height.computedValue;
if (styleWidth != null) {
width = styleWidth;
}
if (styleHeight != null) {
height = styleHeight;
}
// [width/height] has default value, should not be null.
if (height == null && width == null) {
width = this.width.toDouble();
height = this.height.toDouble();
} else if (width == null && height != null) {
width = this.height / height * this.width;
} else if (width != null && height == null) {
height = this.width / width * this.height;
}
return Size(width!, height!);
}