layoutChildren static method

void layoutChildren(
  1. Rect area,
  2. List<TreeMapNode> nodeList
)

Implementation

static void layoutChildren(Rect area, List<TreeMapNode> nodeList) {
  if (nodeList.isEmpty) {
    return;
  }
  double leftOffset = area.left;
  double w = area.width;
  double h = area.height;
  num allRatio = computeAllRatio(nodeList);
  for (var node in nodeList) {
    double p = node.areaRatio / allRatio;
    double w2 = w * p;
    Rect rect = Rect.fromLTWH(leftOffset, area.top, w2, h);
    node.position = rect;
    leftOffset += rect.width;
  }
}