offsetFromRect method
Calculates display offset from rect
including margin
.
Implementation
Offset offsetFromRect(Rect rect, double fontSize, double margin) {
switch (this) {
case DetectionLabelPosition.topLeft:
case DetectionLabelPosition.topRight:
case DetectionLabelPosition.topCenter:
return Offset(rect.left, rect.top - fontSize - margin);
case DetectionLabelPosition.bottomLeft:
case DetectionLabelPosition.bottomRight:
case DetectionLabelPosition.bottomCenter:
return Offset(rect.left, rect.bottom + margin);
}
}