loadDefaults method
Load default mappings for the NiceToDev component library.
Implementation
void loadDefaults() {
final defaults = [
const NiceComponentMapping(
schemaType: 'dataGrid',
reactComponent: 'NiceDataGrid',
flutterWidget: 'NiceDataGrid',
description: 'Data grid with sorting, filtering, paging',
propMapping: {'dataSource': 'dataSource', 'columns': 'columns'},
),
const NiceComponentMapping(
schemaType: 'form',
reactComponent: 'NiceForm',
flutterWidget: 'NiceForm',
description: 'Dynamic form with field definitions',
propMapping: {'fields': 'fields', 'onSubmit': 'onSubmit'},
),
const NiceComponentMapping(
schemaType: 'chart',
reactComponent: 'NiceChart',
flutterWidget: 'NiceChart',
description: 'Chart visualization (bar, line, pie, etc.)',
propMapping: {'type': 'chartType', 'data': 'data'},
),
const NiceComponentMapping(
schemaType: 'kpi',
reactComponent: 'NiceDataDisplay',
flutterWidget: 'NiceKpiCard',
description: 'KPI metric card',
propMapping: {'value': 'value', 'title': 'title'},
),
const NiceComponentMapping(
schemaType: 'textInput',
reactComponent: 'NiceTextInput',
flutterWidget: 'NiceTextInput',
description: 'Single-line text input',
propMapping: {'value': 'value', 'onChange': 'onChanged'},
),
const NiceComponentMapping(
schemaType: 'numberInput',
reactComponent: 'NiceNumberInput',
flutterWidget: 'NiceNumberInput',
description: 'Numeric input field',
propMapping: {'value': 'value', 'onChange': 'onChanged'},
),
const NiceComponentMapping(
schemaType: 'select',
reactComponent: 'NiceSelect',
flutterWidget: 'NiceSelect',
description: 'Dropdown / select box',
propMapping: {'value': 'value', 'options': 'items'},
),
const NiceComponentMapping(
schemaType: 'checkbox',
reactComponent: 'NiceCheckbox',
flutterWidget: 'NiceCheckbox',
description: 'Checkbox toggle',
propMapping: {'checked': 'value', 'onChange': 'onChanged'},
),
const NiceComponentMapping(
schemaType: 'datePicker',
reactComponent: 'NiceDatePicker',
flutterWidget: 'NiceDatePicker',
description: 'Date picker field',
propMapping: {'value': 'value', 'onChange': 'onChanged'},
),
const NiceComponentMapping(
schemaType: 'htmlEditor',
reactComponent: 'NiceHtmlEditor',
flutterWidget: 'NiceHtmlEditor',
description: 'Rich text / HTML editor',
propMapping: {'value': 'value', 'onChange': 'onChange'},
),
const NiceComponentMapping(
schemaType: 'toolbar',
reactComponent: 'NiceToolbar',
flutterWidget: 'NiceToolbar',
description: 'Toolbar with action buttons',
propMapping: {'items': 'items'},
),
const NiceComponentMapping(
schemaType: 'treeView',
reactComponent: 'NiceTreeView',
flutterWidget: 'NiceTreeView',
description: 'Hierarchical tree view',
propMapping: {'data': 'nodes', 'onSelect': 'onNodeTap'},
),
const NiceComponentMapping(
schemaType: 'list',
reactComponent: 'NiceList',
flutterWidget: 'NiceList',
description: 'Scrollable list with item template',
propMapping: {'dataSource': 'items', 'itemRender': 'itemBuilder'},
),
const NiceComponentMapping(
schemaType: 'tabs',
reactComponent: 'NiceMultiView',
flutterWidget: 'NiceMultiView',
description: 'Tabbed container',
propMapping: {'items': 'views', 'selectedIndex': 'selectedIndex'},
),
const NiceComponentMapping(
schemaType: 'menu',
reactComponent: 'NiceMenu',
flutterWidget: 'NiceMenu',
description: 'Navigation menu',
propMapping: {'items': 'items', 'onItemClick': 'onItemTap'},
),
const NiceComponentMapping(
schemaType: 'calendar',
reactComponent: 'NiceCalendar',
flutterWidget: 'NiceCalendar',
description: 'Calendar date display',
propMapping: {'value': 'value', 'onChange': 'onDateChanged'},
),
const NiceComponentMapping(
schemaType: 'scheduler',
reactComponent: 'NiceScheduler',
flutterWidget: 'NiceScheduler',
description: 'Scheduling calendar view',
propMapping: {'events': 'events', 'currentDate': 'currentDate'},
),
const NiceComponentMapping(
schemaType: 'gantt',
reactComponent: 'NiceGantt',
flutterWidget: 'NiceGantt',
description: 'Gantt chart for project timelines',
propMapping: {'tasks': 'tasks'},
),
];
for (final mapping in defaults) {
register(mapping);
}
}