diff --git a/app/lib/features/chat/conversation/chat_composer_bar.dart b/app/lib/features/chat/conversation/chat_composer_bar.dart index 02096aea..7653ae22 100644 --- a/app/lib/features/chat/conversation/chat_composer_bar.dart +++ b/app/lib/features/chat/conversation/chat_composer_bar.dart @@ -20,6 +20,7 @@ import '../ui/sessions/chat_adaptive.dart'; import 'chat_command_actions.dart'; import 'chat_command_palette.dart'; import 'chat_composer_controller.dart'; +import '../ui/transcript/chat_attachment_frame.dart'; /// The composer's placeholder when the chat names no working directory. const String chatComposerPlaceholder = 'Message the agent'; @@ -801,8 +802,8 @@ class _ChatComposerBarState extends State { clipBehavior: Clip.none, children: [ Positioned.fill( - child: ClipRRect( - borderRadius: BorderRadius.circular(10), + child: ChatAttachmentFrame( + radius: BorderRadius.circular(10), child: Image.memory( bytes, key: ValueKey('chat-composer-thumbnail-$index'), diff --git a/app/lib/features/chat/ui/transcript/chat_attachment_frame.dart b/app/lib/features/chat/ui/transcript/chat_attachment_frame.dart new file mode 100644 index 00000000..e5db5fa5 --- /dev/null +++ b/app/lib/features/chat/ui/transcript/chat_attachment_frame.dart @@ -0,0 +1,36 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../sessions/chat_adaptive.dart'; + +/// Rounds an attachment thumbnail and draws a subtle hairline around it, so a +/// dark screenshot on a dark page (or a light one on a light page) still reads +/// as a separate object. The line sits over the image's edge, in the host's +/// own outline role. +class ChatAttachmentFrame extends StatelessWidget { + const ChatAttachmentFrame({ + super.key, + required this.radius, + required this.child, + }); + + final BorderRadius radius; + final Widget child; + + @override + Widget build(BuildContext context) { + final cupertino = + chatControlsStyleOf(context) == ChatControlsStyle.cupertino; + final line = cupertino + ? CupertinoColors.separator.resolveFrom(context) + : Theme.of(context).colorScheme.outlineVariant; + return Container( + key: const Key('chat-attachment-frame'), + foregroundDecoration: BoxDecoration( + borderRadius: radius, + border: Border.all(color: line.withValues(alpha: 0.8)), + ), + child: ClipRRect(borderRadius: radius, child: child), + ); + } +} diff --git a/app/lib/features/chat/ui/transcript/chat_attachment_thumbnail.dart b/app/lib/features/chat/ui/transcript/chat_attachment_thumbnail.dart index 02296999..7e4c91ca 100644 --- a/app/lib/features/chat/ui/transcript/chat_attachment_thumbnail.dart +++ b/app/lib/features/chat/ui/transcript/chat_attachment_thumbnail.dart @@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../data/chat_attachment_images.dart'; +import 'chat_attachment_frame.dart'; import 'chat_image_viewer.dart'; /// The largest edge a sent image's thumbnail takes in the transcript. @@ -105,8 +106,8 @@ class _ChatAttachmentThumbnailState extends State { Widget _thumbnail(BuildContext context, Uint8List bytes) { final ratio = MediaQuery.devicePixelRatioOf(context); - final image = ClipRRect( - borderRadius: _radius, + final image = ChatAttachmentFrame( + radius: _radius, child: Image( key: const Key('chat-attachment-thumbnail-image'), // Decode at the thumbnail's size, not the photo's, while scrolling. diff --git a/app/test/features/chat/ui/transcript/chat_attachment_thumbnail_test.dart b/app/test/features/chat/ui/transcript/chat_attachment_thumbnail_test.dart index 0458f4a2..2a34d777 100644 --- a/app/test/features/chat/ui/transcript/chat_attachment_thumbnail_test.dart +++ b/app/test/features/chat/ui/transcript/chat_attachment_thumbnail_test.dart @@ -90,6 +90,11 @@ void main() { find.byKey(const Key('chat-attachment-thumbnail-image')), findsOneWidget, ); + // A hairline frames the image so it reads against the page. + final frame = tester.widget( + find.byKey(const Key('chat-attachment-frame')), + ); + expect((frame.foregroundDecoration as BoxDecoration).border, isNotNull); // No paperclip row and no base64 shown as a file name. expect(find.byIcon(Icons.attach_file), findsNothing); expect(find.byIcon(CupertinoIcons.paperclip), findsNothing); diff --git a/app/tool/chat_activity_dots_probe.dart b/app/tool/chat_activity_dots_probe.dart new file mode 100644 index 00000000..02b44b25 --- /dev/null +++ b/app/tool/chat_activity_dots_probe.dart @@ -0,0 +1,36 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'package:pipelines_app/features/chat/ui/transcript/chat_turn_activity_view.dart'; + +const _style = String.fromEnvironment('PROBE_STYLE', defaultValue: 'material'); + +/// Visual check for the streaming activity line: the pending dots beside +/// "Responding Ns" at a few text sizes, in light and dark. +void main() { + Widget line(double scale) => MediaQuery.withClampedTextScaling( + minScaleFactor: scale, + maxScaleFactor: scale, + child: const Padding( + padding: EdgeInsets.all(8), + child: ChatTurnActivityView( + parts: [ + {'type': 'text', 'text': 'Partial answer'}, + ], + streaming: true, + ), + ), + ); + final body = ListView(children: [line(1), line(1.5), line(2)]); + runApp( + _style == 'cupertino' + ? CupertinoApp( + theme: const CupertinoThemeData(brightness: Brightness.dark), + home: CupertinoPageScaffold(child: SafeArea(child: body)), + ) + : MaterialApp( + theme: ThemeData(brightness: Brightness.dark), + home: Scaffold(body: SafeArea(child: body)), + ), + ); +}