notifyDimension method

bool notifyDimension(
  1. Size size
)

Implementation

bool notifyDimension(Size size) {
  if (_areaSize == size) {
    return false;
  }

  if (_areaSize.isEmpty ||
      _areaSize.width == size.width ||
      _areaSize.height == size.height) {
    _areaSize = size;
    return false;
  }

  if (hasActivePath) {
    closePath();
  }

  if (!isFilled) {
    _areaSize = size;
    return false;
  }

  final ratioX = size.width / _areaSize.width;
  final ratioY = size.height / _areaSize.height;
  final scale = ratioY;

  _areaSize = size;

  _paths.forEach((path) {
    path!.setScale(scale);
  });

  //TODO: Notify is called during rebuild, so notify must be postponed one frame - will be solved by widget/state

  return true;
}