GlassIsolationScope class

An InheritedWidget that tells descendant glass widgets whether to use their own independent glass rendering layer or share the nearest ancestor's.

This is a zero-cost scope marker — it doesn't create any glass rendering context, shader, or compositing layer. It simply provides a signal that descendant AdaptiveGlass widgets check to decide whether to use useOwnLayer: true.

Two roles

  1. Quality hint (defaultQuality) — tells descendants to default to a given quality without explicit params. Zero cost (InheritedWidget lookup).

  2. Layer isolation (isolated: true) — forces descendants to create their own glass layer via useOwnLayer: true. Useful when glass surfaces from different z-layers would otherwise share a blend group incorrectly. Adds GPU cost (separate backdrop capture per layer).

How GlassScaffold uses this

GlassScaffold wraps app bar and bottom bar in GlassIsolationScope(isolated: true, defaultQuality: premium). This provides the quality hint so buttons default to premium, and forces all glass surfaces in the bar to create their own layer by default. This prevents Z-order tearing where grouped glass backgrounds paint behind the scrolling body text but foregrounds paint on top.

GlassScaffold → GlassPage → AdaptiveLiquidGlassLayer (page blend group)
  → body cards → join page blend group (grouped)
  → GlassIsolationScope(isolated: true, defaultQuality: premium) ← bar
    → GlassButton in app bar → uses own layer ✅
    → GlassTabBar.searchable (provides its own isolated: false scope)
      → BottomBarExtraBtn → joins bottom bar blend group ✅

For advanced scenarios where isolation is NOT needed (e.g. built-in bottom bars that provide their own layer), the child widget can simply override the scope by providing its own GlassIsolationScope(isolated: false).

Inheritance

Constructors

GlassIsolationScope({Key? key, bool isolated = true, GlassQuality? defaultQuality, required Widget child})
Creates a glass isolation scope.
const

Properties

child → Widget
The widget below this widget in the tree.
finalinherited
defaultQuality → GlassQuality?
Default quality hint for descendants that don't specify explicit quality.
final
hashCode → int
The hash code for this object.
no setterinherited
isolated → bool
Whether descendants should be isolated from ancestor glass layers.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → InheritedElement
Inflates this configuration to a concrete instance.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited
updateShouldNotify(covariant GlassIsolationScope oldWidget) → bool
Whether the framework should notify widgets that inherit from this widget.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

defaultQualityOf(BuildContext context) → GlassQuality?
Returns the defaultQuality from the nearest GlassIsolationScope, or null if none is set.
isIsolated(BuildContext context) → bool
Returns true if the given context is inside an active GlassIsolationScope with isolated: true.