measureSizeChanges method

Stream<Rectangle<num>> measureSizeChanges()

An event stream that fires when the inner content of the overlay has a dimension or position change.

This allows to measure how big a popup or tooltip will be once made visible, as it will silently change visibility from Visibility.None to Visibility.Hidden in order to be able to measure layout.

Implementation

Stream<Rectangle> measureSizeChanges() async* {
  // Visibility cannot be None to calculate overlay dimensions (display:
  // none; elements have width and height of 0). It must be at least Hidden
  // (i.e. visibility: hidden;).
  if (state.visibility == Visibility.None) {
    state.visibility = Visibility.Hidden;
  }
  await _applyChanges();
  yield* (_runOutsideAngular(() {
    return _asyncMeasureSize(overlayElement, track: true)
        .distinct(_isEqualSize);
  }) as Stream<Rectangle>?)!;
}