drawImage method
Implementation
void drawImage(Canvas canvas) {
if (behaviour.image == null) return;
double w = behaviour.image!.width.toDouble();
double h = behaviour.image!.height.toDouble();
double scaledW = this.size;
double scaledH = (scaledW * h) / w;
canvas.drawImageRect(
behaviour.image!,
Rect.fromLTWH(0, 0, w, h),
Rect.fromPoints(Offset(pos.dx - scaledW / 2, pos.dy - scaledH / 2),
Offset(pos.dx + scaledW / 2, pos.dy + scaledH / 2)),
getPaint());
}