paintBackground method

Size paintBackground(
  1. Canvas canvas,
  2. Size size,
  3. Image image
)

Implementation

Size paintBackground(Canvas canvas, Size size, ui.Image image) {
  final imageSize = Size(image.width.toDouble(), image.height.toDouble());
  final FittedSizes sizes = applyBoxFit(BoxFit.contain, imageSize, size);

  final Rect dstRect =
      Alignment.center.inscribe(sizes.destination, Offset.zero & size);
  canvas.drawImageRect(image, Offset.zero & imageSize, dstRect, Paint());
  return sizes.destination;
}