notifyDimension method
Handles canvas size changes.
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;
}
//TODO: iOS device holds pointer during rotation
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: Called during rebuild, so notify must be postponed one frame - will be solved by widget/state
Future.delayed(Duration(), () => notifyListeners());
return true;
}