registerInteractables method
void
registerInteractables(
- ComponentInstance componentInstance,
- FocusManager focusManager,
- RenderManager renderManager
Recursively registers interactable components with the focus and render systems.
This method traverses the component tree starting from componentInstance and:
- Registers all InteractableComponentInstance instances with the
focusManager - Assigns the
renderManagerto both interactable and stateful components - Recursively processes all children of parent components
Parameters:
componentInstance: The root component instance to start registration fromfocusManager: The focus manager that handles focus navigation and staterenderManager: The render manager responsible for coordinating rendering operations
Usage: Typically called during application or scene initialization to wire up interactivity and ensure all components have access to rendering services.
Example:
final registry = InteractableRegistry();
registry.registerInteractables(
rootComponentInstance,
focusManager,
renderManager,
);
Implementation
void registerInteractables(
ComponentInstance componentInstance,
FocusManager focusManager,
RenderManager renderManager,
) {
if (componentInstance is InteractableComponentInstance) {
focusManager.register(componentInstance);
componentInstance.renderManager = renderManager;
}
if (componentInstance is StatefulComponentInstance) {
Logger.trace(
"InteractableRegistry",
'Stateful Component $componentInstance registered',
);
componentInstance.renderManager = renderManager;
}
if (componentInstance is ParentComponentInstance) {
for (var child in componentInstance.childrenInstance) {
registerInteractables(child, focusManager, renderManager);
}
}
}