createOverlayPane method

Future<HtmlElement> createOverlayPane([
  1. OverlayState state = _defaultConfig
])

Returns a future that completes with an overlay pane DOM element.

The element is created and appended in the next DOM write queue.

Implementation

Future<HtmlElement> createOverlayPane([OverlayState state = _defaultConfig]) {
  // Create a detached DIV to use as the overlay host.
  HtmlElement pane = DivElement()
    ..attributes['pane-id'] = _createUniqueId()
    ..classes.add(_paneClassName);

  // Depending on the initial positioning, size, and visibility, apply the
  // state properties to the detached element (we do not need to use a DOM
  // write queue because it is not attached).
  applyStateSync(state, pane);

  if (!_useDomSynchronously) {
    return _domService.onWrite().then((_) {
      containerElement.append(pane);
      return pane;
    });
  } else {
    containerElement.append(pane);
    return Future.value(pane);
  }
}