reLayout method
Core of the auto layout strategy.
If labels in the _adjustableLabelsContainer
overlap, this method takes the
next prescribed auto-layout action - one of the actions defined in the
LabelFitMethod enum (DecreaseLabelFont, RotateLabels, SkipLabels)
Implementation
@override
void reLayout(LayoutExpansion parentLayoutExpansion) {
if (!_adjustableLabelsContainer.labelsOverlap()) {
// if there is no overlap, no (more) iterative calls
// to layout(). Exits from iterative layout.
return;
}
_reLayoutsCounter++;
if (_reLayoutsCounter > _maxLabelReLayouts) {
return;
}
_isRotateLabelsReLayout = false;
switch (_atDepth(_reLayoutsCounter)) {
case LabelFitMethod.decreaseLabelFont:
_reLayoutDecreaseLabelFont();
break;
case LabelFitMethod.rotateLabels:
_reLayoutRotateLabels();
_isRotateLabelsReLayout = true;
break;
case LabelFitMethod.skipLabels:
_reLayoutSkipLabels();
break;
}
// The [layout] method will call this function back if another reLayout is needed, up to [_atDepth] iterations.
_adjustableLabelsContainer.layout(parentLayoutExpansion);
}