Merge main (Paper design) into the design perf budget
Paper's theme joins the cached builder; AppDesignTokens and ReadingType compare every new token by value, and Paper's tab indicator and switch outline resolver are kept per colour so a rebuilt Paper theme equals the last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import '../domain/chat_shells.dart';
|
||||
import '../domain/chat_task_metadata.dart';
|
||||
import 'chat_task_metadata_view.dart';
|
||||
import 'chat_task_presentation.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
/// One scan-friendly task card; only the explicit Details control loads output.
|
||||
class ChatBackgroundTaskCard extends StatelessWidget {
|
||||
@@ -32,7 +33,9 @@ class ChatBackgroundTaskCard extends StatelessWidget {
|
||||
final status = DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
@@ -128,7 +131,9 @@ class ChatBackgroundTaskCard extends StatelessWidget {
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLowest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import '../../../ui/text/monospace.dart';
|
||||
import '../domain/chat_shells.dart';
|
||||
import 'chat_task_presentation.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
const _outputVisibleLines = 12;
|
||||
const _outputLineHeight = 1.5;
|
||||
@@ -54,7 +55,9 @@ class ChatBackgroundTaskOutput extends StatelessWidget {
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerLowest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_pill.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
import '../ui/sessions/chat_color_palette.dart';
|
||||
|
||||
/// How strongly the chat's shade colours the bar's glass pieces over the
|
||||
@@ -75,7 +76,10 @@ ChatBarTint? chatBarTintOf(BuildContext context, String? name) {
|
||||
if (shade == null) return null;
|
||||
return ChatBarTint.from(
|
||||
shade: shade,
|
||||
raised: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
// A design with its own panel fill (Paper's page) tints that instead.
|
||||
raised:
|
||||
AppDesignTokens.of(context).panel ??
|
||||
Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
dark: chatColorDarkSurface(context),
|
||||
inactive: ChatPaneActivity.inactiveOf(context),
|
||||
solid: MediaQuery.maybeHighContrastOf(context) ?? false,
|
||||
|
||||
@@ -34,6 +34,7 @@ import 'composer_focus_request.dart';
|
||||
import 'composer_focus_restore.dart';
|
||||
import 'chat_bar_tint.dart';
|
||||
import 'composer_focus_ring.dart';
|
||||
import 'composer_underline.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
import 'composer_running_border.dart';
|
||||
import '../shell/chat_shell_command.dart';
|
||||
@@ -1003,7 +1004,9 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
|
||||
child: Align(
|
||||
heightFactor: 1,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: kChatReadingWidth),
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: chatReadingWidthOf(context),
|
||||
),
|
||||
child: Padding(
|
||||
key: const Key('chat-composer'),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
@@ -1108,7 +1111,16 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
|
||||
/// ([ComposerRunningBorder]); it is mounted only for that time.
|
||||
Widget _pill(BuildContext context, Widget child) {
|
||||
final accent = chatFocusRingColor(context, widget.chatColor);
|
||||
final shape = AppDesignTokens.of(context).shape(_pillShape);
|
||||
final tokens = AppDesignTokens.of(context);
|
||||
if (tokens.composer == ComposerStyle.underline) {
|
||||
return ComposerUnderline(
|
||||
focus: _focus,
|
||||
accent: accent,
|
||||
running: widget.running,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
final shape = tokens.shape(_pillShape);
|
||||
return Stack(
|
||||
children: [
|
||||
ComposerFocusRing(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import '../ui/transcript/native_disclosure.dart';
|
||||
import 'chat_card_styles.dart';
|
||||
import 'chat_permission_card_model.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
/// One recorded permission request as a native card.
|
||||
///
|
||||
@@ -61,7 +62,9 @@ class ChatPermissionCard extends StatelessWidget {
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: chatCardFillColor(context),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -104,7 +107,9 @@ class ChatPermissionCard extends StatelessWidget {
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: chatCardWarningFillColor(context),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
import '../ui/transcript/chat_message_bubble.dart';
|
||||
import '../ui/transcript/chat_turn_activity_view.dart';
|
||||
|
||||
/// The widest the conversation's reading column grows: transcript rows and
|
||||
/// the floating composer share it, centred, so a wide window keeps a
|
||||
/// comfortable line length instead of stretching messages edge to edge.
|
||||
const double kChatReadingWidth = 760;
|
||||
|
||||
/// The space on each side of the centred reading column in [width].
|
||||
double chatReadingInset(double width) =>
|
||||
math.max(0, (width - kChatReadingWidth) / 2);
|
||||
/// The reading column's width under the design at [context]:
|
||||
/// [kChatReadingWidth], or, for a design that sets a reading measure
|
||||
/// ([ReadingType.measure], Paper's ~70ch), that many reading characters plus
|
||||
/// the rows' own side padding (16 each side, then the answer's inset), so
|
||||
/// the text itself is that wide. It follows the operator's text scaling.
|
||||
double chatReadingWidthOf(BuildContext context) {
|
||||
final reading = AppDesignTokens.of(context).reading;
|
||||
final measure = reading.measure;
|
||||
if (measure == null) return kChatReadingWidth;
|
||||
final size = MediaQuery.textScalerOf(
|
||||
context,
|
||||
).scale(chatMessageTextStyle(context)?.fontSize ?? 16);
|
||||
return measure * size * reading.figureWidth +
|
||||
2 * (16 + chatAgentContentInset);
|
||||
}
|
||||
|
||||
/// The space on each side of the centred reading column in [width], for a
|
||||
/// column [readingWidth] wide.
|
||||
double chatReadingInset(
|
||||
double width, [
|
||||
double readingWidth = kChatReadingWidth,
|
||||
]) => math.max(0, (width - readingWidth) / 2);
|
||||
|
||||
/// The strip left of the reading column that holds an answer's Copy button,
|
||||
/// outside the answer itself.
|
||||
@@ -17,5 +42,9 @@ const double kChatCopyGutterWidth = 48;
|
||||
/// [kChatCopyGutterWidth] when the margin left of the centred reading column
|
||||
/// fits it, else 0, and Copy stays in the answer's footer (phones, narrow
|
||||
/// panes).
|
||||
double chatCopyGutter(double width) =>
|
||||
chatReadingInset(width) >= kChatCopyGutterWidth ? kChatCopyGutterWidth : 0;
|
||||
double chatCopyGutter(
|
||||
double width, [
|
||||
double readingWidth = kChatReadingWidth,
|
||||
]) => chatReadingInset(width, readingWidth) >= kChatCopyGutterWidth
|
||||
? kChatCopyGutterWidth
|
||||
: 0;
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../domain/chat_task_metadata.dart';
|
||||
import '../../../ui/text/monospace.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
Color taskSecondary(BuildContext context) =>
|
||||
Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
@@ -72,6 +73,9 @@ class ChatTaskSurface extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Card.filled(
|
||||
// A design with its own panel fill (Paper's page under a hairline)
|
||||
// draws the card in it rather than a filled tone.
|
||||
color: AppDesignTokens.of(context).panel,
|
||||
margin: EdgeInsets.zero,
|
||||
child: Padding(padding: padding, child: child),
|
||||
);
|
||||
|
||||
@@ -1356,10 +1356,17 @@ class _ChatThreadViewState extends State<ChatThreadView> with ChatFindHost {
|
||||
builder: (context, constraints) {
|
||||
// Rows keep to the centred reading column on a wide
|
||||
// window; the margins beside it still scroll the list.
|
||||
final side = chatReadingInset(constraints.maxWidth);
|
||||
final reading = chatReadingWidthOf(context);
|
||||
final side = chatReadingInset(
|
||||
constraints.maxWidth,
|
||||
reading,
|
||||
);
|
||||
// Answers draw Copy in a strip left of the column; every
|
||||
// other row keeps to the column by insetting past it.
|
||||
final gutter = chatCopyGutter(constraints.maxWidth);
|
||||
final gutter = chatCopyGutter(
|
||||
constraints.maxWidth,
|
||||
reading,
|
||||
);
|
||||
final media = MediaQuery.paddingOf(context);
|
||||
// The date shows once per calendar day, above that day's
|
||||
// first row; each row itself shows only its time.
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'chat_claude_accounts_controller.dart';
|
||||
import 'chat_composer_controller.dart';
|
||||
import 'chat_schedule_time.dart';
|
||||
import 'chat_thread_controller.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
/// Above the composer while the chat's account is out of quota, as Claude
|
||||
/// Code's own app shows it: "Out of usage credits" (or the refusal's own
|
||||
@@ -265,8 +266,16 @@ class _ChatUsageLimitBannerState extends State<ChatUsageLimitBanner> {
|
||||
padding: const EdgeInsetsDirectional.only(bottom: 8),
|
||||
child: Material(
|
||||
key: const Key('chat-usage-limit'),
|
||||
color: scheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
// A flat design's panel: its own fill and corners, framed.
|
||||
color: AppDesignTokens.of(
|
||||
context,
|
||||
).panelFill(scheme, scheme.surfaceContainerHigh),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(16)),
|
||||
side: AppDesignTokens.of(context).frameSide ?? BorderSide.none,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 12, 8),
|
||||
child: Column(
|
||||
@@ -356,7 +365,9 @@ class _ChatUsageLimitBannerState extends State<ChatUsageLimitBanner> {
|
||||
return MergeSemantics(
|
||||
child: InkWell(
|
||||
key: const Key('chat-usage-limit-auto-continue'),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
onTap: () => toggle(!enabled),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
import '../../../ui/theme/app_design_tokens.dart';
|
||||
import 'composer_focus_ring.dart';
|
||||
|
||||
/// The composer's writing area under a design whose composer is an
|
||||
/// underline ([ComposerStyle.underline], Paper): the field and its controls
|
||||
/// on the page's own colour (it floats over the transcript, so it is
|
||||
/// opaque) above a hairline rule. While the field has focus the rule
|
||||
/// thickens in [accent]; while a turn runs a thin moving line runs along it
|
||||
/// instead, in place of the pill's travelling highlight.
|
||||
class ComposerUnderline extends StatelessWidget {
|
||||
const ComposerUnderline({
|
||||
super.key,
|
||||
required this.focus,
|
||||
required this.accent,
|
||||
required this.running,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final FocusNode focus;
|
||||
|
||||
/// The chat's focus colour (the host's primary for a chat with none).
|
||||
final Color accent;
|
||||
|
||||
/// Whether a turn is running.
|
||||
final bool running;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final tokens = AppDesignTokens.of(context);
|
||||
return Material(
|
||||
key: const Key('chat-composer-underline'),
|
||||
color: tokens.panelFill(scheme, scheme.surface),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(GlassBarMetrics.fieldEdgeGap),
|
||||
child: child,
|
||||
),
|
||||
SizedBox(
|
||||
height: ComposerFocusRing.ringWidth,
|
||||
child: running
|
||||
? LinearProgressIndicator(
|
||||
key: const Key('chat-composer-running-rule'),
|
||||
minHeight: ComposerFocusRing.ringWidth,
|
||||
color: accent,
|
||||
backgroundColor: scheme.outlineVariant,
|
||||
)
|
||||
: ListenableBuilder(
|
||||
listenable: focus,
|
||||
builder: (context, _) {
|
||||
final focused = focus.hasFocus;
|
||||
return Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: AnimatedContainer(
|
||||
key: const Key('chat-composer-rule'),
|
||||
duration: ComposerFocusRing.duration,
|
||||
curve: Curves.easeOutCubic,
|
||||
height: focused ? ComposerFocusRing.ringWidth : 1,
|
||||
color: focused ? accent : scheme.outline,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/theme/app_design_tokens.dart';
|
||||
import '../../domain/chat_colors.dart';
|
||||
|
||||
/// The host's own shade for a chat colour name, tuned for the current
|
||||
/// brightness: Material's standard swatches (a deeper tone on light surfaces,
|
||||
/// a lighter one on dark), so the mark keeps its contrast in both. Null for no
|
||||
/// (or an unknown) colour.
|
||||
/// a lighter one on dark), so the mark keeps its contrast in both, quietened
|
||||
/// to the design's [AppDesignTokens.chatColorSaturation] (Paper's ink tones).
|
||||
/// Null for no (or an unknown) colour.
|
||||
Color? chatColorShade(BuildContext context, String? name) {
|
||||
final shade = _materialShade(context, name);
|
||||
if (shade == null) return null;
|
||||
final saturation = AppDesignTokens.of(context).chatColorSaturation;
|
||||
if (saturation >= 1) return shade;
|
||||
final hsl = HSLColor.fromColor(shade);
|
||||
return hsl.withSaturation(hsl.saturation * saturation).toColor();
|
||||
}
|
||||
|
||||
Color? _materialShade(BuildContext context, String? name) {
|
||||
if (name == null || !chatColorNames.contains(name)) return null;
|
||||
final dark = Theme.of(context).brightness == Brightness.dark;
|
||||
final MaterialColor swatch = switch (name) {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/theme/app_design_tokens.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.
|
||||
/// own outline role. A design with its own corners ([AppDesignTokens.radius])
|
||||
/// rounds it with those.
|
||||
class ChatAttachmentFrame extends StatelessWidget {
|
||||
const ChatAttachmentFrame({
|
||||
super.key,
|
||||
@@ -17,6 +20,7 @@ class ChatAttachmentFrame extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final line = Theme.of(context).colorScheme.outlineVariant;
|
||||
final radius = AppDesignTokens.of(context).corners(this.radius);
|
||||
return Container(
|
||||
key: const Key('chat-attachment-frame'),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../../core/api_gateway.dart';
|
||||
import '../../../../ui/theme/app_design_tokens.dart';
|
||||
import '../../data/chat_attachment_images.dart';
|
||||
import '../../domain/chat_attachment_image.dart';
|
||||
import 'chat_attachment_thumbnail.dart';
|
||||
@@ -12,7 +13,8 @@ bool chatPartIsThumbnail(JsonMap part) =>
|
||||
chatImageSourceOf('${part['uri'] ?? ''}'.trim()) != null;
|
||||
|
||||
/// The operator's attached images above their message, end-aligned like the
|
||||
/// turn itself, wrapping onto further lines on a narrow pane.
|
||||
/// turn itself (start-aligned under a manuscript's block quote), wrapping
|
||||
/// onto further lines on a narrow pane.
|
||||
class ChatAttachmentGallery extends StatelessWidget {
|
||||
const ChatAttachmentGallery({
|
||||
super.key,
|
||||
@@ -27,7 +29,10 @@ class ChatAttachmentGallery extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => Wrap(
|
||||
key: const Key('chat-attachment-gallery'),
|
||||
alignment: WrapAlignment.end,
|
||||
alignment:
|
||||
AppDesignTokens.of(context).transcript == TranscriptStyle.manuscript
|
||||
? WrapAlignment.start
|
||||
: WrapAlignment.end,
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../ui/status/app_spinner.dart';
|
||||
import '../../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
import '../../data/chat_attachment_images.dart';
|
||||
import 'chat_attachment_frame.dart';
|
||||
@@ -139,7 +140,7 @@ class _ChatAttachmentThumbnailState extends State<ChatAttachmentThumbnail> {
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
key: const Key('chat-attachment-thumbnail'),
|
||||
borderRadius: _radius,
|
||||
borderRadius: AppDesignTokens.of(context).corners(_radius),
|
||||
onTap: open,
|
||||
child: constrained,
|
||||
),
|
||||
|
||||
@@ -6,6 +6,8 @@ import '../../conversation/chat_schedule_time.dart';
|
||||
import '../../domain/chat_prompt_origin.dart';
|
||||
import 'chat_copy_button.dart';
|
||||
import 'chat_hover_actions.dart';
|
||||
import 'paper/paper_editorial_note.dart';
|
||||
import 'paper/paper_quote.dart';
|
||||
import 'terminal/terminal_glyphs.dart';
|
||||
|
||||
/// The header words of an automated prompt.
|
||||
@@ -67,7 +69,15 @@ class ChatAutomatedPromptCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
);
|
||||
final card = AppDesignTokens.of(context).terminal
|
||||
final transcript = AppDesignTokens.of(context).transcript;
|
||||
final card = transcript == TranscriptStyle.manuscript
|
||||
? PaperEditorialNote(
|
||||
label: label,
|
||||
detail: detail,
|
||||
body: body,
|
||||
hasBody: prompt.body.trim().isNotEmpty,
|
||||
)
|
||||
: transcript == TranscriptStyle.prompt
|
||||
? _terminalLine(context, label, detail)
|
||||
: Material(
|
||||
key: const Key('chat-automated-prompt'),
|
||||
@@ -98,9 +108,11 @@ class ChatAutomatedPromptCard extends StatelessWidget {
|
||||
final copy = prompt.body.trim().isEmpty
|
||||
? null
|
||||
: ChatHoverReveal(child: ChatCopyButton(text: prompt.body.trim()));
|
||||
final footerInset = AppDesignTokens.of(context).terminal
|
||||
? 8 + terminalGlyphColumn(context)
|
||||
: 14.0;
|
||||
final footerInset = switch (transcript) {
|
||||
TranscriptStyle.prompt => 8 + terminalGlyphColumn(context),
|
||||
TranscriptStyle.manuscript => paperQuoteTextInset,
|
||||
TranscriptStyle.bubbles => 14.0,
|
||||
};
|
||||
return ChatHoverRegion(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -57,8 +57,15 @@ class ChatCodeHover {
|
||||
onEnter: (_) => _exit?.cancel(),
|
||||
onExit: (_) => scheduleHide(token),
|
||||
child: Material(
|
||||
elevation: 3,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
// A floating piece, shaped as the design's menus are.
|
||||
elevation: Theme.of(context).popupMenuTheme.elevation ?? 3,
|
||||
shadowColor: Theme.of(context).popupMenuTheme.shadowColor,
|
||||
color: Theme.of(context).popupMenuTheme.color,
|
||||
shape:
|
||||
Theme.of(context).popupMenuTheme.shape ??
|
||||
const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
child: ChatCopyButton(text: text, showLabel: true),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -284,7 +284,7 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
(part) => TextSpan(text: part),
|
||||
),
|
||||
),
|
||||
style: const TextStyle(fontFamily: appMonospaceFamily),
|
||||
style: _codeStyle(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -429,9 +429,14 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
);
|
||||
}
|
||||
|
||||
// Beside a reading face (Paper's serif) the monospace runs large: it
|
||||
// drops to about the serif's x-height.
|
||||
final ambient = DefaultTextStyle.of(context).style.fontSize;
|
||||
final reading = AppDesignTokens.of(context).reading.family != null;
|
||||
return TextSpan(
|
||||
style: TextStyle(
|
||||
fontFamily: appMonospaceFamily,
|
||||
fontSize: reading && ambient != null ? ambient * 0.86 : null,
|
||||
// A span's background is painted over the selection highlight, so an
|
||||
// opaque fill hid a selected code span; a partial fill keeps code
|
||||
// distinct and lets the selection show through.
|
||||
@@ -525,7 +530,25 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
final text = Theme.of(context).textTheme;
|
||||
// A terminal prints headings at the text's own size, in bold; the top
|
||||
// level takes the accent colour.
|
||||
if (AppDesignTokens.of(context).terminal) {
|
||||
final transcript = AppDesignTokens.of(context).transcript;
|
||||
// A manuscript sets headings like a book's: the reading face itself,
|
||||
// semibold, a step or two larger, with a tighter line.
|
||||
if (transcript == TranscriptStyle.manuscript) {
|
||||
final ambient = DefaultTextStyle.of(context).style;
|
||||
final size = ambient.fontSize ?? 16;
|
||||
return ambient.copyWith(
|
||||
fontSize:
|
||||
size *
|
||||
switch (level) {
|
||||
1 => 1.4,
|
||||
2 => 1.2,
|
||||
_ => 1.0,
|
||||
},
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.3,
|
||||
);
|
||||
}
|
||||
if (transcript == TranscriptStyle.prompt) {
|
||||
return _roleStyle(
|
||||
context,
|
||||
text.bodyLarge?.copyWith(
|
||||
@@ -542,6 +565,21 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
return _roleStyle(context, role);
|
||||
}
|
||||
|
||||
/// A code block's text: the bundled monospace face. A design with its
|
||||
/// own reading type (Paper) sets code a step smaller than its prose and on
|
||||
/// a tighter line, as a technical book does.
|
||||
TextStyle _codeStyle(BuildContext context) {
|
||||
const mono = TextStyle(fontFamily: appMonospaceFamily);
|
||||
final reading = AppDesignTokens.of(context).reading;
|
||||
if (reading.family == null) return mono;
|
||||
final size = DefaultTextStyle.of(context).style.fontSize ?? 16;
|
||||
return mono.copyWith(
|
||||
fontSize: size * 0.82,
|
||||
height: 1.45,
|
||||
fontStyle: FontStyle.normal,
|
||||
);
|
||||
}
|
||||
|
||||
/// Merges a host theme role into the ambient text style.
|
||||
TextStyle? _roleStyle(BuildContext context, TextStyle? role) => role == null
|
||||
? null
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/theme/app_design_tokens.dart';
|
||||
import '../sessions/chat_color_palette.dart';
|
||||
import 'paper/paper_quote.dart';
|
||||
import 'terminal/terminal_prompt_line.dart';
|
||||
|
||||
/// How strongly a coloured chat's shade washes the operator's bubbles over
|
||||
@@ -45,8 +46,13 @@ class ChatUserBubble extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (AppDesignTokens.of(context).terminal) {
|
||||
return TerminalPromptLine(child: child);
|
||||
switch (AppDesignTokens.of(context).transcript) {
|
||||
case TranscriptStyle.prompt:
|
||||
return TerminalPromptLine(child: child);
|
||||
case TranscriptStyle.manuscript:
|
||||
return PaperQuote(child: child);
|
||||
case TranscriptStyle.bubbles:
|
||||
break;
|
||||
}
|
||||
// A Material surface (not a bare DecoratedBox) so a disclosure ListTile
|
||||
// inside the bubble keeps its ink and background.
|
||||
@@ -75,9 +81,11 @@ class ChatAgentSurface extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// The transcript's reading text: the host's large body role, so answers read
|
||||
/// at a comfortable size and still follow the operator's text scaling.
|
||||
TextStyle? chatMessageTextStyle(BuildContext context) =>
|
||||
Theme.of(context).textTheme.bodyLarge;
|
||||
/// at a comfortable size and still follow the operator's text scaling, in
|
||||
/// the design's reading face and line height (Paper's serif).
|
||||
TextStyle? chatMessageTextStyle(BuildContext context) => AppDesignTokens.of(
|
||||
context,
|
||||
).reading.apply(Theme.of(context).textTheme.bodyLarge);
|
||||
|
||||
/// The empty-line gap between two paragraphs of a reply: about one line of
|
||||
/// body text at [fontSize] (else the ambient text size), scaled by the
|
||||
|
||||
@@ -18,6 +18,7 @@ import 'chat_link_text.dart';
|
||||
import 'chat_message_bubble.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
import 'native_disclosure.dart';
|
||||
import 'paper/paper_quote.dart';
|
||||
import 'terminal/terminal_glyphs.dart';
|
||||
import 'chat_message_timestamp.dart';
|
||||
import 'chat_read_aloud_button.dart';
|
||||
@@ -79,11 +80,12 @@ class ChatMessageView extends StatelessWidget {
|
||||
// A wide window draws an answer's Copy in the gutter left of the reading
|
||||
// column; without room it trails the time in the answer's footer.
|
||||
final gutter = user ? 0.0 : ChatCopyGutter.of(context);
|
||||
// A terminal design reads top to bottom like a CLI: the operator's
|
||||
// prompt line starts at the same edge as the answer and spans its
|
||||
// column.
|
||||
final terminal = AppDesignTokens.of(context).terminal;
|
||||
final trailingUser = user && !automated && !terminal;
|
||||
// A terminal or manuscript transcript reads top to bottom: the
|
||||
// operator's prompt line or block quote starts at the same edge as the
|
||||
// answer and spans its column.
|
||||
final transcript = AppDesignTokens.of(context).transcript;
|
||||
final trailingUser =
|
||||
user && !automated && transcript == TranscriptStyle.bubbles;
|
||||
// No visible role label: side and surface say who spoke and the row's
|
||||
// semantics label names the role. The operator's turn is a neutral bubble
|
||||
// that shrinks to its content; the agent's answer sits on the page with no
|
||||
@@ -101,7 +103,11 @@ class ChatMessageView extends StatelessWidget {
|
||||
explicitChildNodes: true,
|
||||
label: '$role message',
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
// A manuscript leaves a little more air between turns, as a page
|
||||
// spaces its paragraphs, since no bubble sets them apart.
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: transcript == TranscriptStyle.manuscript ? 12 : 6,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Align(
|
||||
alignment: trailingUser
|
||||
@@ -119,7 +125,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
child: automated
|
||||
? _automatedTurn(origin, content)
|
||||
: user
|
||||
? _userTurn(content, body, origin, terminal: terminal)
|
||||
? _userTurn(content, body, origin, transcript: transcript)
|
||||
: _agentRow(
|
||||
context,
|
||||
content,
|
||||
@@ -147,8 +153,9 @@ class ChatMessageView extends StatelessWidget {
|
||||
List<Widget> content,
|
||||
Widget body,
|
||||
ChatPromptOrigin origin, {
|
||||
required bool terminal,
|
||||
required TranscriptStyle transcript,
|
||||
}) {
|
||||
final stacked = transcript != TranscriptStyle.bubbles;
|
||||
final thumbnails = [
|
||||
for (final part in _partsOf(_userMessage))
|
||||
if (_isFile(part) && chatPartIsThumbnail(part)) part,
|
||||
@@ -163,14 +170,21 @@ class ChatMessageView extends StatelessWidget {
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: terminal
|
||||
crossAxisAlignment: stacked
|
||||
? CrossAxisAlignment.stretch
|
||||
: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if (thumbnails.isNotEmpty)
|
||||
ChatAttachmentGallery(
|
||||
parts: thumbnails,
|
||||
images: images ?? _inlineImages,
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: transcript == TranscriptStyle.manuscript
|
||||
? paperQuoteTextInset
|
||||
: 0,
|
||||
),
|
||||
child: ChatAttachmentGallery(
|
||||
parts: thumbnails,
|
||||
images: images ?? _inlineImages,
|
||||
),
|
||||
),
|
||||
if (thumbnails.isNotEmpty && content.isNotEmpty)
|
||||
const SizedBox(height: 6),
|
||||
@@ -179,16 +193,24 @@ class ChatMessageView extends StatelessWidget {
|
||||
// The delivery line and the time share one line under the bubble.
|
||||
if (footer.isNotEmpty || hasTimestamp || marked) ...[
|
||||
const SizedBox(height: 2),
|
||||
Wrap(
|
||||
key: const Key('chat-message-footer'),
|
||||
spacing: 8,
|
||||
alignment: terminal ? WrapAlignment.start : WrapAlignment.end,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
...footer,
|
||||
if (marked) const ChatScheduledMark(),
|
||||
if (hasTimestamp) timestamp,
|
||||
],
|
||||
Padding(
|
||||
// Under a manuscript the line starts at the quoted text.
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: transcript == TranscriptStyle.manuscript
|
||||
? paperQuoteTextInset
|
||||
: 0,
|
||||
),
|
||||
child: Wrap(
|
||||
key: const Key('chat-message-footer'),
|
||||
spacing: 8,
|
||||
alignment: stacked ? WrapAlignment.start : WrapAlignment.end,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
...footer,
|
||||
if (marked) const ChatScheduledMark(),
|
||||
if (hasTimestamp) timestamp,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
@@ -9,6 +9,7 @@ import '../../../../ui/theme/app_design_tokens.dart';
|
||||
import 'chat_response_pending.dart';
|
||||
import 'chat_turn_activity_details.dart';
|
||||
import 'chat_turn_chip.dart';
|
||||
import 'paper/paper_activity_note.dart';
|
||||
import 'terminal/terminal_activity_rows.dart';
|
||||
|
||||
/// The activity control's content inset is shared with the rest of the reply.
|
||||
@@ -122,14 +123,25 @@ class _ChatTurnActivityViewState extends State<ChatTurnActivityView> {
|
||||
: DateTime.now().difference(started);
|
||||
final seconds = duration.inSeconds.clamp(0, 2147483647);
|
||||
final label = '${data.label}${widget.streaming ? ' ${seconds}s' : ''}';
|
||||
if (AppDesignTokens.of(context).terminal) {
|
||||
return TerminalActivityRows(
|
||||
data: data,
|
||||
status: label,
|
||||
streaming: widget.streaming,
|
||||
seconds: seconds,
|
||||
onOpen: _open,
|
||||
);
|
||||
switch (AppDesignTokens.of(context).transcript) {
|
||||
case TranscriptStyle.prompt:
|
||||
return TerminalActivityRows(
|
||||
data: data,
|
||||
status: label,
|
||||
streaming: widget.streaming,
|
||||
seconds: seconds,
|
||||
onOpen: _open,
|
||||
);
|
||||
case TranscriptStyle.manuscript:
|
||||
return PaperActivityNote(
|
||||
data: data,
|
||||
status: label,
|
||||
streaming: widget.streaming,
|
||||
failed: data.failed,
|
||||
onOpen: _open,
|
||||
);
|
||||
case TranscriptStyle.bubbles:
|
||||
break;
|
||||
}
|
||||
// Desktop hover hugs the label; phones keep the full-width touch row.
|
||||
final compact = prefersCompactHitTargets(context);
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/app_popups.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
import '../../../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
/// The quiet chip under an agent turn (its tools, its permissions) and the
|
||||
/// native sheet it opens.
|
||||
@@ -103,7 +104,9 @@ class _ChatTurnChipState extends State<ChatTurnChip> {
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: InkWell(
|
||||
key: widget.chipKey,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: AppDesignTokens.of(
|
||||
context,
|
||||
).corners(BorderRadius.circular(8)),
|
||||
onTap: _show,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../ui/adaptive/platform.dart';
|
||||
import '../../../domain/chat_tool_calls.dart';
|
||||
import '../../../domain/chat_turn_activity.dart';
|
||||
import '../chat_message_bubble.dart';
|
||||
import '../chat_response_pending.dart';
|
||||
|
||||
/// How many distinct tool names a marginal note lists before "and more".
|
||||
const int paperActivityNamedTools = 3;
|
||||
|
||||
/// A turn's activity under a manuscript transcript: a small muted note in
|
||||
/// the margin of the answer, as a book prints a side note. A short rule,
|
||||
/// then the turn's status in small italic reading type and, once settled,
|
||||
/// the tools it used ("Used 6 tools — Bash, Read, Edit"). The note is one
|
||||
/// button that opens the activity details, like the Default design's line.
|
||||
class PaperActivityNote extends StatelessWidget {
|
||||
const PaperActivityNote({
|
||||
super.key,
|
||||
required this.data,
|
||||
required this.status,
|
||||
required this.streaming,
|
||||
required this.failed,
|
||||
required this.onOpen,
|
||||
});
|
||||
|
||||
final ChatTurnActivityData data;
|
||||
|
||||
/// The turn's one-line status (with its running seconds while streaming).
|
||||
final String status;
|
||||
final bool streaming;
|
||||
final bool failed;
|
||||
final VoidCallback onOpen;
|
||||
|
||||
/// The note's words: the status, then the distinct tools it used.
|
||||
static String noteText(ChatTurnActivityData data, String status) {
|
||||
final names = <String>[];
|
||||
for (final call in data.tools) {
|
||||
final name = chatToolLabel(call);
|
||||
if (!names.contains(name)) names.add(name);
|
||||
}
|
||||
if (names.isEmpty) return status;
|
||||
final shown = names.take(paperActivityNamedTools).join(', ');
|
||||
final more = names.length > paperActivityNamedTools ? ', …' : '';
|
||||
return '$status — $shown$more';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final color = failed && !streaming ? scheme.error : scheme.onSurfaceVariant;
|
||||
final reading = chatMessageTextStyle(context);
|
||||
final style = reading?.copyWith(
|
||||
fontSize: (reading.fontSize ?? 16) * 0.82,
|
||||
fontStyle: FontStyle.italic,
|
||||
height: 1.3,
|
||||
color: color,
|
||||
);
|
||||
final compact = prefersCompactHitTargets(context);
|
||||
final text = streaming ? status : noteText(data, status);
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: '$status, expand for details',
|
||||
excludeSemantics: true,
|
||||
onTap: onOpen,
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
widthFactor: 1,
|
||||
child: InkWell(
|
||||
key: const Key('chat-turn-activity'),
|
||||
onTap: onOpen,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(minHeight: compact ? 32 : 40),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Row(
|
||||
key: const Key('chat-paper-activity-note'),
|
||||
mainAxisSize: compact ? MainAxisSize.min : MainAxisSize.max,
|
||||
children: [
|
||||
if (streaming)
|
||||
ExcludeSemantics(
|
||||
child: DefaultTextStyle.merge(
|
||||
style: TextStyle(color: scheme.primary),
|
||||
child: const ChatResponsePending(),
|
||||
),
|
||||
)
|
||||
else
|
||||
// The margin rule a side note hangs from.
|
||||
Container(width: 16, height: 1, color: scheme.outline),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: style,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../chat_message_bubble.dart';
|
||||
import 'paper_quote.dart';
|
||||
|
||||
/// A prompt the agent or the server sent (a follow-up, an auto-continue)
|
||||
/// under a manuscript transcript: not a card but a small italic editorial
|
||||
/// note, as an editor's aside is set in a book. A spaced small-caps header
|
||||
/// names what sent it, then the prompt in the muted italic reading face, set
|
||||
/// in from the page like the operator's quoted words.
|
||||
class PaperEditorialNote extends StatelessWidget {
|
||||
const PaperEditorialNote({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.detail,
|
||||
required this.body,
|
||||
required this.hasBody,
|
||||
});
|
||||
|
||||
/// What sent the prompt ("Follow-up from agent").
|
||||
final String label;
|
||||
|
||||
/// When or why it was sent, or null.
|
||||
final String? detail;
|
||||
final Widget body;
|
||||
final bool hasBody;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final muted = theme.colorScheme.onSurfaceVariant;
|
||||
final caps = paperSmallCapsStyle(context);
|
||||
final reading = chatMessageTextStyle(context);
|
||||
final note = reading?.copyWith(
|
||||
fontSize: (reading.fontSize ?? 16) * 0.92,
|
||||
fontStyle: FontStyle.italic,
|
||||
height: 1.45,
|
||||
color: muted,
|
||||
);
|
||||
final header = SelectionContainer.disabled(
|
||||
child: Text.rich(
|
||||
key: const Key('chat-automated-prompt-header'),
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(text: label.toUpperCase(), style: caps),
|
||||
if (detail != null)
|
||||
TextSpan(
|
||||
text: ' · $detail',
|
||||
style: caps?.copyWith(letterSpacing: 0.2),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
return Material(
|
||||
key: const Key('chat-automated-prompt'),
|
||||
type: MaterialType.transparency,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: paperQuoteTextInset,
|
||||
top: 2,
|
||||
bottom: 2,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
header,
|
||||
if (hasBody) ...[
|
||||
const SizedBox(height: 4),
|
||||
DefaultTextStyle.merge(style: note, child: body),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../sessions/chat_color_palette.dart';
|
||||
import '../chat_message_bubble.dart';
|
||||
|
||||
/// How far a manuscript's block quote (the operator's turn) sits in from the
|
||||
/// answer's text edge, so the reader sees whose words they are by indent.
|
||||
const double paperQuoteIndent = 16;
|
||||
|
||||
/// The width of the quote's rule.
|
||||
const double paperQuoteRule = 2;
|
||||
|
||||
/// The gap between the rule and the quoted text.
|
||||
const double paperQuoteGap = 12;
|
||||
|
||||
/// Where the quoted text starts, from the row's edge: the footer under the
|
||||
/// quote (its delivery line and time) starts here too.
|
||||
const double paperQuoteTextInset =
|
||||
paperQuoteIndent + paperQuoteRule + paperQuoteGap;
|
||||
|
||||
/// The words of the small-caps label above the operator's turn.
|
||||
const String paperQuoteLabel = 'You';
|
||||
|
||||
/// The style of a manuscript's small editorial labels: italic capitals set
|
||||
/// small and spaced, the way a book sets small caps (the serif's italic has
|
||||
/// no small-caps feature, so they are spaced capitals), in the muted ink.
|
||||
TextStyle? paperSmallCapsStyle(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final reading = chatMessageTextStyle(context);
|
||||
final size = (reading?.fontSize ?? 16) * 0.72;
|
||||
return reading?.copyWith(
|
||||
fontSize: size,
|
||||
fontStyle: FontStyle.italic,
|
||||
letterSpacing: size * 0.12,
|
||||
height: 1.2,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
);
|
||||
}
|
||||
|
||||
/// The operator's turn under a manuscript transcript: an indented block
|
||||
/// quote with a thin rule in the chat's colour (the outline for a chat with
|
||||
/// none) and a small-caps "You" above it, instead of a bubble. It spans the
|
||||
/// reading column, like the answer below it.
|
||||
class PaperQuote extends StatelessWidget {
|
||||
const PaperQuote({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final shade = chatColorShade(context, ChatBubbleColor.of(context));
|
||||
return Material(
|
||||
key: const Key('chat-paper-quote'),
|
||||
type: MaterialType.transparency,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: paperQuoteIndent),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ExcludeSemantics(
|
||||
child: SelectionContainer.disabled(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: paperQuoteRule + paperQuoteGap,
|
||||
bottom: 4,
|
||||
),
|
||||
child: Text(
|
||||
paperQuoteLabel.toUpperCase(),
|
||||
key: const Key('chat-paper-quote-label'),
|
||||
style: paperSmallCapsStyle(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: BorderDirectional(
|
||||
start: BorderSide(
|
||||
color: shade ?? scheme.outline,
|
||||
width: paperQuoteRule,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: paperQuoteGap,
|
||||
top: 2,
|
||||
bottom: 2,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user