contentPortal static method
The matrix that draws the real sheet — laid out at sheet, its own
frame — inside the droplet's frame blob.
The sheet is never re-laid-out at the droplet's size: text would reflow
on every frame. Instead its top-centre is pinned to the droplet's
top-centre and, with scaleContent, the whole sheet is scaled uniformly
by the width ratio — the zoom-transition look, where the header grows out
of the droplet. Without scaleContent the sheet stays 1:1 and the droplet
acts as a window that widens over it.
Identity once blob equals sheet, so the handoff to the resting sheet
cannot move a pixel.
Implementation
static Matrix4 contentPortal({
required Rect sheet,
required Rect blob,
bool scaleContent = true,
}) {
final scale =
scaleContent && sheet.width > 0.0 ? blob.width / sheet.width : 1.0;
return Matrix4.translationValues(
blob.center.dx - sheet.center.dx * scale,
blob.top - sheet.top * scale,
0.0,
)..scaleByDouble(scale, scale, 1.0, 1.0);
}