getLabelWidth method
The width of the label (handles labels spanning multiple lines).
If the label spans multiple lines then it returns the width of the longest line.
Implementation
double getLabelWidth(Iterable<TextElement> labelElements) => labelElements
.map((line) => line.measurement.horizontalSliceWidth)
.reduce(max);