drawXAxis method

List<int> drawXAxis(
  1. Canvas canvas,
  2. Size size
)

designs the x axis canvas: is the object we are going to draw size: is the size of the area where we are going to draw returns an array containing: firs two are coordinates where we'll start building the markers of this axis and the last one are real points in the x axis

Implementation

List<int> drawXAxis(Canvas canvas, Size size) {
  //par de valores para x e y
  const double x1 = 10;
  double x2 = size.width - 10;
  double y1 = size.height - 30;
  double y2 = size.height - 30;

  final p1 = Offset(x1, y1);
  final p2 = Offset(x2, y2);

  final paint = Paint()
    ..color = Colors.black
    ..style = PaintingStyle.stroke
    ..strokeWidth = 1;
  canvas.drawLine(p1, p2, paint);
  return [x1.toInt() + 10, y1.toInt(), x1.toInt()];
}