Skip to content

Fix and stabilize TextField. - #1022

Merged
polina-c merged 11 commits into
flutter:mainfrom
polina-c:improve-text-field
Aug 12, 2026
Merged

Fix and stabilize TextField.#1022
polina-c merged 11 commits into
flutter:mainfrom
polina-c:improve-text-field

Conversation

@polina-c

@polina-c polina-c commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Contributes to a2ui-project/a2ui#1893

  1. Update examples to be more helpful in explaining how to use the component TextField.
  2. Fix password example to be indeed obscured.
  3. Move string constants to constants to avoid error above in future
  4. Fix component implementation by type:
  • obscured should be obscured
  • longText should support multiple lines
  • number should support only numbers
  1. Linked the package in CHANGELOGs to simplify maintanance.
  2. Implemented validationRegexp.
Screenshot 2026-08-11 at 7 45 14 PM

@polina-c polina-c changed the title Provide moe descriptive examples to the model. Provide more descriptive examples to the model. Aug 12, 2026
gemini-code-assist[bot]

This comment was marked as outdated.

@polina-c polina-c changed the title Provide more descriptive examples to the model. Provide more descriptive examples to the model and update component to actually implement what is expected. Aug 12, 2026
@polina-c polina-c changed the title Provide more descriptive examples to the model and update component to actually implement what is expected. Fix and stabilize TextField. Aug 12, 2026
@polina-c

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the TextField component to support different variants (shortText, longText, number, and obscured), adds input formatting for numeric inputs, and introduces comprehensive widget tests. Feedback on the changes highlights a syntax error in the test file map literal (?variant), invalid leading dot shorthand syntax for TextInputType members, and an unused validationRegexp property that is defined but not integrated into the validation logic.

Comment thread packages/genui/test/catalog/core_widgets/text_field_test.dart
_Json.label: A2uiSchemas.stringReference(),
_Json.variant: S.string(
description:
'''The kind of input the field accepts. ${_Variant.shortText} (the default) is a single line of text, ${_Variant.longText} is multi-line text, ${_Variant.number} only accepts numeric input, and ${_Variant.obscured} hides the typed characters, e.g. for passwords.''',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should standardize these descriptions to exactly match central catalog.json document e.g. https://github.com/a2ui-project/a2ui/blob/main/specification/v0_9/catalogs/basic/catalog.json

That way, rather than iterating on the descriptions separately in every codebase, we can iterate on them in one central place, have central evals that show that they work well, and then just copy them everywhere.

So would it work to just copy the description from the central catalog doc e.g. "The type of input field to display."? And if that causes inference performance issues, then send a PR to the JSON file for the basic catalog for 1.0 to improve the description.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this.
But I suggest it to be separate effort.
I do not want to spend more time here now.
I just wanted to try to fix a2ui-project/a2ui#1893, plus fixed what I saw was not working.

Would you mind to file separate issue for description standartization?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really, we should be using some tooling to build these schema from the A2UI schema files themselves. They should be identical, not just copied over: copied ones will always be stale.

Comment thread packages/genui/lib/src/catalog/basic_catalog_widgets/text_field.dart Outdated
@polina-c
polina-c merged commit 811ad8f into flutter:main Aug 12, 2026
42 checks passed
@polina-c
polina-c deleted the improve-text-field branch August 12, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants