calcTop method

num calcTop(
  1. Rectangle<num> sourceRect, [
  2. Rectangle<num>? contentRect
])

Returns the calculated y 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 calcTop(Rectangle sourceRect, [Rectangle? contentRect]) {
  if (requiresContentSizeToPosition && contentRect == null) {
    throw ArgumentError.notNull('contentRect');
  }
  var top = sourceRect.top;
  if (this == Center) {
    top += sourceRect.height / 2 - contentRect!.height / 2;
  } else if (this == End) {
    top += sourceRect.height - contentRect!.height;
  }
  return top;
}