SceneView constructor

SceneView(
  1. SceneDefinition definition, {
  2. Key? key,
  3. SceneMotion<SceneDefinition>? motion,
  4. ValueListenable<Duration>? time,
  5. Set<String> selected = const {},
  6. SceneMeasured? onMeasured,
  7. Map<String, SceneKindRenderer> renderers = const {},
})

Draws a scene an app COMPILED — SceneView(BannerScene()), which is the whole of what mounting one takes.

The definition holds its document (built once, late final), so this costs nothing per rebuild. It does not make the definition safe to build in build(): a fresh BannerScene() is fresh nodes, and a player would go on writing its fx onto the ones that went away. Hold it in a field.

Implementation

SceneView(
  SceneDefinition definition, {
  super.key,
  SceneMotion? motion,
  this.time,
  this.selected = const {},
  this.onMeasured,
  this.renderers = const {},
}) : scene = definition.scene,
     motion = motion?.playable;