feat(chat): frame attachment thumbnails with a subtle hairline

Sent images and composer thumbnails share ChatAttachmentFrame: rounded
corners plus a faint outline in the host's outline role, so a dark
screenshot no longer melts into a dark page. Adds a web probe that
renders the streaming activity line at several text sizes.
This commit is contained in:
2026-10-31 00:21:22 +00:00
parent ef07c95b0c
commit b00dff864c
5 changed files with 83 additions and 4 deletions
@@ -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),
);
}
}
@@ -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<ChatAttachmentThumbnail> {
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.