title: How to draw a rectangle using 4 coordinates?
body: <p>I have a use case in which I've to draw a rectangle using the 4 coordinates. I don't want to use drawLine() as later I need a GestureDetector on the rectangle. How can I draw using drawRect()?</p>
  
  <pre><code>canvas.drawLine(
    new Offset(rectLeft, rectBottom - lineWidth / 2),
    new Offset(rectRight, rectBottom - lineWidth / 2),
    rectPaint
  ); // bottom
  
  canvas.drawLine(
    new Offset(rectLeft, rectTop + lineWidth / 2),
    new Offset(rectRight, rectTop + lineWidth / 2), 
    rectPaint
  ); // top
  
  canvas.drawLine(
    new Offset(rectLeft + lineWidth / 2, rectBottom),
    new Offset(rectLeft + lineWidth / 2, rectTop), 
    rectPaint
  );  //left
  
  canvas.drawLine(
    new Offset(rectRight - lineWidth / 2, rectBottom),
    new Offset(rectRight - lineWidth / 2, rectTop), 
    rectPaint
  );  //right
  </code></pre>