Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/genui_client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.svn/
.swiftpm/
migrate_working_dir/
firepit-log.txt

# IntelliJ related
*.iml
Expand Down
31 changes: 31 additions & 0 deletions pkgs/genui_client/GEMINI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CatalogItem

A CatalogItem is an object which represents a widget that can be instantiated by an LLM. It centralizes the builder function for the widget along with the data schema and name.

The codebase is in the process of migrating from an older structure where building logic for a widget was defined in lib/src/dynamic_ui.dart and the schema was defined in lib/src/ui_schema.dart and the deserialization logic was in lib/src/ui_models.dart. These lines may be commented out, but you can still read them. In the new structure, we instead want to have a file for each CatalogItem in lib/src/widgets/ that contains the builder logic, schema and deserialization logic together.

Also, in the old structure, the schema represented each widget with a single object type that had many optional properties - see lib/src/ui_schema.dart. In the new approach, we will have a separate object for each widget type, with only relevant properties, mostly required. See lib/src/schema_generator.dart.

## Structure of a CatalogItem

- CatalogItems should *not* depend on ui_models.dart. Instead, they should include a builder function that inlines all the map access logic.
- Only the variable that defines the CatalogItem should be public. Everything else should be private.
- The Schema must be defined as a Schema object. Look at lib/src/widgets/elevated_button.dart as a guide. Remember to use `Schema.object` and `Schema.enumString` etc. Specify `optionalProperties` rather than `required`.
- The Schema should *not* have a "props" member or an "id" member, as those will be injected at a higher level. The schema should just be an object that includes all the properties that are specific to this widget, e.g. content to display.
- The only imports should be 'package:firebase_ai/firebase_ai.dart', 'package:flutter/material.dart' and '../catalog_item.dart'. Any other utilities etc that are needed should be inlined into the file.
- The name of the CatalogItem should be in lower camel case.
- Widgets that require controllers or state in order to instantly reflect user inputs (e.g. Radio buttons, checkboxes, text fields) should be implemented as StatefulWidgets which maintain internal UI state. Look at libs/src/widgets/radio_group.dart as an example. There should be a private StatefulWidget class definition in the file.

## How to migrate an existing supported widget to a CatalogItem

To migrate an existing supported widget using the older structure to a new CatalogItem:

1. Look at the existing definition of the widget in lib/src/ui_schema.dart and lib/src/dynamic_ui.dart.

2. Understand the structure of a CatalogItem by looking at lib/src/catalog_item.dart for the type, and lib/src/widgets/elevated_button.dart as an example to follow.

3. Create a new file under lib/src/widgets which contains a declaration of a global variable with a CatalogItem. The item should use a schema that includes all the relevant fields from ui_schema.dart, and a builder function which correctly accesses the data according to the schema.

4. Add the new CatalogItem to lib/src/core_catalog.dart

Note: don't delete any of the code that the new CatalogItem is based on. We will delete it all later once all the widgets are migrated.
12 changes: 9 additions & 3 deletions pkgs/genui_client/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
},
"hosting": {
"source": ".",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"frameworksBackend": { "region": "us-central1" }
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "us-central1"
}
}
}
}
130 changes: 130 additions & 0 deletions pkgs/genui_client/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
PODS:
- AppCheckCore (11.2.0):
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4)
- Firebase/Auth (11.15.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 11.15.0)
- Firebase/CoreOnly (11.15.0):
- FirebaseCore (~> 11.15.0)
- firebase_app_check (0.3.2-10):
- Firebase/CoreOnly (~> 11.15.0)
- firebase_core
- FirebaseAppCheck (~> 11.15.0)
- Flutter
- firebase_auth (5.7.0):
- Firebase/Auth (= 11.15.0)
- firebase_core
- Flutter
- firebase_core (3.15.2):
- Firebase/CoreOnly (= 11.15.0)
- Flutter
- FirebaseAppCheck (11.15.0):
- AppCheckCore (~> 11.0)
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseCore (~> 11.15.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- FirebaseAppCheckInterop (11.15.0)
- FirebaseAuth (11.15.0):
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseAuthInterop (~> 11.0)
- FirebaseCore (~> 11.15.0)
- FirebaseCoreExtension (~> 11.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/Environment (~> 8.1)
- GTMSessionFetcher/Core (< 5.0, >= 3.4)
- RecaptchaInterop (~> 101.0)
- FirebaseAuthInterop (11.15.0)
- FirebaseCore (11.15.0):
- FirebaseCoreInternal (~> 11.15.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Logger (~> 8.1)
- FirebaseCoreExtension (11.15.0):
- FirebaseCore (~> 11.15.0)
- FirebaseCoreInternal (11.15.0):
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- Flutter (1.0.0)
- GoogleUtilities/AppDelegateSwizzler (8.1.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (8.1.0):
- GoogleUtilities/Privacy
- GoogleUtilities/Logger (8.1.0):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/Network (8.1.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (8.1.0)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (8.1.0)
- GoogleUtilities/Reachability (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GTMSessionFetcher/Core (4.5.0)
- PromisesObjC (2.4.0)
- RecaptchaInterop (101.0.0)

DEPENDENCIES:
- firebase_app_check (from `.symlinks/plugins/firebase_app_check/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- Flutter (from `Flutter`)

SPEC REPOS:
trunk:
- AppCheckCore
- Firebase
- FirebaseAppCheck
- FirebaseAppCheckInterop
- FirebaseAuth
- FirebaseAuthInterop
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
- GoogleUtilities
- GTMSessionFetcher
- PromisesObjC
- RecaptchaInterop

EXTERNAL SOURCES:
firebase_app_check:
:path: ".symlinks/plugins/firebase_app_check/ios"
firebase_auth:
:path: ".symlinks/plugins/firebase_auth/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
Flutter:
:path: Flutter

SPEC CHECKSUMS:
AppCheckCore: cc8fd0a3a230ddd401f326489c99990b013f0c4f
Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e
firebase_app_check: b0f1c33acf8b7c695f4ac16cdb763feac8f0f7f5
firebase_auth: 5342db41af2ba5ed32a6177d9e326eecbebda912
firebase_core: 99a37263b3c27536063a7b601d9e2a49400a433c
FirebaseAppCheck: 4574d7180be2a8b514f588099fc5262f032a92c7
FirebaseAppCheckInterop: 06fe5a3799278ae4667e6c432edd86b1030fa3df
FirebaseAuth: a6575e5fbf46b046c58dc211a28a5fbdd8d4c83b
FirebaseAuthInterop: 7087d7a4ee4bc4de019b2d0c240974ed5d89e2fd
FirebaseCore: efb3893e5b94f32b86e331e3bd6dadf18b66568e
FirebaseCoreExtension: edbd30474b5ccf04e5f001470bdf6ea616af2435
FirebaseCoreInternal: 9afa45b1159304c963da48addb78275ef701c6b4
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
GTMSessionFetcher: fc75fc972958dceedee61cb662ae1da7a83a91cf
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
RecaptchaInterop: 11e0b637842dfb48308d242afc3f448062325aba

PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e

COCOAPODS: 1.15.2
Loading