drawBar method Null safety
바를 그립니다.
Implementation
List<dynamic> drawBar(Canvas canvas, Size size, List<BarDataHour?> barDataHour, double offsetDx, int i) {
double barHeight = barDataHour[i]!.realValue.toDouble() * barHeightRatio;
if (barDataHour[i]!.realValue == 0) barHeight = 1;
double barHeightBottom = barDataHour[i]!.realValueBottom.toDouble() * barHeightRatio;
Offset barCenter = Offset(
offsetDx + barStartOffsetX + yLabelWidth + yLabelMargin + (barWidth / 2) + (barWidth + barSpace) * i,
baseOffsetY + size.height - xLabelDaySize - xLabelDayMargin - xLabelHourSize - xLabelHourMargin - xLabelBirthDaySize - xLabelBirthDayMargin - horizontalLineHeight - (barHeight / 2),
);
if (isBiDirectional) {
var barCenterBottom = Offset(
offsetDx + barStartOffsetX + yLabelWidth + yLabelMargin + (barWidth / 2) + (barWidth + barSpace) * i,
baseOffsetY + size.height - xLabelDaySize - xLabelDayMargin - xLabelHourSize - xLabelHourMargin - xLabelBirthDaySize - xLabelBirthDayMargin - horizontalLineHeight + (barHeightBottom / 2),
);
canvas.drawRect(Rect.fromCenter(center: barCenter, width: barWidth, height: barHeight), barDataHour[i]!.isHighlighted ? barPaintStandHighlight : barPaintStand);
canvas.drawRect(Rect.fromCenter(center: barCenterBottom, width: barWidth, height: barHeightBottom), barDataHour[i]!.isHighlighted ? barPaintSitHighlight : barPaintSit);
} else {
canvas.drawRect(Rect.fromCenter(center: barCenter, width: barWidth, height: barHeight), barDataHour[i]!.isHighlighted ? barPaintHighlight : barPaint);
}
return [barCenter, barHeight, barHeightBottom];
}