drawXLabelValue method Null safety
x축 라벨을 그립니다.
Implementation
void drawXLabelValue(Canvas canvas, Size size, String valueLabel, String valueBottomLabel, Offset barCenter, double barHeight, double barHeightBottom) {
final xLabelValuePainter = TextPainter(
text: TextSpan(text: valueLabel, style: TextStyle(color: Colors.black, fontSize: xLabelValueSize)),
textAlign: TextAlign.center,
textDirection: TextDirection.ltr,
);
xLabelValuePainter.layout(minWidth: barWidth, maxWidth: barWidth + (barSpace / 2));
final xBottomLabelValuePainter = TextPainter(
text: TextSpan(text: valueBottomLabel, style: TextStyle(color: Colors.black, fontSize: xLabelValueSize)),
textAlign: TextAlign.center,
textDirection: TextDirection.ltr,
);
xBottomLabelValuePainter.layout(minWidth: barWidth, maxWidth: barWidth + (barSpace / 2));
double dx = barCenter.dx - (barWidth / 2);
double dy = baseOffsetY +
size.height -
(xLabelDaySize + xLabelDayMargin) -
(xLabelHourSize + xLabelHourMargin) -
(xLabelBirthDaySize + xLabelBirthDayMargin) -
(barHeight + horizontalLineHeight + xLabelValueSize + xLabelValueMargin);
xLabelValuePainter.paint(canvas, Offset(dx, dy));
if (isBiDirectional) {
double dyBottom = baseOffsetY +
size.height -
(xLabelDaySize + xLabelDayMargin) -
(xLabelHourSize + xLabelHourMargin) -
(xLabelBirthDaySize + xLabelBirthDayMargin) +
(barHeightBottom + horizontalLineHeight + xLabelValueSize - xLabelValueMargin);
xBottomLabelValuePainter.paint(canvas, Offset(dx, dyBottom));
}
}