SceneSurface class

The widget that hands a rendered frame to Flutter.

The third copy is what made this a package, and the third copy argued against it. All three applications had these forty lines, and the racing one carried the objection written out:

It is not one yet because the three differ in exactly one place, the shadow settings, and a package whose only parameter is the thing each caller sets differently is a package that has moved an argument rather than removed a duplicate.

That was right about a settings parameter, and it is answered by not having one. The three no longer differ in one place either — the crypt turns reflections off, the platformer asks for three cascades at 2048, the circuit sets an exposure and a sky — so a parameter per difference would be four parameters and growing.

settings is a function called once per frame, and that is a capability rather than a style: it lets a game derive what a frame is drawn with from where the camera ended up.

The circuit needs that — its fog colour is the colour of the air along this view, so it is only right if it is worked out after the camera has moved. It manages that today by placing its camera in the tick, before setState, and computing the colour in the parent's build. The crypt cannot: it places its camera in onBeforeFrame, which runs after the parent has built, so anything it derived there would describe the frame before.

So the two games do the same thing in two different places, and only one of the two places works for both. A function called here is that place.

Inheritance

Constructors

SceneSurface({Key? key, required Renderer renderer, required Scene scene, required RenderView view, required RenderSettings settings(), required VoidCallback onBeforeFrame, required FramePresenter presentFrame})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onBeforeFrame → VoidCallback
The last thing to happen before the frame: place the camera, sync the visuals, advance whatever is drawn but not simulated.
final
presentFrame → FramePresenter
presentFrame, normally — see FramePresenter for why this is a parameter rather than an import.
final
renderer → Renderer
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scene → Scene
final
settings → RenderSettings Function()
What this frame should be drawn with.
final
view → RenderView
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited