onParentResize method

  1. @override
void onParentResize(
  1. Vector2 maxSize
)
override

Called whenever the parent of this component changes size; and also once before onMount.

The component may change its own size or perform layout in response to this call. If the component changes size, then it should call onParentResize for all its children.

Implementation

@override
void onParentResize(Vector2 maxSize) {
  if (_child != null) {
    super.size = Vector2(
      widthFactor == null ? maxSize.x : _child!.size.x * widthFactor!,
      heightFactor == null ? maxSize.y : _child!.size.y * heightFactor!,
    );
  }
  _updateChildPosition();
}