drawActualValue method
Draws the gauge actual value
Implementation
void drawActualValue(Canvas canvas, Size size) {
final actualValuePainter = TextPainter(
text: TextSpan(
text: actualValue.toStringAsFixed(decimalPlaces),
style: actualValueTextStyle,
),
textDirection: TextDirection.ltr,
)..layout();
final Offset actualValuePosition = Offset(
(size.width / 2.8) -
actualValuePainter.width +
(20 - ((pointerIcon.size ?? 24.0) - 20)),
getActualValuePosition(size) - (actualValuePainter.height / 2),
);
switch (gaugeOrientation) {
case GaugeOrientation.horizontal:
final pivot = actualValuePainter.size.center(actualValuePosition);
canvas.save();
canvas.translate(pivot.dx, pivot.dy);
canvas.rotate(RadialHelper.degreesToRadians(-90));
canvas.translate(-pivot.dx, -pivot.dy);
actualValuePainter.paint(canvas, actualValuePosition);
canvas.restore();
break;
case GaugeOrientation.vertical:
actualValuePainter.paint(canvas, actualValuePosition);
}
}