applyStateSync method

void applyStateSync(
  1. OverlayState state,
  2. HtmlElement pane
)

Like applyState, but is done synchronously.

Implementation

void applyStateSync(OverlayState state, HtmlElement pane) {
  var cssClasses = <String>[];

  // Optionally, make the overlay "modal" style.
  if (state.captureEvents!) {
    cssClasses.add('modal');
  }

  if (state.visibility == Visibility.Visible) cssClasses.add('visible');

  // Write to the DOM.
  _domRuler.updateSync(pane,
      cssClasses: cssClasses,
      width: state.width,
      height: state.height,
      top: state.top,
      left: state.left,
      bottom: state.bottom,
      right: state.right,
      visibility: state.visibility,
      position: state.position,
      useCssTransform: !_useRepositionLoop);

  // This is intentionally not in the ruler.
  if (state.minWidth != null) {
    pane.style.minWidth = '${state.minWidth}px';
  }
  if (state.zIndex != null) {
    pane.style.zIndex = '${state.zIndex}';
  }

  // If it exists, also update z-index of overlay container so it's on top of
  // any other zIndexer-using components
  var p = pane.parent;
  if (p != null) {
    if (_lastZIndex != _zIndexer.peek()) {
      _lastZIndex = _zIndexer.pop();
    }
    _domRuler.updateSync(p, zIndex: _lastZIndex);
  }
}