Merge 2b.4: chat details and file details as dialogs on desktop

This commit is contained in:
2026-11-10 22:54:32 +00:00
6 changed files with 107 additions and 116 deletions
@@ -56,6 +56,7 @@ import 'chat_sent_entrance.dart';
import 'chat_server_queue.dart';
import 'chat_thread_controller.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/app_popups.dart';
import '../../../ui/adaptive/segmented_bar_overlay.dart';
import '../../../ui/layout/app_sheet_header.dart';
import '../../../ui/layout/wheel_scroll_forwarding.dart';
@@ -511,21 +512,19 @@ class _ChatThreadViewState extends State<ChatThreadView> {
/// Reports the harness's recorded usage. The standard sheet is dismissed the
/// platform's way (drag/barrier/Back, or a popup tap) and closes explicitly.
Future<void> _openInfo() async {
final cupertino =
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
final exporter = ChatExportController(
repository: ChatRepository(widget.gateway),
sessionId: widget.sessionId,
bridge: widget.fileBridge,
);
try {
await _showInfo(cupertino, exporter);
await _showInfo(exporter);
} finally {
exporter.dispose();
}
}
Future<void> _showInfo(bool cupertino, ChatExportController exporter) async {
Future<void> _showInfo(ChatExportController exporter) async {
final handoff = ChatSessionHandoff.from(widget.sessionId, widget.session);
Widget sheet() => _ChatInfoSheet(
controller: _controller,
@@ -534,23 +533,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
color: chatSessionColor(widget.session),
onColorSelected: widget.onColorSelected,
);
if (cupertino) {
await showCupertinoModalPopup<void>(
context: context,
builder: (sheetContext) => Align(
alignment: Alignment.bottomCenter,
child: SafeArea(child: CupertinoPopupSurface(child: sheet())),
),
);
return;
}
await showModalBottomSheet<void>(
context: context,
showDragHandle: true,
isScrollControlled: true,
useSafeArea: true,
builder: (sheetContext) => sheet(),
);
await showAppDetails<void>(context, builder: (_) => sheet());
}
/// The transcript in recorded order; a sent turn is part of it from the
+8 -40
View File
@@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/app_popups.dart';
import '../../artifacts/actions/artifact_transfer.dart';
import '../../artifacts/domain/artifact_kind.dart';
import '../../artifacts/ui/artifact_external_open.dart';
@@ -18,7 +17,6 @@ void showFileDetails(
required Future<ArtifactTransferResult> Function()? download,
required ArtifactExternalOpen openExternal,
}) {
final cupertino = usesCupertinoHost(context);
Widget content(BuildContext sheet) {
Future<void> open() async {
var opened = false;
@@ -37,12 +35,7 @@ void showFileDetails(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
entry.name,
style: cupertino
? CupertinoTheme.of(sheet).textTheme.navTitleTextStyle
: Theme.of(sheet).textTheme.titleLarge,
),
Text(entry.name, style: Theme.of(sheet).textTheme.titleLarge),
const SizedBox(height: 12),
Text(
'${artifactKindLabel(artifactKind(fileContentType(entry.name), entry.name))} · ${fileSizeLabel(entry.size)}',
@@ -57,42 +50,17 @@ void showFileDetails(
const SizedBox(height: 16),
if (download != null) FileDownloadButton(download: download),
if (urls != null)
cupertino
? CupertinoButton(
onPressed: open,
child: const Text('Open externally'),
)
: TextButton.icon(
onPressed: open,
icon: const Icon(Icons.open_in_new),
label: const Text('Open externally'),
),
if (cupertino)
CupertinoButton(
onPressed: () => Navigator.pop(sheet),
child: const Text('Close'),
TextButton.icon(
onPressed: open,
icon: const Icon(Icons.open_in_new),
label: const Text('Open externally'),
),
],
),
),
);
return cupertino
? CupertinoPopupSurface(
child: DefaultTextStyle(
style: CupertinoTheme.of(sheet).textTheme.textStyle,
child: body,
),
)
: body;
return body;
}
if (cupertino) {
showCupertinoModalPopup<void>(context: context, builder: content);
} else {
showModalBottomSheet<void>(
context: context,
showDragHandle: true,
builder: content,
);
}
showAppDetails<void>(context, builder: content);
}