establishesStackingContext property

bool get establishesStackingContext
inherited

Implementation

bool get establishesStackingContext {
  // Root element of the document
  if (isDocumentRootBox()) return true;

  // Fixed or sticky always establish a stacking context
  if (position == CSSPositionType.fixed || position == CSSPositionType.sticky) return true;

  // Positioned with non-auto z-index
  if ((position == CSSPositionType.absolute || position == CSSPositionType.relative) && zIndex != null) {
    return true;
  }

  // Flex or Grid items with non-auto z-index
  final CSSRenderStyle? parent = getParentRenderStyle();
  if (parent != null &&
      ((parent.display == CSSDisplay.flex || parent.display == CSSDisplay.inlineFlex) ||
          (parent.display == CSSDisplay.grid || parent.display == CSSDisplay.inlineGrid)) &&
      zIndex != null) {
    return true;
  }

  // Compositing triggers
  if (opacity < 1.0) return true;
  if (transform != null) return true;
  if (filter != null) return true;

  return false;
}