From 502819ff0f6b5f516f33da728199ef2da49ac38c Mon Sep 17 00:00:00 2001 From: Victor Eronmosele Date: Fri, 14 Nov 2025 14:17:02 +0100 Subject: [PATCH 1/2] Add descriptions to catalog items schema objects --- .../lib/src/catalog/core_widgets/audio_player.dart | 6 ++++++ .../genui/lib/src/catalog/core_widgets/button.dart | 7 +++++++ packages/genui/lib/src/catalog/core_widgets/card.dart | 7 +++++++ .../genui/lib/src/catalog/core_widgets/check_box.dart | 7 +++++++ .../genui/lib/src/catalog/core_widgets/column.dart | 7 +++++++ .../lib/src/catalog/core_widgets/date_time_input.dart | 7 +++++++ .../genui/lib/src/catalog/core_widgets/divider.dart | 6 ++++++ packages/genui/lib/src/catalog/core_widgets/icon.dart | 3 +++ packages/genui/lib/src/catalog/core_widgets/image.dart | 10 +++++++++- packages/genui/lib/src/catalog/core_widgets/list.dart | 6 ++++++ packages/genui/lib/src/catalog/core_widgets/modal.dart | 8 ++++++++ .../lib/src/catalog/core_widgets/multiple_choice.dart | 7 +++++++ packages/genui/lib/src/catalog/core_widgets/row.dart | 7 +++++++ .../genui/lib/src/catalog/core_widgets/slider.dart | 7 +++++++ packages/genui/lib/src/catalog/core_widgets/tabs.dart | 7 +++++++ packages/genui/lib/src/catalog/core_widgets/text.dart | 7 +++++++ .../genui/lib/src/catalog/core_widgets/text_field.dart | 7 +++++++ packages/genui/lib/src/catalog/core_widgets/video.dart | 6 ++++++ 18 files changed, 121 insertions(+), 1 deletion(-) diff --git a/packages/genui/lib/src/catalog/core_widgets/audio_player.dart b/packages/genui/lib/src/catalog/core_widgets/audio_player.dart index 9d58af8ae..14389328d 100644 --- a/packages/genui/lib/src/catalog/core_widgets/audio_player.dart +++ b/packages/genui/lib/src/catalog/core_widgets/audio_player.dart @@ -9,6 +9,12 @@ import '../../model/a2ui_schemas.dart'; import '../../model/catalog_item.dart'; final _schema = S.object( + description: ''' +A catalog item for an audio player. + +This widget displays a placeholder for an audio player, used to represent +a component capable of playing audio from a given URL. +''', properties: { 'url': A2uiSchemas.stringReference( description: 'The URL of the audio to play.', diff --git a/packages/genui/lib/src/catalog/core_widgets/button.dart b/packages/genui/lib/src/catalog/core_widgets/button.dart index 6de2f2857..11fd48f6e 100644 --- a/packages/genui/lib/src/catalog/core_widgets/button.dart +++ b/packages/genui/lib/src/catalog/core_widgets/button.dart @@ -15,6 +15,13 @@ import '../../primitives/logging.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design elevated button. + +This widget displays an interactive button. When pressed, it dispatches +the specified `action` event. The button's appearance can be styled as +a primary action. +''', properties: { 'child': A2uiSchemas.componentReference( description: diff --git a/packages/genui/lib/src/catalog/core_widgets/card.dart b/packages/genui/lib/src/catalog/core_widgets/card.dart index 9320d9b21..06f5bb3f9 100644 --- a/packages/genui/lib/src/catalog/core_widgets/card.dart +++ b/packages/genui/lib/src/catalog/core_widgets/card.dart @@ -10,6 +10,13 @@ import '../../model/catalog_item.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design card. + +This widget displays a card, which is a container for a single `child` +widget. Cards often have rounded corners and a shadow, and are used to group +related content. +''', properties: {'child': A2uiSchemas.componentReference()}, required: ['child'], ); diff --git a/packages/genui/lib/src/catalog/core_widgets/check_box.dart b/packages/genui/lib/src/catalog/core_widgets/check_box.dart index 17e896e90..92bf12923 100644 --- a/packages/genui/lib/src/catalog/core_widgets/check_box.dart +++ b/packages/genui/lib/src/catalog/core_widgets/check_box.dart @@ -12,6 +12,13 @@ import '../../model/data_model.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design checkbox with a label. + +This widget displays a checkbox a [Text] label. The checkbox's state +is bidirectionally bound to the data model path specified in the `value` +parameter. +''', properties: { 'label': A2uiSchemas.stringReference(), 'value': A2uiSchemas.booleanReference(), diff --git a/packages/genui/lib/src/catalog/core_widgets/column.dart b/packages/genui/lib/src/catalog/core_widgets/column.dart index 47922a387..d8e8ea883 100644 --- a/packages/genui/lib/src/catalog/core_widgets/column.dart +++ b/packages/genui/lib/src/catalog/core_widgets/column.dart @@ -13,6 +13,13 @@ import '../../primitives/simple_items.dart'; import 'widget_helpers.dart'; final _schema = S.object( + description: ''' +A catalog item representing a layout widget that displays its children in a +vertical array. + +This widget is analogous to Flutter's [Column] widget. It arranges a list of +child components from top to bottom. +''', properties: { 'distribution': S.string( description: 'How children are aligned on the main axis. ', diff --git a/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart b/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart index 56ab1f4f3..6eb6ced24 100644 --- a/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart +++ b/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart @@ -12,6 +12,13 @@ import '../../model/data_model.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design date and/or time input field. + +This widget displays a field that, when tapped, opens the native date and/or +time pickers. The selected value is stored as a string in the data model +path specified by the `value` parameter. +''', properties: { 'value': A2uiSchemas.stringReference( description: 'The selected date and/or time.', diff --git a/packages/genui/lib/src/catalog/core_widgets/divider.dart b/packages/genui/lib/src/catalog/core_widgets/divider.dart index 02e69426d..99154288c 100644 --- a/packages/genui/lib/src/catalog/core_widgets/divider.dart +++ b/packages/genui/lib/src/catalog/core_widgets/divider.dart @@ -9,6 +9,12 @@ import '../../model/catalog_item.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design divider. + +This widget displays a thin line to separate content, either horizontally +or vertically. +''', properties: { 'axis': S.string(enumValues: ['horizontal', 'vertical']), }, diff --git a/packages/genui/lib/src/catalog/core_widgets/icon.dart b/packages/genui/lib/src/catalog/core_widgets/icon.dart index 3d882ddaf..315681f8b 100644 --- a/packages/genui/lib/src/catalog/core_widgets/icon.dart +++ b/packages/genui/lib/src/catalog/core_widgets/icon.dart @@ -11,6 +11,9 @@ import '../../model/data_model.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item for an icon. +''', properties: { 'name': A2uiSchemas.stringReference( description: diff --git a/packages/genui/lib/src/catalog/core_widgets/image.dart b/packages/genui/lib/src/catalog/core_widgets/image.dart index 079814bbd..5663cfc71 100644 --- a/packages/genui/lib/src/catalog/core_widgets/image.dart +++ b/packages/genui/lib/src/catalog/core_widgets/image.dart @@ -41,7 +41,15 @@ Schema _schema({required bool enableUsageHint}) { ], ); } - return S.object(properties: properties); + return S.object( + description: ''' +A catalog item representing a widget that displays an image. + +The image source is specified by the `url` parameter, which can be a network +URL (e.g., `https://...`) or a local asset path (e.g., `assets/...`). +''', + properties: properties, + ); } extension type _ImageData.fromMap(JsonMap _json) { diff --git a/packages/genui/lib/src/catalog/core_widgets/list.dart b/packages/genui/lib/src/catalog/core_widgets/list.dart index 42e9c08e8..f1a2ec0d6 100644 --- a/packages/genui/lib/src/catalog/core_widgets/list.dart +++ b/packages/genui/lib/src/catalog/core_widgets/list.dart @@ -12,6 +12,12 @@ import '../../primitives/simple_items.dart'; import 'widget_helpers.dart'; final _schema = S.object( + description: ''' +A catalog item representing a scrollable list of widgets. + +This widget is analogous to Flutter's [ListView] widget. It can display +children in either a vertical or horizontal direction. +''', properties: { 'children': A2uiSchemas.componentArrayReference(), 'direction': S.string(enumValues: ['vertical', 'horizontal']), diff --git a/packages/genui/lib/src/catalog/core_widgets/modal.dart b/packages/genui/lib/src/catalog/core_widgets/modal.dart index a0023a75c..8be151bac 100644 --- a/packages/genui/lib/src/catalog/core_widgets/modal.dart +++ b/packages/genui/lib/src/catalog/core_widgets/modal.dart @@ -12,6 +12,14 @@ import '../../model/catalog_item.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a modal bottom sheet. + +This component doesn't render the modal content directly. Instead, it +renders the `entryPointChild` widget. The `entryPointChild` is expected to +trigger an action (e.g., on button press) that causes the `contentChild` to +be displayed within a modal bottom sheet by the [GenUiSurface]. +''', properties: { 'entryPointChild': A2uiSchemas.componentReference( description: 'The widget that opens the modal.', diff --git a/packages/genui/lib/src/catalog/core_widgets/multiple_choice.dart b/packages/genui/lib/src/catalog/core_widgets/multiple_choice.dart index 1e88f7053..f975d4b25 100644 --- a/packages/genui/lib/src/catalog/core_widgets/multiple_choice.dart +++ b/packages/genui/lib/src/catalog/core_widgets/multiple_choice.dart @@ -12,6 +12,13 @@ import '../../model/data_model.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a multiple choice selection widget. + +This widget displays a list of options, each with a checkbox. The +`selections` parameter, which should be a data model path, is updated to +reflect the list of *values* of the currently selected options. +''', properties: { 'selections': A2uiSchemas.stringArrayReference(), 'options': S.list( diff --git a/packages/genui/lib/src/catalog/core_widgets/row.dart b/packages/genui/lib/src/catalog/core_widgets/row.dart index b9beb9b30..3113a4ce2 100644 --- a/packages/genui/lib/src/catalog/core_widgets/row.dart +++ b/packages/genui/lib/src/catalog/core_widgets/row.dart @@ -12,6 +12,13 @@ import '../../primitives/simple_items.dart'; import 'widget_helpers.dart'; final _schema = S.object( + description: ''' +A catalog item representing a layout widget that displays its children in a +horizontal array. + +This widget is analogous to Flutter's [Row] widget. It arranges a list of +child components from left to right. +''', properties: { 'children': A2uiSchemas.componentArrayReference( description: diff --git a/packages/genui/lib/src/catalog/core_widgets/slider.dart b/packages/genui/lib/src/catalog/core_widgets/slider.dart index c4a1f5c2a..3497a2ced 100644 --- a/packages/genui/lib/src/catalog/core_widgets/slider.dart +++ b/packages/genui/lib/src/catalog/core_widgets/slider.dart @@ -12,6 +12,13 @@ import '../../model/data_model.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design slider. + +This widget allows the user to select a value from a range by sliding a +thumb along a track. The `value` is bidirectionally bound to the data model. +This is analogous to Flutter's [Slider] widget. +''', properties: { 'value': A2uiSchemas.numberReference(), 'minValue': S.number(), diff --git a/packages/genui/lib/src/catalog/core_widgets/tabs.dart b/packages/genui/lib/src/catalog/core_widgets/tabs.dart index 57294d40d..0bf0a47be 100644 --- a/packages/genui/lib/src/catalog/core_widgets/tabs.dart +++ b/packages/genui/lib/src/catalog/core_widgets/tabs.dart @@ -11,6 +11,13 @@ import '../../model/catalog_item.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design tab layout. + +This widget displays a [TabBar] and a [TabBarView] to allow navigation +between different child components. Each tab in `tabItems` has a title and +a corresponding child component ID to display when selected. +''', properties: { 'tabItems': S.list( items: S.object( diff --git a/packages/genui/lib/src/catalog/core_widgets/text.dart b/packages/genui/lib/src/catalog/core_widgets/text.dart index 6709fa02b..94c1b45c9 100644 --- a/packages/genui/lib/src/catalog/core_widgets/text.dart +++ b/packages/genui/lib/src/catalog/core_widgets/text.dart @@ -33,6 +33,13 @@ extension type _TextData.fromMap(JsonMap _json) { final text = CatalogItem( name: 'Text', dataSchema: S.object( + description: ''' +A catalog item representing a block of styled text. + +This widget displays a string of text, analogous to Flutter's [Text] widget. +The content is taken from the `text` parameter, which can be a literal +string or a data model binding. +''', properties: { 'text': A2uiSchemas.stringReference( description: diff --git a/packages/genui/lib/src/catalog/core_widgets/text_field.dart b/packages/genui/lib/src/catalog/core_widgets/text_field.dart index f92bd2b39..23542f4b5 100644 --- a/packages/genui/lib/src/catalog/core_widgets/text_field.dart +++ b/packages/genui/lib/src/catalog/core_widgets/text_field.dart @@ -13,6 +13,13 @@ import '../../model/ui_models.dart'; import '../../primitives/simple_items.dart'; final _schema = S.object( + description: ''' +A catalog item representing a Material Design text field. + +This widget allows the user to enter and edit text. The `text` parameter +bidirectionally binds the field's content to the data model. This is +analogous to Flutter's [TextField] widget. +''', properties: { 'text': A2uiSchemas.stringReference( description: 'The initial value of the text field.', diff --git a/packages/genui/lib/src/catalog/core_widgets/video.dart b/packages/genui/lib/src/catalog/core_widgets/video.dart index b75a4c5c8..f1f367c98 100644 --- a/packages/genui/lib/src/catalog/core_widgets/video.dart +++ b/packages/genui/lib/src/catalog/core_widgets/video.dart @@ -9,6 +9,12 @@ import '../../model/a2ui_schemas.dart'; import '../../model/catalog_item.dart'; final _schema = S.object( + description: ''' +A catalog item representing a video player. + +This widget currently displays a placeholder for a video player. It is +intended to play video content from the given `url`. +''', properties: { 'url': A2uiSchemas.stringReference( description: 'The URL of the video to play.', From 34238ba1994bcfacd5716459c00dbe11d3cd12fd Mon Sep 17 00:00:00 2001 From: Victor Eronmosele Date: Thu, 20 Nov 2025 13:35:42 +0100 Subject: [PATCH 2/2] Remove implementation detail from catalog core widget schema descriptions --- packages/genui/lib/src/catalog/core_widgets/button.dart | 2 +- packages/genui/lib/src/catalog/core_widgets/card.dart | 6 +----- packages/genui/lib/src/catalog/core_widgets/check_box.dart | 2 +- packages/genui/lib/src/catalog/core_widgets/column.dart | 3 --- .../genui/lib/src/catalog/core_widgets/date_time_input.dart | 2 +- packages/genui/lib/src/catalog/core_widgets/divider.dart | 5 +---- packages/genui/lib/src/catalog/core_widgets/list.dart | 3 --- packages/genui/lib/src/catalog/core_widgets/row.dart | 3 --- packages/genui/lib/src/catalog/core_widgets/slider.dart | 3 +-- packages/genui/lib/src/catalog/core_widgets/tabs.dart | 2 +- packages/genui/lib/src/catalog/core_widgets/text.dart | 4 ++-- packages/genui/lib/src/catalog/core_widgets/text_field.dart | 5 ++--- 12 files changed, 11 insertions(+), 29 deletions(-) diff --git a/packages/genui/lib/src/catalog/core_widgets/button.dart b/packages/genui/lib/src/catalog/core_widgets/button.dart index 11fd48f6e..2ae13e5b4 100644 --- a/packages/genui/lib/src/catalog/core_widgets/button.dart +++ b/packages/genui/lib/src/catalog/core_widgets/button.dart @@ -16,7 +16,7 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design elevated button. +A catalog item representing an elevated button. This widget displays an interactive button. When pressed, it dispatches the specified `action` event. The button's appearance can be styled as diff --git a/packages/genui/lib/src/catalog/core_widgets/card.dart b/packages/genui/lib/src/catalog/core_widgets/card.dart index 06f5bb3f9..cc274687b 100644 --- a/packages/genui/lib/src/catalog/core_widgets/card.dart +++ b/packages/genui/lib/src/catalog/core_widgets/card.dart @@ -11,11 +11,7 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design card. - -This widget displays a card, which is a container for a single `child` -widget. Cards often have rounded corners and a shadow, and are used to group -related content. +A catalog item representing a card. ''', properties: {'child': A2uiSchemas.componentReference()}, required: ['child'], diff --git a/packages/genui/lib/src/catalog/core_widgets/check_box.dart b/packages/genui/lib/src/catalog/core_widgets/check_box.dart index 92bf12923..3525f58c2 100644 --- a/packages/genui/lib/src/catalog/core_widgets/check_box.dart +++ b/packages/genui/lib/src/catalog/core_widgets/check_box.dart @@ -13,7 +13,7 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design checkbox with a label. +A catalog item representing a checkbox with a label. This widget displays a checkbox a [Text] label. The checkbox's state is bidirectionally bound to the data model path specified in the `value` diff --git a/packages/genui/lib/src/catalog/core_widgets/column.dart b/packages/genui/lib/src/catalog/core_widgets/column.dart index d8e8ea883..bf8c5a116 100644 --- a/packages/genui/lib/src/catalog/core_widgets/column.dart +++ b/packages/genui/lib/src/catalog/core_widgets/column.dart @@ -16,9 +16,6 @@ final _schema = S.object( description: ''' A catalog item representing a layout widget that displays its children in a vertical array. - -This widget is analogous to Flutter's [Column] widget. It arranges a list of -child components from top to bottom. ''', properties: { 'distribution': S.string( diff --git a/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart b/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart index 6eb6ced24..cc470a954 100644 --- a/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart +++ b/packages/genui/lib/src/catalog/core_widgets/date_time_input.dart @@ -13,7 +13,7 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design date and/or time input field. +A catalog item representing a date and/or time input field. This widget displays a field that, when tapped, opens the native date and/or time pickers. The selected value is stored as a string in the data model diff --git a/packages/genui/lib/src/catalog/core_widgets/divider.dart b/packages/genui/lib/src/catalog/core_widgets/divider.dart index 99154288c..2bb034179 100644 --- a/packages/genui/lib/src/catalog/core_widgets/divider.dart +++ b/packages/genui/lib/src/catalog/core_widgets/divider.dart @@ -10,10 +10,7 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design divider. - -This widget displays a thin line to separate content, either horizontally -or vertically. +A catalog item representing a divider. ''', properties: { 'axis': S.string(enumValues: ['horizontal', 'vertical']), diff --git a/packages/genui/lib/src/catalog/core_widgets/list.dart b/packages/genui/lib/src/catalog/core_widgets/list.dart index f1a2ec0d6..cb219ad3a 100644 --- a/packages/genui/lib/src/catalog/core_widgets/list.dart +++ b/packages/genui/lib/src/catalog/core_widgets/list.dart @@ -14,9 +14,6 @@ import 'widget_helpers.dart'; final _schema = S.object( description: ''' A catalog item representing a scrollable list of widgets. - -This widget is analogous to Flutter's [ListView] widget. It can display -children in either a vertical or horizontal direction. ''', properties: { 'children': A2uiSchemas.componentArrayReference(), diff --git a/packages/genui/lib/src/catalog/core_widgets/row.dart b/packages/genui/lib/src/catalog/core_widgets/row.dart index 3113a4ce2..48e72eea2 100644 --- a/packages/genui/lib/src/catalog/core_widgets/row.dart +++ b/packages/genui/lib/src/catalog/core_widgets/row.dart @@ -15,9 +15,6 @@ final _schema = S.object( description: ''' A catalog item representing a layout widget that displays its children in a horizontal array. - -This widget is analogous to Flutter's [Row] widget. It arranges a list of -child components from left to right. ''', properties: { 'children': A2uiSchemas.componentArrayReference( diff --git a/packages/genui/lib/src/catalog/core_widgets/slider.dart b/packages/genui/lib/src/catalog/core_widgets/slider.dart index 3497a2ced..06516df1d 100644 --- a/packages/genui/lib/src/catalog/core_widgets/slider.dart +++ b/packages/genui/lib/src/catalog/core_widgets/slider.dart @@ -13,11 +13,10 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design slider. +A catalog item representing a slider. This widget allows the user to select a value from a range by sliding a thumb along a track. The `value` is bidirectionally bound to the data model. -This is analogous to Flutter's [Slider] widget. ''', properties: { 'value': A2uiSchemas.numberReference(), diff --git a/packages/genui/lib/src/catalog/core_widgets/tabs.dart b/packages/genui/lib/src/catalog/core_widgets/tabs.dart index 0bf0a47be..05d21fd7d 100644 --- a/packages/genui/lib/src/catalog/core_widgets/tabs.dart +++ b/packages/genui/lib/src/catalog/core_widgets/tabs.dart @@ -12,7 +12,7 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design tab layout. +A catalog item representing a tab layout. This widget displays a [TabBar] and a [TabBarView] to allow navigation between different child components. Each tab in `tabItems` has a title and diff --git a/packages/genui/lib/src/catalog/core_widgets/text.dart b/packages/genui/lib/src/catalog/core_widgets/text.dart index 94c1b45c9..521b1e027 100644 --- a/packages/genui/lib/src/catalog/core_widgets/text.dart +++ b/packages/genui/lib/src/catalog/core_widgets/text.dart @@ -36,8 +36,8 @@ final text = CatalogItem( description: ''' A catalog item representing a block of styled text. -This widget displays a string of text, analogous to Flutter's [Text] widget. -The content is taken from the `text` parameter, which can be a literal +This widget displays a string of text. The content is taken from the `text` +parameter, which can be a literal string or a data model binding. ''', properties: { diff --git a/packages/genui/lib/src/catalog/core_widgets/text_field.dart b/packages/genui/lib/src/catalog/core_widgets/text_field.dart index 23542f4b5..81fb1da12 100644 --- a/packages/genui/lib/src/catalog/core_widgets/text_field.dart +++ b/packages/genui/lib/src/catalog/core_widgets/text_field.dart @@ -14,11 +14,10 @@ import '../../primitives/simple_items.dart'; final _schema = S.object( description: ''' -A catalog item representing a Material Design text field. +A catalog item representing a text field. This widget allows the user to enter and edit text. The `text` parameter -bidirectionally binds the field's content to the data model. This is -analogous to Flutter's [TextField] widget. +bidirectionally binds the field's content to the data model. ''', properties: { 'text': A2uiSchemas.stringReference(