drawPointer method
Method to draw the pointer on the canvas based on the pointer shape
Implementation
void drawPointer(Canvas canvas, Offset offset, LinearGauge linearGauge,
PaintingContext context) {
if (linearGauge.gaugeOrientation == GaugeOrientation.horizontal) {
if (pointerPosition != PointerPosition.bottom &&
pointerPosition != PointerPosition.center &&
pointerPosition != PointerPosition.top) {
throw ArgumentError(
'Invalid pointer position: $pointerPosition. For a horizontal gauge, pointer should be positioned at top, bottom, or center.');
}
} else {
if (pointerPosition != PointerPosition.left &&
pointerPosition != PointerPosition.center &&
pointerPosition != PointerPosition.right) {
throw ArgumentError(
'Invalid pointer position: $pointerPosition. For a vertical gauge, pointer should be positioned at left, right, or center.');
}
}
_layoutChildWidget(canvas, offset, linearGauge, context);
}