width property
int
get
width
Implementation
int get width {
// Width calc priority: style > attr > intrinsic.
// When CSS width is 'auto', _styleWidth returns null, so we fall back to intrinsic sizing
final double borderBoxWidth = _styleWidth ?? _attrWidth ?? (naturalWidth > 0 ? naturalWidth.toDouble() : renderStyle.getWidthByAspectRatio());
return borderBoxWidth.isFinite ? borderBoxWidth.round() : 0;
}
set
width
(int value)
Implementation
set width(int value) {
if (value == width) return;
internalSetAttribute(WIDTH, '${value}px');
if (_shouldScaling) {
_reloadImage();
} else {
_resizeImage();
}
}