SceneView.declarative constructor

const SceneView.declarative({
  1. Key? key,
  2. EnvironmentMap? environment,
  3. double environmentIntensity = 1.0,
  4. double exposure = 1.0,
  5. ToneMappingMode toneMapping = ToneMappingMode.pbrNeutral,
  6. Camera? camera,
  7. SceneCameraBuilder? cameraBuilder,
  8. SceneViewsBuilder? viewsBuilder,
  9. bool autoTick = true,
  10. double? pixelRatio,
  11. SceneTickCallback? onTick,
  12. ResourceGroup? loading,
  13. SceneLoadingBuilder? loadingBuilder,
  14. Duration revealMinDuration = Duration.zero,
  15. bool warmUp = false,
  16. bool debugWidgetInput = false,
  17. List<Widget> children = const [],
})

Renders a view-owned Scene described declaratively by children.

The view constructs and owns an internal Scene; scene widgets in children populate it, and the scene-level props (environment, exposure, toneMapping, ...) configure it. Omitted props mean the scene defaults; removing a prop on a later build restores its default.

SceneView.declarative(
  children: [
    SceneMesh(geometry: geometry, material: material),
  ],
)

Implementation

const SceneView.declarative({
  super.key,
  this.environment,
  this.environmentIntensity = 1.0,
  this.exposure = 1.0,
  ToneMappingMode this.toneMapping = ToneMappingMode.pbrNeutral,
  this.camera,
  this.cameraBuilder,
  this.viewsBuilder,
  this.autoTick = true,
  this.pixelRatio,
  this.onTick,
  this.loading,
  this.loadingBuilder,
  this.revealMinDuration = Duration.zero,
  this.warmUp = false,
  this.debugWidgetInput = false,
  this.children = const [],
}) : scene = null,
     assert(
       (camera != null ? 1 : 0) +
               (cameraBuilder != null ? 1 : 0) +
               (viewsBuilder != null ? 1 : 0) <=
           1,
       'Provide at most one of camera, cameraBuilder, or viewsBuilder.',
     );