GlassTravel class Composition

Declares that the glass below may move anywhere inside this widget's box, and asks the host to capture the whole box for it.

What it buys: a surface moving over still content inside the region is drawn from the proxy already held — no capture, no repack. What it costs: the slot is the region rather than the surface, so the atlas holds more screen. Worth it for a control whose glass moves while a finger is down; not for a panel that sits still.

Motion is free only if moving the glass repaints nothing else: the proxy is also retaken when content under it changes, and a repaint mints a new picture in whichever repaint boundary owns it. So the moving surface's parent should paint nothing of its own — the content it moves over belongs behind a RepaintBoundary of its own, which is what the package's own components do.

A surface that leaves the region is captured again, so the declaration is a price and never a correctness claim: a region drawn too small costs captures, never a wrong picture.

GlassTravel(
  child: SizedBox(
    width: 320,
    height: 64,
    child: Stack(
      children: <Widget>[
        const Positioned.fill(child: RepaintBoundary(child: Track())), // still content
        AnimatedPositioned(
          duration: const Duration(milliseconds: 200),
          left: knobX,
          top: 8,
          width: 48,
          height: 48,
          child: const GlassSurface(borderRadius: kGlassCapsule),
        ),
      ],
    ),
  ),
)

See also:

Inheritance

Constructors

GlassTravel({required Widget child, Key? key})
Declares child's box as the region the glass inside it moves within.
const

Properties

child → Widget
The subtree whose glass moves; the region is this child's box.
final
hashCode → int
The hash code for this object.
no setterinherited
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<GlassTravel>
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