layout method
layout API.
Implementation
@override
PwBox layout(Context context, BoxConstraints constraints) {
final PdfRaster? raster = PdfImageCodec.decode(image.bytes);
final double iw = raster == null
? (width ?? 120)
: (dpi != null
? raster.width * 72 / dpi!
: width ?? raster.width.toDouble());
final double ih = raster == null
? (height ?? 80)
: (dpi != null
? raster.height * 72 / dpi!
: height ??
(width != null && raster.width > 0
? width! * raster.height / raster.width
: raster.height.toDouble()));
final PwSize size = constraints.constrain(PwSize(iw, ih));
return _ImageBox(size, image.bytes, raster);
}