Skip to content

GenUI TextField crashes with “InputDecorator unbounded width” when generated using A2UI (Flutter GenUI v0.5.1) #559

@SheikMohideen007

Description

@SheikMohideen007

Use this system prompt (or any prompt that generates TextFields inside a Row/Column):

Your job is to build UI using ONLY the built-in CoreCatalogItems.

Always generate:

  1. A top search bar (TextField + Button)
  2. A search results list
  3. A chat message list
  4. A bottom input area (TextField + Button)

IMPORTANT:

  • Wrap every TextField in a width-bounded Box or Expanded.
  • Do NOT put TextField directly inside a Row or Column without constraints.
  • Do not specify surface IDs manually.
  • Always send BeginRendering after updates.

=====================================================================================
Actual Results :

Flutter throws the runtime error:
InputDecorator cannot have an unbounded width.
TextField must be inside a width-bounded parent.

The crash happens even when:

  1. Instructions explicitly force width constraints

  2. TextFields are wrapped in Containers, Boxes, or Expanded

  3. No manual surface IDs are used

  4. Using only default CoreCatalogItems

=====================================================================================
Expected Results :
GenUI should generate TextField layouts that obey Flutter’s width-bounded constraint:

  1. TextField inside Box(width: infinity)

  2. TextField inside Expanded

  3. TextField inside Container (width constraints)

  4. The UI should render without crashing.

=====================================================================================
Sample Code:

import 'package:flutter/material.dart';
import 'package:genui/genui.dart';
import 'package:genui_firebase_ai/genui_firebase_ai.dart';

class Home extends StatefulWidget {
@OverRide
State createState() => _HomeState();
}

class _HomeState extends State {
late GenUiConversation conversation;
final _surfaceIds = [];

@OverRide
void initState() {
super.initState();

final catalog = CoreCatalogItems.asCatalog();

final generator = FirebaseAiContentGenerator(
  catalog: catalog,
  systemInstruction: "<SYSTEM PROMPT FROM ABOVE>",
);

conversation = GenUiConversation(
  genUiManager: GenUiManager(catalog: catalog),
  contentGenerator: generator,
  onSurfaceAdded: (s) => setState(() => _surfaceIds.add(s.surfaceId)),
  onSurfaceDeleted: (s) => setState(() => _surfaceIds.remove(s.surfaceId)),
);

generator.a2uiMessageStream.listen((msg) {
  conversation.genUiManager.handleMessage(msg);
});

}

@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: _surfaceIds.map((id) {
return GenUiSurface(
host: conversation.host,
surfaceId: id,
);
}).toList(),
),
);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1A high-priority issue. Someone should be assigned and actively working on it.a: core_catalog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions