GlassBackdrop class

Content that glass above it refracts, on every platform.

Glass can bend only what it can read. Impeller (iOS, Android, macOS) lets glass read the live backdrop behind it; elsewhere (Skia, the web, Linux and Windows) a GlassBackdrop keeps a copy of its background for the glass in its child to bend, as Glisse's data-glisse-backdrop marks content for its glass to bend in every browser. The copy is taken again whenever the background paints anything new, so it may move, scroll and animate.

GlassBackdrop(
  background: Image.asset('wallpaper.jpg', fit: BoxFit.cover),
  child: Center(child: GlassButton(child: Text('Continue'), onPressed: () {})),
)
Inheritance

Constructors

GlassBackdrop.new({Key? key, required Widget background, required Widget child, double? pixelRatio, bool enabled = true})
Lays background under child and keeps a copy of it for glass to bend.
const

Properties

background → Widget
What the glass in child bends: laid out to fill this widget, behind child.
final
child → Widget
The glass, and anything else over the background.
final
enabled → bool
Whether to copy the background at all. Off, glass frosts the live backdrop where it can and paints its rim.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
pixelRatio → double?
The copy's resolution, in device pixels per logical pixel. Defaults to the display's, at most 3. Lower is cheaper and blurrier.
final
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<GlassBackdrop>
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
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

inherit({required GlassBackdropController? controller, required Widget child}) → Widget
Gives the glass in child a backdrop found elsewhere, as for an overlay laid out outside the GlassBackdrop it floats over.
maybeOf(BuildContext context) → GlassBackdropController?
The nearest backdrop's controller, if any.