drawHorizontalLine method Null safety

void drawHorizontalLine(
  1. Canvas canvas,
  2. double offsetDx,
  3. double yCenter
)

가로선을 그립니다.

Implementation

void drawHorizontalLine(Canvas canvas, double offsetDx, double yCenter) {
  if (horizontalLineVisible) {
    var _dx = offsetDx + yLabelWidth + yLabelMargin;
    final _dy = yCenter + (yLabelSize / 2);
    final linePaint = Paint()
      ..color = const Color.fromARGB(25, 0, 0, 0)
      ..style = PaintingStyle.fill
      ..strokeWidth = horizontalLineHeight;
    var endOffsetX = offsetDx + yLabelWidth + yLabelMargin + ((barWidth + barSpace) * hourCntInDay);

    while (_dx < endOffsetX) {
      canvas.drawLine(Offset(_dx, _dy), Offset(_dx + horizontalLineDashWidth, _dy), linePaint);
      _dx += horizontalLineDashWidth + horizontalLineDashSpace;
    }
  }
}