MorphTag class

The identity marker: registers its RenderBox in the scope and hands the engine a (rect, shape) pair. The shape is declared, never inferred from decoration. Prefer declaring the whole surface once via spec and rendering from specOf; the individual fields remain for terse cases.

Inheritance

Constructors

MorphTag({Key? key, required Object id, required Widget child, MorphSurfaceSpec? spec, ShapeBorder shape = const RoundedRectangleBorder(), Color? surfaceColor, double elevation = 0, Widget? replica, double? bumpScale, double? bumpRecoil, bool snapshotGhost = false})
Creates an identity tag around child.
const

Properties

bumpRecoil double?
The button's kick-off on landing: displacement along the impact axis in logical pixels per unit of undershoot. Squash is barely visible on small elements (a FAB) - the impact is carried by the recoil. null falls back to MorphTheme.bumpRecoil, then 140.
final
bumpScale double?
How visible the residual bounce is after handoff: scale = 1 + value * bumpScale while value < 0. null falls back to MorphTheme.bumpScale, then 0.6.
final
child Widget
The tagged widget; replicated in the shuttle during flight.
final
elevation double
The source widget's elevation: the shuttle's shadow starts from it. A button with its own shadow (a FAB) must declare it here, otherwise the shadow pops when the tag hides and at handoff.
final
hashCode int
The hash code for this object.
no setterinherited
id Object
Unique identity within the enclosing MorphScope.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
replica Widget?
The "in-flight" version of the child for the shuttle. For buttons with their own decoration (background, shadow) put the flat content here: in flight the shuttle provides background and shadow, and a replicated decoration would be clipped at the edges. null - the child itself flies.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape ShapeBorder
The source outline the shuttle takes off from.
final
snapshotGhost bool
The ghost in the shuttle as a pixel snapshot instead of a second build. Opt-in for heavy content: the snapshot freezes ephemeral state (e.g. a mid-ripple), which on ordinary buttons looks worse than a live widget replica.
final
spec MorphSurfaceSpec?
The surface model declared as one value; when set it wins over shape/surfaceColor/elevation. Descendants read it back via specOf and render the visible surface from it - one source of truth for the eye and for the flight.
final
surfaceColor Color?
The source widget's surface color: the shuttle's surfaceColor starts from it so the container looks like the button at flight start. WITHOUT it the shuttle starts from the TARGET color and mismatches the button on the first frame - mandatory for opaque buttons.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<MorphTag>
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

idOf(BuildContext context) Object
The id of the nearest enclosing MorphTag. Lets a tap handler inside the tag's own subtree call showMorph* WITHOUT repeating the id - the morph flies from the surface the finger is already on. Content that launches a morph from elsewhere (a morphable skin piece, a list controller) still names its source explicitly.
maybeIdOf(BuildContext context) Object?
Like idOf, but null outside a tag subtree.
maybeSpecOf(BuildContext context) MorphSurfaceSpec?
Like specOf, but null outside a tag subtree.
specOf(BuildContext context) MorphSurfaceSpec
The declared surface model of the nearest enclosing MorphTag - render the visible surface from it instead of repeating the values.