GlassBackdropGroup class

Premium glass surfaces that read the backdrop together, in one pass.

On Impeller every BackdropFilter ends the render pass and copies the whole screen before it runs, however small the glass. Premium glass has two of these per surface (the blur, or the iOS 27 frost with its weight, and the refraction shader), so six surfaces cost a dozen full-screen copies a frame. Inside a GlassBackdropGroup the surfaces share one backdrop read for the blur and the frost, and where their filters match (the same settings) the engine runs that filter once for all of them. Only the refraction pass stays per surface. This is the same idea as SwiftUI's GlassEffectContainer, which renders its glass "together, improving rendering performance".

GlassTabBar and GlassAppBar group their own glass already (see their groupBackdrop), and join a group of yours when they sit inside one, so a group around both bars makes them share one read. Around other glass that sits side by side over content, like a toolbar of your own, add one yourself:

GlassBackdropGroup(
  child: Row(children: [GlassButton(...), GlassButton(...)]),
)

Two things change for the glass inside:

  • Glass doesn't see glass. The shared read happens when the first surface of the group paints. A surface that lies over another surface of the same group shows the content behind both instead of the glass below it, and so does anything painted between the two. Keep overlapping glass out of the group, with enabled: false around it. Glass inside the content of another glass surface, or under an Opacity, FadeTransition or AnimatedOpacity (at any value, fully opaque included), a shader mask or a save-layer clip, stays out of the group on its own, since it is or may be drawn into a render pass of its own. So does a surface with a visible LiquidGlassSettings.backerColor: its blur reads back the backer pad painted beneath it, which a read shared with other surfaces, taken before that pad exists, would miss.
  • The frost doesn't see what the glass paints inside itself. The frost's cloud is blurred from the shared read, so content a glass surface draws into its own glass layer isn't part of it. The sharp content itself is unaffected.

Wrap the glass of one screen, such as its bars, rather than a Navigator or a tab stack: glass on routes or tabs that are kept alive offstage still counts as a member, so a surface that is alone on screen may take the shared path for nothing.

A group with a single surface in it changes nothing. Without Impeller (web, Skia) the group has no effect.

Inheritance
Available extensions

Constructors

GlassBackdropGroup({required Widget child, bool enabled = true, bool joinEnclosing = false, Key? key})
Lets the premium glass in child read the backdrop together, or, with enabled false, keeps it out of any group further up.
const

Properties

child → Widget
The subtree whose premium glass shares the backdrop read.
final
enabled → bool
Whether child shares a backdrop read. False keeps the glass in child out of an enclosing group, e.g. an indicator that lies over the bar it belongs to.
final
hashCode → int
The hash code for this object.
no setterinherited
joinEnclosing → bool
Whether child joins an enabled group further up instead of starting a group of its own. Without one it starts its own, as usual. The bars set this, so a GlassBackdropGroup around several bars makes them one group.
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() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<GlassBackdropGroup>
Creates the mutable state for this widget at a given location in the tree.
override
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
glassContextMenu({Key? key, required List<Widget> actions, WidgetBuilder? previewBuilder, bool enabled = true, bool enableHaptics = true, double borderRadius = 32.0, double? previewBorderRadius, double rowBorderRadius = 16.0, BorderRadius? rowCorners, Color? originSlotColor, Color? backgroundColor, LiquidGlassSettings? settings, GlassQuality? quality, double backdropBlur = 0.0, Color? barrierColor, double menuWidth = 250.0, VoidCallback? onOpened, VoidCallback? onDismissed, Duration longPressDuration = const Duration(milliseconds: 700)}) → Widget

Available on Widget, provided by the GlassContextMenuExtension extension

Wraps this widget in a GlassContextMenu displaying actions on long-press or right-click.
glassFullScreenCover({required bool isPresented, VoidCallback? onDismiss, required WidgetBuilder content, bool enableSwipeToDismiss = true, double dismissThreshold = 140.0, LiquidGlassSettings? settings, GlassQuality? quality}) → Widget

Available on Widget, provided by the GlassFullScreenCoverExtension extension

Presents a full-viewport modal cover whenever isPresented is true.

Available on Widget, provided by the GlassNavigationTitleExtension extension

Annotates this widget with a navigation title that drives enclosing or descendant GlassAppBar / GlassAppBar.pinned bars (when their explicit title is null) as well as header accessibility semantics.
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

Operators

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

Static Methods

keyOf(BuildContext context) → BackdropKey?
The key the premium glass under context shares its backdrop read through, or null outside a GlassBackdropGroup or inside a disabled one.