scene library

The Flutter half of the scene system: motion playback and the bridges between the pure authoring core (package:flutterware/scene_authoring.dart) and Flutter's types.

This library never exports the authoring vocabulary, so a file can import it next to material.dart without a name colliding.

Experimental. This surface still moves with the editor and is not yet a supported API.

Classes

LayeredText
A text node's paragraph, painted once per layer.
MotionPlayer
A motion, with a clock.
SceneCanvasHost
The scene editor's canvas, hosted by the app whose theme and widgets the scenes use.
SceneGroup
What one folder of scenes may use, declared once in that folder's scenes.dart — the app's widgets, the app's own values by name, the token libraries the scenes read, and what wraps the canvas.
ScenePlayerHost
A scene and its motion, played from the file the editor wrote — the shape an export walks. The generated scenePlayer entry mounts this with the pair knob's path.
SceneTextStackPainter
Public so a test can hold the invariant the whole thing rests on: the style here IS the style the base text was laid out with. One resolved style, two consumers.
SceneView

Functions

bindExternals(SceneDocument doc, List<ExternalWidget> declarations, {List<Token<Object?>> tokens = const []}) → void
Gives every external node in doc the builder its label names.
installSceneFrameFlush() → void
Route the core's coalesced fx flush through the frame: post-frame callback + ensureVisualUpdate, the probed 500-writes-to-1-rebuild shape that also wakes a hidden or idle window. Idempotent; every Flutter process that hosts scene documents installs it once at startup.
namedRects(Map<SceneNode, SceneRect> rects) → Map<String, SceneRect>
The same rects under the names the nodes carry — what the guest sends back over the wire, and what a surface holding a PARSED document asks its geometry by.
precacheSceneShaders(SceneDocument scene) → Future<void>
Loads every fragment program scene paints with.
resolveExports(SceneNode node, Map<String, Object?> exports) → void
Puts the app's own values on the properties of node bound to them.
resolveTokenArgs(SceneArgs args, Map<String, Object?> tokens) → SceneArgs
args with every opaque-token marker replaced by the token's object; a marker naming nothing the app declared resolves to null, which is the widget's own fallback.
sceneColorOf(Color color) → SceneColor
The app's colour as the scene core spells it — what the generated SceneTokens getter for a Color export returns, and what the guest puts on a property bound to one.
sceneFontVariations(TextNode t) → List<FontVariation>?
The face's axes, at whatever a motion has them — the one thing a discrete FontWeight cannot do, which is why an axis is a number key of its own.
sceneRunStyle(SceneTextStyle d) → TextStyle
A run's delta as Flutter spells one: only the fields it sets.
sceneTextRuns(TextNode t) → List<InlineSpan>
The spans a text node draws — its runs, each carrying only what it DIFFERS by, over the node's own style.
sceneTextStyleFor(TextNode t) → TextStyle
A text node's resolved properties as Flutter draws them. The animatable ones are read composed — what a motion track put there this frame — and the rest straight off the node.
sceneTextStyleOf(TextStyle style) → SceneTextStyle
The properties of the app's text style the table knows. What is left out (fontFeatures, shadows, a foreground paint) is the app's to draw: the guest renders with the app's own TextStyle underneath, so nothing is lost on the canvas, only unnamed in the editor.

Typedefs

SceneChildRenderer = Widget Function(SceneNode child)
The view's own picture of one node, handed to a kind's renderer.
SceneKindRenderer = Widget Function(BuildContext context, KindNode node, SceneChildRenderer child)
Draws one node of a registered kind. It reads the node's rows itself — composed through fxRendered, so a motion's track reaches it — and its children, which the view does not lay out for it. child draws one of them the way the view draws any node, for a kind that shows a child somewhere the view cannot reach — on a mesh, say. What it returns stays live: it redraws with the document, wherever it is mounted.
SceneMeasured = void Function(Map<SceneNode, SceneRect> rects)
Reports what the layout measured, in artboard coordinates. The editor's geometry comes from here: a flex child has no authored position, so the only true answer is the one the renderer laid out.