WidgetComponent class
A live widget subtree on a scene surface.
The component owns the capture pipeline (through a WidgetTextureController)
and the binding of the captured texture to a material; SceneView hosts
the widget subtree invisibly (state, tickers, and animations run normally)
and re-captures it per the update policy.
Three setup tiers share this one component:
- Zero config: the component creates an aspect-correct unlit
alpha-blended quad (
worldHeightworld units tall). - Your
geometry(any surface with 0..1 UVs): the component still owns the material and mesh. - Your
materialand/or abindcallback: the component only callsbindwhen the texture changes. With WidgetComponent.bindOnly no mesh is created at all (for surfaces that already exist, like a screen inside an imported model).
The texture object is stable across captures (overwritten in place) and
replaced only when the capture size changes; bind re-fires exactly on
replacement.
Constructors
- WidgetComponent({required Widget child, required Size size, double pixelRatio = 1.0, double worldHeight = 1.0, WidgetUpdatePolicy update = WidgetUpdatePolicy.everyFrame, WidgetInput input = WidgetInput.automatic, Geometry? geometry, Material? material, void bind(Texture texture)?})
-
Creates a widget surface. With no
geometryan aspect-correct quad is created; with nomaterialand nobind, an unlit alpha-blended material bound to the capture is created. - WidgetComponent.bindOnly({required Widget child, required Size size, required void bind(Texture texture), double pixelRatio = 1.0, WidgetUpdatePolicy update = WidgetUpdatePolicy.everyFrame, WidgetInput input = WidgetInput.automatic})
-
Creates a capture-and-bind-only component: no geometry or mesh is
created, and every texture change is delivered to
bind(which typically assigns a texture slot on an existing material).
Properties
- child → Widget
-
The widget subtree this component shows (hosted by
SceneView).no setter - controller → WidgetTextureController
-
The capture controller: read WidgetTextureController.texture, listen
for changes, forward pointer input, or trigger manual captures.
final
- enabled ↔ bool
-
Whether this component's update hook runs each frame.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- input → WidgetInput
-
How this surface receives pointer input.
final
- isAttached → bool
-
Whether this component is currently attached to a node.
no setterinherited
- isLoaded → bool
-
Whether onLoad has completed.
no setterinherited
- isMounted → bool
-
Whether the owning node is part of a live scene graph.
no setterinherited
- node → Node
-
The node this component is attached to.
no setterinherited
- pixelRatio → double
-
Texels per logical pixel.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → Size
-
The child's logical layout size.
no setter
- updatePolicy → WidgetUpdatePolicy
-
The capture policy (see WidgetUpdatePolicy).
no setter
Methods
-
fixedUpdate(
double fixedDt) → void -
Called once per fixed physics step while the component is mounted,
enabled, and loaded.
fixedDtis the fixed timestep of the surrounding PhysicsWorld, not the frame interval.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAttach(
) → void -
Called when this component is added to a node.
override
-
onDetach(
) → void -
Called when this component is removed from a node.
override
-
onLoad(
) → Future< void> -
Optional asynchronous setup, such as loading an asset.
inherited
-
onMount(
) → void -
Called when the owning node enters a live scene graph.
override
-
onUnmount(
) → void -
Called when the owning node leaves a live scene graph.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double deltaSeconds) → void -
Called once per frame while the component is mounted, enabled, and
loaded.
deltaSecondsis the elapsed time since the previous tick.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited