measure method

  1. @override
void measure(
  1. double parentWidth,
  2. double parentHeight
)
override

Implementation

@override
void measure(double parentWidth, double parentHeight) {
  double length = vertical ? parentHeight : parentWidth;
  double size = 0;
  AxisLine line = axis.axisLine;
  if (line.show) {
    size += line.style.width;
  }
  if (line.tick != null && line.tick!.show) {
    var mainTick = line.tick!;
    if (mainTick.minorTick != null && mainTick.minorTick!.show) {
      size += m.max(line.tick!.length, mainTick.minorTick!.length);
    } else {
      size += line.tick!.length;
    }
  } else {
    if (line.tick != null && line.tick!.show) {
      size += line.tick!.length;
    }
  }
  if (axis.axisLabel.show) {
    size += axis.axisLabel.margin;
    var maxStr = getMaxStr();
    Size textSize = axis.axisLabel.labelStyle.measure(maxStr);
    size += (vertical) ? textSize.height : textSize.width;
  }
  Rect rect;
  if (vertical) {
    rect = Rect.fromLTWH(0, 0, size, length);
  } else {
    rect = Rect.fromLTWH(0, 0, length, size);
  }
  _axisSize = AxisSize(rect, rect.topLeft, rect.topRight, length);
}