Components API
Reference documentation for the component system: ComponentDescriptor, DashboardComponentConfiguration, ComponentCategory, DashboardEditorRegistry, and DashboardDescriptor.
ComponentDescriptor
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
schemaType | String | Yes | Unique schema type (e.g., 'lms.stat_card') |
componentKey | String | Yes | Registry lookup key |
displayName | String | Yes | Name shown in palette |
description | String | No | Tooltip description (default: '') |
icon | IconData | No | Palette icon (default: Icons.widgets) |
category | ComponentCategory | No | Palette category (default: general) |
isPrimitive | bool | No | Framework-provided primitive (default: false) |
defaultSize | Size | No | Default grid size (default: Size(2, 2)) |
minSize | Size? | No | Minimum resize size (default: Size(1, 1)) |
maxSize | Size? | No | Maximum resize size (default: null) |
isResizable | bool | No | Whether resizable (default: true) |
minCellHeight | double? | No | Minimum row height (default: null) |
properties | PropertiesFactory | Yes | Factory for PropertyCollection |
render | ComponentBuilder | Yes | Widget builder |
configPanel | ConfigPanelBuilder? | No | Config panel builder |
thumbnail | ThumbnailBuilder? | No | Palette thumbnail builder |
Methods
createPropertiesreturnsPropertyCollectionPropertyCollection createProperties()Calls the properties factory.
buildreturnsWidgetWidget build(BuildContext context, PropertyCollection properties)Calls the render callback.
buildConfigPanelreturnsWidget?Widget? buildConfigPanel(BuildContext context, PropertyCollection properties)Calls configPanel or auto-generates.
buildThumbnailreturnsWidget?Widget? buildThumbnail(BuildContext context)Calls thumbnail callback.
toJsonreturnsMap<String, dynamic>Map<String, dynamic> toJson()Returns {'schemaType': schemaType}.
Declarative, composition-based component definition. The recommended way to define dashboard components.
Type Aliases
typedef ComponentBuilder = Widget Function(
BuildContext context,
PropertyCollection properties,
);
typedef PropertiesFactory = PropertyCollection Function();
typedef ConfigPanelBuilder = Widget? Function(
BuildContext context,
PropertyCollection properties,
);
typedef ThumbnailBuilder = Widget? Function(BuildContext context);DashboardComponentConfiguration
abstractClass Signature
Properties
| Property | Type | Default | Description |
|---|---|---|---|
schemaType | String | -- | Unique schema type identifier (required) |
componentKey | String | -- | Registry lookup key (abstract) |
displayName | String | -- | Palette display name (abstract) |
description | String | -- | Description text (abstract) |
icon | IconData | Icons.widgets | Palette icon |
category | ComponentCategory | general | Palette category |
isPrimitive | bool | false | Framework primitive flag |
defaultSize | Size | Size(2, 2) | Default grid size |
minSize | Size? | Size(1, 1) | Min resize size |
maxSize | Size? | null | Max resize size |
isResizable | bool | true | Resize flag |
minCellHeight | double? | null | Min row height |
Methods
createPropertiesreturnsPropertyCollectionPropertyCollection createProperties()Abstract: returns the properties for this component.
buildreturnsWidgetWidget build(BuildContext context, PropertyCollection properties)Abstract: builds the rendered widget.
toJsonreturnsMap<String, dynamic>Map<String, dynamic> toJson()Abstract: serializes the component configuration.
buildConfigPanelreturnsWidget?Widget? buildConfigPanel(BuildContext context, PropertyCollection properties)Virtual: defaults to TabbedPropertyCollectionEditor.
buildThumbnailreturnsWidget?Widget? buildThumbnail(BuildContext context)Virtual: defaults to null.
Abstract base class for dashboard components. Use ComponentDescriptor for most cases.
ComponentCategory
Class Signature
Properties
| Property | Type | Default | Description |
|---|---|---|---|
id | String | -- | Unique identifier (required) |
displayName | String | -- | Human-readable name (required) |
icon | IconData? | null | Optional palette icon |
sortOrder | int | 999 | Sort priority (lower = first) |
Metadata for organizing components in the editor palette.
Built-in Categories
static const ComponentCategory primitives = ComponentCategory(
id: 'primitives',
displayName: 'Primitives',
icon: Icons.widgets,
sortOrder: 1,
);
static const ComponentCategory general = ComponentCategory(
id: 'general',
displayName: 'General',
icon: Icons.category,
sortOrder: 999,
);DashboardDescriptor
Class Signature
Properties
| Property | Type | Default | Description |
|---|---|---|---|
name | String | -- | Unique group name (e.g., 'LMS') (required) |
description | String? | null | Human-readable description |
category | ComponentCategory? | null | Optional category |
tags | List<String> | [] | Tags for filtering |
components | List<DashboardComponentConfiguration> | [] | Components in this group |
A named group of dashboard components belonging to a specific product or domain.
DashboardEditorRegistry
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dashboards | List<DashboardDescriptor> | Yes | Dashboard descriptor groups to index for this editor/view scope |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
dashboards | List<DashboardDescriptor> | -- | All registered descriptors |
dashboardCount | int | -- | Number of descriptors |
componentCount | int | -- | Number of components |
categories | ComponentCategoryRegistry | -- | Category registry |
Methods
getDashboardreturnsDashboardDescriptor?DashboardDescriptor? getDashboard(String name)Get descriptor by name.
getComponentsForreturnsList<DashboardComponentConfiguration>List<DashboardComponentConfiguration> getComponentsFor(String name)Components in a descriptor.
hasDashboardreturnsboolbool hasDashboard(String name)Check if descriptor exists.
getreturnsDashboardComponentConfiguration?DashboardComponentConfiguration? get(String componentKey)Look up a component by key.
getAllreturnsList<DashboardComponentConfiguration>List<DashboardComponentConfiguration> getAll()All registered components.
hasComponentreturnsboolbool hasComponent(String componentKey)Check if a component key is registered.
getByCategoryreturnsList<DashboardComponentConfiguration>List<DashboardComponentConfiguration> getByCategory(String categoryId)Filter components by category ID.
getPrimitivesreturnsList<DashboardComponentConfiguration>List<DashboardComponentConfiguration> getPrimitives()Returns framework-provided primitives.
getGroupedByCategoryreturnsMap<String, List<DashboardComponentConfiguration>>Map<String, List<DashboardComponentConfiguration>> getGroupedByCategory()Components grouped by category ID.
Scoped registry for dashboard descriptors and their components. Create one registry per product/module shell and pass it to DashboardEditorController, DashboardEngine, and DashboardView; internal widgets read it through DashboardRegistryScope.
Next Steps
- Layout API -- DashboardLayout, Row, Column, ComponentInstance
- Engine API -- Engine, Commands, Events
- Component System Concept -- Detailed explanation