place method

Rect place(
  1. Size natural
)

用 natural 计算水平居中后叠加 left/top 偏移的绘制矩形。

Implementation

Rect place(Size natural) {
  final size = computeImageBox(
      natural: natural,
      width: image.width,
      height: image.height,
      maxWidth: maxWidth,
      maxHeight: maxHeight);
  return Rect.fromLTWH(
      box.left +
          (box.width - size.width) / kLuckyHalfDivisor +
          (image.left?.resolve(leftBase) ?? 0),
      box.top + (image.top?.resolve(topBase) ?? 0) + yOffset,
      size.width,
      size.height);
}