Chat: answered questions collapse into their turn like tool calls

This commit is contained in:
2026-11-03 19:31:40 +00:00
parent fa6c0864db
commit fc94210595
14 changed files with 760 additions and 38 deletions
@@ -14,6 +14,7 @@ class ChatTurnChip extends StatelessWidget {
required this.color,
required this.semanticsLabel,
required this.sheet,
this.ellipsizeLabel = false,
});
final Key chipKey;
@@ -23,6 +24,10 @@ class ChatTurnChip extends StatelessWidget {
final String semanticsLabel;
final Widget sheet;
/// Shrink a long label to one ellipsized line. Only for a chip whose parent
/// bounds its width (a turn footer's Wrap, an aligned row).
final bool ellipsizeLabel;
@override
Widget build(BuildContext context) {
final cupertino =
@@ -32,7 +37,10 @@ class ChatTurnChip extends StatelessWidget {
children: [
leading,
const SizedBox(width: 6),
Text(label, style: TextStyle(color: color, fontSize: 13)),
if (ellipsizeLabel)
Flexible(child: _label(maxLines: 1, overflow: TextOverflow.ellipsis))
else
_label(),
Icon(
cupertino ? CupertinoIcons.chevron_up : Icons.expand_less,
size: 14,
@@ -73,6 +81,13 @@ class ChatTurnChip extends StatelessWidget {
);
}
Text _label({int? maxLines, TextOverflow? overflow}) => Text(
label,
maxLines: maxLines,
overflow: overflow,
style: TextStyle(color: color, fontSize: 13),
);
Future<void> _open(BuildContext context, bool cupertino) {
if (cupertino) {
return showCupertinoModalPopup<void>(