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
scenePlayerentry mounts this with thepairknob'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
Enums
Extensions
- FlutterColorToScene on Color
- FlutterRectToScene on Rect
- SceneBlendModeToFlutter on SceneBlendMode
- SceneColorToFlutter on SceneColor
- SceneCornersToFlutter on SceneCorners
- SceneCrossAxisAlignmentToFlutter on SceneCrossAxisAlignment
- SceneEdgesToFlutter on SceneEdges
- SceneFontWeightToFlutter on SceneFontWeight
- SceneListenableToFlutter on SceneListenable
- SceneMainAxisAlignmentToFlutter on SceneMainAxisAlignment
- SceneRectToFlutter on SceneRect
- SceneStrokeJoinToFlutter on SceneStrokeJoin
- SceneTextAlignToFlutter on SceneTextAlign
- SceneTextDecorationStyleToFlutter on SceneTextDecorationStyle
- SceneTextDecorationToFlutter on SceneTextDecoration
-
TextDecorationis a combinable set rather than an enum, so this one switches where the others index. -
SceneValueToFlutter
on SceneValue<
T>
Functions
-
bindExternals(
SceneDocument doc, List< ExternalWidget> declarations, {List<Token< tokens = const []}) → voidObject?> > -
Gives every external node in
docthe 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
scenepaints with. -
resolveExports(
SceneNode node, Map< String, Object?> exports) → void -
Puts the app's own values on the properties of
nodebound to them. -
resolveTokenArgs(
SceneArgs args, Map< String, Object?> tokens) → SceneArgs -
argswith 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
SceneTokensgetter for aColorexport 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, aforegroundpaint) is the app's to draw: the guest renders with the app's ownTextStyleunderneath, 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.childdraws 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.