Merge branch 'main' into run/lists-polish-r1

This commit is contained in:
2026-10-31 00:55:36 +00:00
7 changed files with 26 additions and 32 deletions
@@ -8,8 +8,7 @@ import 'package:flutter/material.dart';
/// style. Keeping the styles here stops each card file from inventing its own /// style. Keeping the styles here stops each card file from inventing its own
/// size and colour; everything still comes from the active Material/Cupertino /// size and colour; everything still comes from the active Material/Cupertino
/// theme, so light, dark and text scaling follow the host. /// theme, so light, dark and text scaling follow the host.
TextStyle? chatCardTitleStyle(BuildContext context, bool cupertino) => TextStyle? chatCardTitleStyle(BuildContext context, bool cupertino) => cupertino
cupertino
? CupertinoTheme.of(context).textTheme.navTitleTextStyle ? CupertinoTheme.of(context).textTheme.navTitleTextStyle
: Theme.of(context).textTheme.titleMedium; : Theme.of(context).textTheme.titleMedium;
@@ -21,9 +20,9 @@ TextStyle? chatCardBodyStyle(BuildContext context, bool cupertino) => cupertino
/// (the same subordinate style the rest of the app uses for secondary copy) /// (the same subordinate style the rest of the app uses for secondary copy)
/// keeps labels from reading as extra headings; Material keeps `titleSmall`. /// keeps labels from reading as extra headings; Material keeps `titleSmall`.
TextStyle? chatCardLabelStyle(BuildContext context, bool cupertino) => cupertino TextStyle? chatCardLabelStyle(BuildContext context, bool cupertino) => cupertino
? CupertinoTheme.of( ? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
context, color: chatCardSecondaryColor(context, true),
).textTheme.tabLabelTextStyle.copyWith(color: chatCardSecondaryColor(context, true)) )
: Theme.of(context).textTheme.titleSmall; : Theme.of(context).textTheme.titleSmall;
/// Body text that supports a control, such as a field description. /// Body text that supports a control, such as a field description.
@@ -63,10 +63,7 @@ Widget _field({
children: [ children: [
Text(label, style: chatCardLabelStyle(context, cupertino)), Text(label, style: chatCardLabelStyle(context, cupertino)),
if (description.isNotEmpty && description != title) if (description.isNotEmpty && description != title)
Text( Text(description, style: chatCardSecondaryStyle(context, cupertino)),
description,
style: chatCardSecondaryStyle(context, cupertino),
),
if ('${field['type'] ?? ''}' == 'external') if ('${field['type'] ?? ''}' == 'external')
_external(context, field, cupertino) _external(context, field, cupertino)
else if ('${field['type'] ?? ''}' == 'boolean') else if ('${field['type'] ?? ''}' == 'boolean')
@@ -44,8 +44,7 @@ Object? chatFormFieldValue(JsonMap field, String raw) {
case 'integer': case 'integer':
final parsed = num.tryParse(raw); final parsed = num.tryParse(raw);
if (parsed == null) return double.nan; if (parsed == null) return double.nan;
final integral = final integral = parsed.isFinite && parsed == parsed.roundToDouble();
parsed.isFinite && parsed == parsed.roundToDouble();
return type == 'integer' && integral ? parsed.toInt() : parsed; return type == 'integer' && integral ? parsed.toInt() : parsed;
default: default:
return raw; return raw;
@@ -33,12 +33,7 @@ List<Widget> chatQuestionRecordedAnswers({
for (final entry in answers.entries) { for (final entry in answers.entries) {
if (shown.contains(entry.key)) continue; if (shown.contains(entry.key)) continue;
widgets.add( widgets.add(
_recorded( _recorded(context, entry.key, _answerText(null, entry.value), cupertino),
context,
entry.key,
_answerText(null, entry.value),
cupertino,
),
); );
} }
if (widgets.isEmpty) { if (widgets.isEmpty) {
@@ -65,7 +65,9 @@ int chatNewMessageCount(List<String> messageIds, String? newestAtRelease) {
/// native client adds while the operator is reading above the end. /// native client adds while the operator is reading above the end.
String chatJumpToLatestLabel(int newMessages) { String chatJumpToLatestLabel(int newMessages) {
if (newMessages <= 0) return 'Jump to latest'; if (newMessages <= 0) return 'Jump to latest';
final suffix = newMessages == 1 ? '1 new message' : '$newMessages new messages'; final suffix = newMessages == 1
? '1 new message'
: '$newMessages new messages';
return 'Jump to latest · $suffix'; return 'Jump to latest · $suffix';
} }
@@ -44,8 +44,7 @@ class ChatThreadCards {
String answerFor(String requestId) => _answers[requestId] ?? ''; String answerFor(String requestId) => _answers[requestId] ?? '';
String? permissionErrorFor(String requestId) => String? permissionErrorFor(String requestId) => _permissionErrors[requestId];
_permissionErrors[requestId];
String? formErrorFor(String formId) => _formErrors[formId]; String? formErrorFor(String formId) => _formErrors[formId];
@@ -105,8 +104,7 @@ class ChatThreadCards {
_forms[id] = { _forms[id] = {
...form, ...form,
'resolved': true, 'resolved': true,
if (answers.isNotEmpty) if (answers.isNotEmpty) 'answers': Map<String, dynamic>.from(answers),
'answers': Map<String, dynamic>.from(answers),
}; };
_pruneSettledForms(); _pruneSettledForms();
notify(); notify();
@@ -165,11 +165,13 @@ void main() {
await pumpApp(tester, provider: provider, client: client); await pumpApp(tester, provider: provider, client: client);
await waitForRequest(tester, channel, 'list_runs'); await waitForRequest(tester, channel, 'list_runs');
final initialRuns = pipelineRequest(channel, 'list_runs')!; final initialRuns = pipelineRequest(channel, 'list_runs')!;
channel.incoming.add(jsonEncode({ channel.incoming.add(
'id': initialRuns['id'], jsonEncode({
'type': 'runs', 'id': initialRuns['id'],
'runs': PipelineFixture().runs, 'type': 'runs',
})); 'runs': PipelineFixture().runs,
}),
);
await tester.pump(); await tester.pump();
final before = countType(channel, 'list_runs'); final before = countType(channel, 'list_runs');
showDialog<void>( showDialog<void>(
@@ -198,11 +200,13 @@ void main() {
await pumpApp(tester, provider: provider, client: client); await pumpApp(tester, provider: provider, client: client);
await waitForRequest(tester, channel, 'list_runs'); await waitForRequest(tester, channel, 'list_runs');
final initialRuns = pipelineRequest(channel, 'list_runs')!; final initialRuns = pipelineRequest(channel, 'list_runs')!;
channel.incoming.add(jsonEncode({ channel.incoming.add(
'id': initialRuns['id'], jsonEncode({
'type': 'runs', 'id': initialRuns['id'],
'runs': PipelineFixture().runs, 'type': 'runs',
})); 'runs': PipelineFixture().runs,
}),
);
await tester.pump(); await tester.pump();
final before = countType(channel, 'list_runs'); final before = countType(channel, 'list_runs');
showDialog<void>( showDialog<void>(