calcLeft method
Returns the calculated x position from sourceRect
.
If contentRect
is provided, it is considered to be the size of the
content being aligned if it were visible.
Implementation
num calcLeft(Rectangle sourceRect, [Rectangle? contentRect]) {
if (requiresContentSizeToPosition && contentRect == null) {
throw ArgumentError.notNull('contentRect');
}
var left = sourceRect.left;
if (this == Center) {
left += sourceRect.width / 2 - contentRect!.width / 2;
} else if (this == End) {
left += sourceRect.width - contentRect!.width;
}
return left;
}