drawMinorTickMarks method
void
drawMinorTickMarks(
{ - required Canvas canvas,
- required Size size,
})
Implementation
void drawMinorTickMarks({required Canvas canvas, required Size size}) {
/// the total length of the scale
final scaleLength = getScaleLength(size);
/// the minor division
/// multiplying the max division by 5 to find the total divisions within the scale
var minorDivisions = divisions * 5;
/// finds the distance needed between each [MinorDivisions]
final interval = scaleLength / minorDivisions;
double minorTickMarkPosition = 0;
switch (gaugeOrientation) {
case GaugeOrientation.horizontal:
minorTickMarkPosition = getScaleLowerLimit(size);
break;
case GaugeOrientation.vertical:
minorTickMarkPosition = size.height / kLowerScaleLimitVertical;
break;
}
for (var i = 0; i < (minorDivisions + 1); i++) {
final Offset minorTickMarksEndPoint =
Offset((size.width / 1.9) + gaugeStrokeWidth, minorTickMarkPosition);
final Offset minorTickMarksStartPoint =
Offset(size.width / 2, minorTickMarkPosition);
final majorTickMarksPainter = Paint()
..color = Colors.grey.shade300
..strokeWidth = minorTickStrokeWidth;
canvas.drawLine(minorTickMarksStartPoint, minorTickMarksEndPoint,
majorTickMarksPainter);
minorTickMarkPosition = minorTickMarkPosition + interval;
}
}