fix(app): use shared header for chat information sheet
This commit is contained in:
@@ -30,6 +30,7 @@ import 'chat_scroll.dart';
|
||||
import 'chat_thread_controller.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/segmented_bar_overlay.dart';
|
||||
import '../../../ui/layout/app_sheet_header.dart';
|
||||
import 'chat_reading_width.dart';
|
||||
import 'chat_thread_header.dart';
|
||||
import 'chat_transcript_cache.dart';
|
||||
@@ -1272,39 +1273,15 @@ class _ChatInfoSheet extends StatelessWidget {
|
||||
return AnimatedBuilder(
|
||||
animation: controller,
|
||||
builder: (context, _) {
|
||||
final titleStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.navTitleTextStyle
|
||||
: Theme.of(context).textTheme.titleLarge;
|
||||
final content = Column(
|
||||
key: const Key('chat-info-sheet'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 8, 16, 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Semantics(
|
||||
header: true,
|
||||
child: Text('Chat information', style: titleStyle),
|
||||
),
|
||||
),
|
||||
if (cupertino)
|
||||
CupertinoButton(
|
||||
key: const Key('chat-info-close'),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Close'),
|
||||
)
|
||||
else
|
||||
TextButton(
|
||||
key: const Key('chat-info-close'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
),
|
||||
AppSheetHeader(
|
||||
title: 'Chat information',
|
||||
cupertino: cupertino,
|
||||
doneKey: const Key('chat-info-close'),
|
||||
),
|
||||
for (final metric in _chatInfoMetrics(controller.usage))
|
||||
_ChatInfoRow(metric: metric, cupertino: cupertino),
|
||||
|
||||
@@ -63,6 +63,7 @@ void main() {
|
||||
await _openInfo(tester);
|
||||
|
||||
expect(find.text('Chat information'), findsOneWidget);
|
||||
expect(find.text('Done'), findsOneWidget);
|
||||
expect(find.text('Output rate'), findsOneWidget);
|
||||
expect(find.text('24.6 tok/s'), findsOneWidget);
|
||||
expect(find.text('Total tokens'), findsOneWidget);
|
||||
@@ -134,7 +135,7 @@ void main() {
|
||||
expect(find.text('\$0.0000'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the native sheet dismisses from Close and the barrier', (
|
||||
testWidgets('the native sheet dismisses from Done and the barrier', (
|
||||
tester,
|
||||
) async {
|
||||
final gateway = await _thread(tester);
|
||||
@@ -168,6 +169,7 @@ void main() {
|
||||
|
||||
await _openInfo(tester);
|
||||
expect(find.text('Chat information'), findsOneWidget);
|
||||
expect(find.text('Done'), findsOneWidget);
|
||||
expect(find.text('42'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('chat-info-close')));
|
||||
|
||||
Reference in New Issue
Block a user