determinePrefferedSize method

  1. @override
Vector2 determinePrefferedSize(
  1. Vector2 parentBounds
)
override

Determine how large this widget wants to be, based on constraints like child, width, height, fontSize, ... use parentBounds for unpreffered sizes

Implementation

@override
Vector2 determinePrefferedSize(Vector2 parentBounds) {
  if (!hasLayout) {
    hasLayout = true;
    textPainter?.layout(minWidth: parentBounds.x, maxWidth: parentBounds.x);
  }
  return Vector2(parentBounds.x, textPainter?.height ?? 0);
}