Skip to content

Components API

Reference documentation for the component system: ComponentDescriptor, DashboardComponentConfiguration, ComponentCategory, DashboardEditorRegistry, and DashboardDescriptor.

ComponentDescriptor

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
schemaTypeStringYesUnique schema type (e.g., 'lms.stat_card')
componentKeyStringYesRegistry lookup key
displayNameStringYesName shown in palette
descriptionStringNoTooltip description (default: '')
iconIconDataNoPalette icon (default: Icons.widgets)
categoryComponentCategoryNoPalette category (default: general)
isPrimitiveboolNoFramework-provided primitive (default: false)
defaultSizeSizeNoDefault grid size (default: Size(2, 2))
minSizeSize?NoMinimum resize size (default: Size(1, 1))
maxSizeSize?NoMaximum resize size (default: null)
isResizableboolNoWhether resizable (default: true)
minCellHeightdouble?NoMinimum row height (default: null)
propertiesPropertiesFactoryYesFactory for PropertyCollection
renderComponentBuilderYesWidget builder
configPanelConfigPanelBuilder?NoConfig panel builder
thumbnailThumbnailBuilder?NoPalette thumbnail builder

Methods

  • createProperties returns PropertyCollection
    PropertyCollection createProperties()

    Calls the properties factory.

  • build returns Widget
    Widget build(BuildContext context, PropertyCollection properties)

    Calls the render callback.

  • buildConfigPanel returns Widget?
    Widget? buildConfigPanel(BuildContext context, PropertyCollection properties)

    Calls configPanel or auto-generates.

  • buildThumbnail returns Widget?
    Widget? buildThumbnail(BuildContext context)

    Calls thumbnail callback.

  • toJson returns Map<String, dynamic>
    Map<String, dynamic> toJson()

    Returns {'schemaType': schemaType}.

Declarative, composition-based component definition. The recommended way to define dashboard components.

Type Aliases

dart
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

abstract

Class Signature

Properties

PropertyTypeDefaultDescription
schemaTypeString--Unique schema type identifier (required)
componentKeyString--Registry lookup key (abstract)
displayNameString--Palette display name (abstract)
descriptionString--Description text (abstract)
iconIconDataIcons.widgetsPalette icon
categoryComponentCategorygeneralPalette category
isPrimitiveboolfalseFramework primitive flag
defaultSizeSizeSize(2, 2)Default grid size
minSizeSize?Size(1, 1)Min resize size
maxSizeSize?nullMax resize size
isResizablebooltrueResize flag
minCellHeightdouble?nullMin row height

Methods

  • createProperties returns PropertyCollection
    PropertyCollection createProperties()

    Abstract: returns the properties for this component.

  • build returns Widget
    Widget build(BuildContext context, PropertyCollection properties)

    Abstract: builds the rendered widget.

  • toJson returns Map<String, dynamic>
    Map<String, dynamic> toJson()

    Abstract: serializes the component configuration.

  • buildConfigPanel returns Widget?
    Widget? buildConfigPanel(BuildContext context, PropertyCollection properties)

    Virtual: defaults to TabbedPropertyCollectionEditor.

  • buildThumbnail returns Widget?
    Widget? buildThumbnail(BuildContext context)

    Virtual: defaults to null.

Abstract base class for dashboard components. Use ComponentDescriptor for most cases.


ComponentCategory

Class Signature

Properties

PropertyTypeDefaultDescription
idString--Unique identifier (required)
displayNameString--Human-readable name (required)
iconIconData?nullOptional palette icon
sortOrderint999Sort priority (lower = first)

Metadata for organizing components in the editor palette.

Built-in Categories

dart
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

PropertyTypeDefaultDescription
nameString--Unique group name (e.g., 'LMS') (required)
descriptionString?nullHuman-readable description
categoryComponentCategory?nullOptional category
tagsList<String>[]Tags for filtering
componentsList<DashboardComponentConfiguration>[]Components in this group

A named group of dashboard components belonging to a specific product or domain.


DashboardEditorRegistry

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
dashboardsList<DashboardDescriptor>YesDashboard descriptor groups to index for this editor/view scope

Properties

PropertyTypeDefaultDescription
dashboardsList<DashboardDescriptor>--All registered descriptors
dashboardCountint--Number of descriptors
componentCountint--Number of components
categoriesComponentCategoryRegistry--Category registry

Methods

  • getDashboard returns DashboardDescriptor?
    DashboardDescriptor? getDashboard(String name)

    Get descriptor by name.

  • getComponentsFor returns List<DashboardComponentConfiguration>
    List<DashboardComponentConfiguration> getComponentsFor(String name)

    Components in a descriptor.

  • hasDashboard returns bool
    bool hasDashboard(String name)

    Check if descriptor exists.

  • get returns DashboardComponentConfiguration?
    DashboardComponentConfiguration? get(String componentKey)

    Look up a component by key.

  • getAll returns List<DashboardComponentConfiguration>
    List<DashboardComponentConfiguration> getAll()

    All registered components.

  • hasComponent returns bool
    bool hasComponent(String componentKey)

    Check if a component key is registered.

  • getByCategory returns List<DashboardComponentConfiguration>
    List<DashboardComponentConfiguration> getByCategory(String categoryId)

    Filter components by category ID.

  • getPrimitives returns List<DashboardComponentConfiguration>
    List<DashboardComponentConfiguration> getPrimitives()

    Returns framework-provided primitives.

  • getGroupedByCategory returns Map<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