-
Notifications
You must be signed in to change notification settings - Fork 16
Description
The current architecture for managing widgets and actions in the framework is leading to increasing technical debt over time. Adding a new widget or action requires modifying multiple files, making the system difficult to scale and maintain. If we don’t address this now, it will become even more complex and unmanageable in the future.
This ticket aims to decouple widget and action registration, ensuring each component is self-contained and eliminating the need for centralized imports and manual registrations.
Proposed Changes
These are step by step changes, we can create separate ticket of each as well
-
Move all the widget to
_registeredWidgets
and removelegacyWidgetMap
-
Remove the actions defined in
action.dart
file and create separate files for each e.gShowCameraAction
,NavigateScreenAction
etc so this file can be managed properly -
provide a way to be register a widget properly within the widget file instead of importing and defining it in
widget_registry.dart
.
Just like in ensemble-react, we have widget registry which we can directly call in the widget file to register: https://github.com/EnsembleUI/ensemble-react/blob/main/packages/runtime/src/registry.tsx.
example usage in ensemble-react: https://github.com/EnsembleUI/ensemble-react/blob/ec0304175110ba18891e0fea874b5c42dedbd09e/packages/runtime/src/widgets/Avatar/Avatar.tsx#L131
there shouldn't be any need to importing and defining widgets inwidget_registry.dart
. Ideally we should be able to register widgets like thisWidgetRegistry().register("Avatar", () => Avatar());
in the same file where the widget is defined. -
Create a actions registry, and just like widget registry, actions should be registered in their own files, there shouldn't be any need for importing and defining actions in
action.dart