drawPentagon function

void drawPentagon(
  1. Path path,
  2. double x,
  3. double y,
  4. double width,
  5. double height
)

Draw the Pentagon shape marker

Implementation

void drawPentagon(Path path, double x, double y, double width, double height) {
  const int eq = 72;
  double xValue;
  double yValue;
  for (int i = 0; i <= 5; i++) {
    xValue = width / 2 * math.cos((math.pi / 180) * (i * eq));
    yValue = height / 2 * math.sin((math.pi / 180) * (i * eq));
    i == 0
        ? path.moveTo(x + xValue, y + yValue)
        : path.lineTo(x + xValue, y + yValue);
  }
  path.close();
}