availableLayoutBoundingRect method

  1. @protected
MutableRectangle<num> availableLayoutBoundingRect(
  1. TreeNode<Object> node
)
inherited

Available bounding rectangle that can be used to lay out the child renderer elements.

Available bounding rectangle is computed after padding is applied.

Implementation

@protected
MutableRectangle availableLayoutBoundingRect(TreeNode<Object> node) {
  final element = _getRendererElement(node);
  final rect = element.boundingRect;
  final padding = config.rectPaddingPx;

  var top = rect.top + padding.topPx;
  var left = rect.left + padding.leftPx;
  var width = rect.width - padding.leftPx - padding.rightPx;
  var height = rect.height - padding.topPx - padding.bottomPx;

  // Handles an edge case when width or height is negative.
  if (width < 0) {
    left += width / 2;
    width = 0;
  }
  if (height < 0) {
    top += height / 2;
    height = 0;
  }
  return MutableRectangle(left, top, width, height);
}