App: add a selectable app design with a Terminal look

AppDesign builds each design's light and dark ThemeData with an
AppDesignTokens extension (corner radius, flat surfaces, frame colour,
ANSI accents, prompt glyph). Settings gains a Design picker stored per
device; the theme hosts rebuild live. Terminal is monospace (bundled
RobotoMono), near-black or paper, flat 1px frames with 3px corners, and
draws the chat transcript as prompt lines, tool dot/result lines and
bracketed follow-up lines. Default keeps its exact themes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 16:43:59 +00:00
parent 9a6363b80e
commit ca2f7eee32
45 changed files with 1961 additions and 95 deletions
@@ -1,9 +1,12 @@
import 'package:flutter/material.dart';
import '../../../../ui/theme/app_design_tokens.dart';
import '../../conversation/chat_schedule_time.dart';
import '../../domain/chat_prompt_origin.dart';
import 'chat_copy_button.dart';
import 'chat_hover_actions.dart';
import 'terminal/terminal_glyphs.dart';
/// The header words of an automated prompt.
String chatAutomatedPromptLabel(ChatPromptOrigin origin) => switch (origin) {
@@ -64,35 +67,40 @@ class ChatAutomatedPromptCard extends StatelessWidget {
],
),
);
final card = Material(
key: const Key('chat-automated-prompt'),
color: scheme.surfaceContainerLow,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(Radius.circular(16)),
side: BorderSide(color: scheme.outlineVariant),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(14, 8, 14, 10),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
header,
if (prompt.body.trim().isNotEmpty) ...[
const SizedBox(height: 4),
DefaultTextStyle.merge(
style: theme.textTheme.bodyMedium,
child: body,
final card = AppDesignTokens.of(context).terminal
? _terminalLine(context, label, detail)
: Material(
key: const Key('chat-automated-prompt'),
color: scheme.surfaceContainerLow,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(Radius.circular(16)),
side: BorderSide(color: scheme.outlineVariant),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(14, 8, 14, 10),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
header,
if (prompt.body.trim().isNotEmpty) ...[
const SizedBox(height: 4),
DefaultTextStyle.merge(
style: theme.textTheme.bodyMedium,
child: body,
),
],
],
),
],
],
),
),
);
),
);
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;
return ChatHoverRegion(
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -101,7 +109,7 @@ class ChatAutomatedPromptCard extends StatelessWidget {
card,
if (footer.isNotEmpty || timestamp != null || copy != null)
Padding(
padding: const EdgeInsetsDirectional.only(start: 14, top: 2),
padding: EdgeInsetsDirectional.only(start: footerInset, top: 2),
child: Wrap(
key: const Key('chat-message-footer'),
spacing: 8,
@@ -115,6 +123,90 @@ class ChatAutomatedPromptCard extends StatelessWidget {
}
}
extension on ChatAutomatedPromptCard {
/// Under a terminal design the prompt is not a card but dim bracketed
/// lines, as a CLI prints a message it injected: `[Follow-up from agent ·
/// scheduled …]`, then the prompt behind a dim rule.
Widget _terminalLine(BuildContext context, String label, String? detail) {
final theme = Theme.of(context);
final dim = theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
);
final header = SelectionContainer.disabled(
child: Text.rich(
key: const Key('chat-automated-prompt-header'),
TextSpan(
style: dim,
children: [
const TextSpan(text: '['),
TextSpan(
text: label,
style: const TextStyle(fontWeight: FontWeight.w700),
),
if (detail != null) TextSpan(text: ' · $detail'),
const TextSpan(text: ']'),
],
),
),
);
// Inset like the answer's text, so the bracket starts in the same
// column as the agent's dots.
return Material(
key: const Key('chat-automated-prompt'),
type: MaterialType.transparency,
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
header,
if (prompt.body.trim().isNotEmpty)
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(
width: terminalGlyphColumn(context),
child: CustomPaint(
painter: _RulePainter(theme.colorScheme.outline),
),
),
Expanded(
child: DefaultTextStyle.merge(style: dim, child: body),
),
],
),
),
],
),
),
);
}
}
/// The dim vertical rule beside an injected prompt's text.
class _RulePainter extends CustomPainter {
const _RulePainter(this.color);
final Color color;
@override
void paint(Canvas canvas, Size size) {
final x = size.width * 0.25;
canvas.drawLine(
Offset(x, 2),
Offset(x, size.height - 2),
Paint()
..color = color
..strokeWidth = 1,
);
}
@override
bool shouldRepaint(_RulePainter old) => old.color != color;
}
/// The small "Scheduled" mark under the operator's own message they had
/// scheduled to send later, once it is no longer waiting.
class ChatScheduledMark extends StatelessWidget {
@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
import '../../../../ui/theme/app_design_tokens.dart';
import 'package:flutter/rendering.dart';
import 'chat_copy_button.dart';
@@ -151,6 +152,9 @@ class ChatCodeCopyRegion extends StatelessWidget {
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final corners = AppDesignTokens.of(
context,
).corners(BorderRadius.circular(radius));
final header = ColoredBox(
key: const Key('chat-code-header'),
color: headerFill(context),
@@ -170,10 +174,10 @@ class ChatCodeCopyRegion extends StatelessWidget {
position: DecorationPosition.foreground,
decoration: BoxDecoration(
border: Border.all(color: scheme.outlineVariant),
borderRadius: BorderRadius.circular(radius),
borderRadius: corners,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(radius),
borderRadius: corners,
child: ColoredBox(
key: const Key('chat-code-body'),
color: fill(context),
@@ -1,6 +1,8 @@
import 'dart:async';
import 'package:flutter/material.dart';
import '../../../../ui/theme/app_design_tokens.dart';
import 'package:flutter/rendering.dart';
import 'chat_transcript_selection.dart';
@@ -521,6 +523,17 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
/// heading never reads like a paragraph.
TextStyle? _headingStyle(BuildContext context, int level) {
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) {
return _roleStyle(
context,
text.bodyLarge?.copyWith(
fontWeight: FontWeight.w700,
color: level == 1 ? Theme.of(context).colorScheme.primary : null,
),
);
}
final role = switch (level) {
1 => text.headlineSmall,
2 => text.titleLarge,
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import '../../../../ui/theme/app_design_tokens.dart';
import '../sessions/chat_color_palette.dart';
import 'terminal/terminal_prompt_line.dart';
/// How strongly a coloured chat's shade washes the operator's bubbles over
/// the host's neutral bubble fill. Text keeps the host's colours.
@@ -43,6 +45,9 @@ class ChatUserBubble extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (AppDesignTokens.of(context).terminal) {
return TerminalPromptLine(child: child);
}
// A Material surface (not a bare DecoratedBox) so a disclosure ListTile
// inside the bubble keeps its ink and background.
return Material(
@@ -2,6 +2,8 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import '../../../../ui/theme/app_design_tokens.dart';
import '../../../../core/api_gateway.dart';
import '../../data/chat_attachment_images.dart';
import 'chat_attachment_gallery.dart';
@@ -16,6 +18,7 @@ import 'chat_link_text.dart';
import 'chat_message_bubble.dart';
import 'chat_turn_activity_view.dart';
import 'native_disclosure.dart';
import 'terminal/terminal_glyphs.dart';
import 'chat_message_timestamp.dart';
import 'chat_read_aloud_button.dart';
import '../../speech/speech_controller.dart';
@@ -76,6 +79,11 @@ 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;
// 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
@@ -96,7 +104,7 @@ class ChatMessageView extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6),
child: LayoutBuilder(
builder: (context, constraints) => Align(
alignment: user && !automated
alignment: trailingUser
? AlignmentDirectional.centerEnd
: AlignmentDirectional.centerStart,
child: ConstrainedBox(
@@ -104,14 +112,14 @@ class ChatMessageView extends StatelessWidget {
// sides read as a conversation; the answer keeps a readable
// measure on a wide pane.
constraints: BoxConstraints(
maxWidth: user
maxWidth: trailingUser
? (constraints.maxWidth * 0.85).clamp(0, 560).toDouble()
: 720 + gutter,
),
child: automated
? _automatedTurn(origin, content)
: user
? _userTurn(content, body, origin)
? _userTurn(content, body, origin, terminal: terminal)
: _agentRow(
context,
content,
@@ -135,7 +143,12 @@ class ChatMessageView extends StatelessWidget {
/// Attached images sit above the operator's bubble, as their own thumbnails;
/// an images-only turn draws no empty bubble. The footer (the delivery line)
/// sits under the bubble's trailing corner.
Widget _userTurn(List<Widget> content, Widget body, ChatPromptOrigin origin) {
Widget _userTurn(
List<Widget> content,
Widget body,
ChatPromptOrigin origin, {
required bool terminal,
}) {
final thumbnails = [
for (final part in _partsOf(_userMessage))
if (_isFile(part) && chatPartIsThumbnail(part)) part,
@@ -150,7 +163,9 @@ class ChatMessageView extends StatelessWidget {
}
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: terminal
? CrossAxisAlignment.stretch
: CrossAxisAlignment.end,
children: [
if (thumbnails.isNotEmpty)
ChatAttachmentGallery(
@@ -167,7 +182,7 @@ class ChatMessageView extends StatelessWidget {
Wrap(
key: const Key('chat-message-footer'),
spacing: 8,
alignment: WrapAlignment.end,
alignment: terminal ? WrapAlignment.start : WrapAlignment.end,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
...footer,
@@ -307,6 +322,7 @@ class ChatMessageView extends StatelessWidget {
for (final part in parts)
if (isChatToolPart(part)) part,
];
final terminal = AppDesignTokens.of(context).terminal;
final model = '${row['model'] ?? ''}'.trim();
// The metadata line: the model that answered and the time, muted; the
// actions (when not in the gutter) trail it.
@@ -345,7 +361,7 @@ class ChatMessageView extends StatelessWidget {
padding: const EdgeInsets.symmetric(
horizontal: chatAgentContentInset,
),
child: answer,
child: terminal ? _terminalAnswer(context, answer) : answer,
),
// Settled permissions, questions and changes: meta rows that, like
// the activity line, sit at the row edge with their content inset to
@@ -363,7 +379,10 @@ class ChatMessageView extends StatelessWidget {
// trail it, so hidden actions leave no gap before it. Without
// metadata the buttons' own inset aligns their icons instead.
padding: EdgeInsetsDirectional.only(
start: meta.isEmpty ? 0 : chatAgentContentInset,
start: meta.isEmpty
? 0
: chatAgentContentInset +
(terminal ? terminalGlyphColumn(context) : 0),
end: chatAgentContentInset,
),
child: Wrap(
@@ -377,6 +396,18 @@ class ChatMessageView extends StatelessWidget {
);
}
/// The answer under a terminal design: a dot in the glyph column, as a
/// CLI agent marks its reply, then the text.
Widget _terminalAnswer(BuildContext context, Widget answer) =>
TerminalGlyphRow(
glyph: TerminalGlyph(
TerminalGlyphKind.dot,
color: Theme.of(context).colorScheme.onSurface,
style: chatMessageTextStyle(context),
),
child: answer,
);
/// The answer as the operator reads it: the turn's text parts in order,
/// without reasoning, tools or attachments.
List<String> _answerParts(List<JsonMap> parts) => [
@@ -5,9 +5,11 @@ import 'package:flutter/material.dart';
import '../../../../core/api_gateway.dart';
import '../../domain/chat_turn_activity.dart';
import '../../../../ui/adaptive/platform.dart';
import '../../../../ui/theme/app_design_tokens.dart';
import 'chat_response_pending.dart';
import 'chat_turn_activity_details.dart';
import 'chat_turn_chip.dart';
import 'terminal/terminal_activity_rows.dart';
/// The activity control's content inset is shared with the rest of the reply.
const chatAgentContentInset = 8.0;
@@ -120,6 +122,15 @@ 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,
);
}
// Desktop hover hugs the label; phones keep the full-width touch row.
final compact = prefersCompactHitTargets(context);
final content = ConstrainedBox(
@@ -0,0 +1,208 @@
import 'package:flutter/material.dart';
import '../../../../../core/api_gateway.dart';
import '../../../../../ui/theme/app_design_tokens.dart';
import '../../../domain/chat_tool_calls.dart';
import '../../../domain/chat_turn_activity.dart';
import '../chat_response_pending.dart';
import 'terminal_glyphs.dart';
/// How many of a turn's calls the transcript lists; earlier ones fold into
/// one "earlier" line (every call stays in the details dialog).
const int terminalActivityMaxCalls = 6;
/// A turn's activity under a terminal design, as a CLI agent prints it: one
/// `● Tool(detail)` line per call, its status in the dot's colour, with a
/// `⎿ result` line beneath, and while the turn runs a live status line.
/// The block is one button that opens the activity details, like the
/// Default design's one-line status.
class TerminalActivityRows extends StatelessWidget {
const TerminalActivityRows({
super.key,
required this.data,
required this.status,
required this.streaming,
required this.onOpen,
this.seconds = 0,
});
final ChatTurnActivityData data;
/// The turn's one-line status (with its running seconds while streaming).
final String status;
final bool streaming;
final VoidCallback onOpen;
/// How long the running turn has been doing what it does now.
final int seconds;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final scheme = theme.colorScheme;
final ansi = AppDesignTokens.of(context).ansi;
final style = theme.textTheme.bodyMedium!;
final dim = style.copyWith(color: scheme.onSurfaceVariant);
final calls = data.tools;
final shown = calls.length > terminalActivityMaxCalls
? calls.sublist(calls.length - terminalActivityMaxCalls)
: calls;
final hidden = calls.length - shown.length;
final lines = <Widget>[
if (data.reasoning.isNotEmpty && calls.isEmpty && !streaming)
_line(context, TerminalGlyphKind.dot, scheme.onSurfaceVariant, [
TextSpan(text: 'Thought', style: dim),
]),
if (hidden > 0)
_line(context, null, scheme.onSurfaceVariant, [
TextSpan(
text: '… +$hidden earlier tool ${hidden == 1 ? 'use' : 'uses'}',
style: dim,
),
]),
for (final call in shown) ..._call(context, call, style, dim, ansi),
if (calls.isEmpty && data.reasoning.isEmpty && !streaming)
_line(context, TerminalGlyphKind.dot, scheme.onSurfaceVariant, [
TextSpan(text: status, style: dim),
]),
if (streaming) _live(context, style),
];
return Semantics(
button: true,
label: '$status, expand for details',
excludeSemantics: true,
onTap: onOpen,
child: InkWell(
key: const Key('chat-turn-activity'),
onTap: onOpen,
child: ConstrainedBox(
constraints: const BoxConstraints(minHeight: 40),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: DefaultTextStyle.merge(
style: style,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: lines,
),
),
),
),
),
);
}
List<Widget> _call(
BuildContext context,
JsonMap call,
TextStyle style,
TextStyle dim,
AnsiAccents? ansi,
) {
final scheme = Theme.of(context).colorScheme;
final failed = chatToolFailed(call);
final running = chatToolRunning(call);
final color = failed
? ansi?.red ?? scheme.error
: running
? ansi?.yellow ?? scheme.tertiary
: ansi?.green ?? scheme.primary;
final detail = chatToolDetail(call);
final head = [
TextSpan(
text: chatToolLabel(call),
style: style.copyWith(fontWeight: FontWeight.w700),
),
if (detail != null) TextSpan(text: '($detail)', style: dim),
];
final duration = chatToolDurationMillis(call);
final String result;
if (running) {
result = 'running…';
} else {
final text = failed ? chatToolErrorText(call) : chatToolOutputText(call);
final first = text
.split('\n')
.map((line) => line.trim())
.firstWhere((line) => line.isNotEmpty, orElse: () => '');
final more = text.trim().split('\n').length - 1;
result = [
if (first.isNotEmpty) first,
if (more > 0) '+$more lines',
if (duration != null) formatChatToolDuration(duration),
].join(' · ');
}
return [
_line(context, TerminalGlyphKind.dot, color, head),
if (result.isNotEmpty)
_line(context, TerminalGlyphKind.elbow, scheme.outline, [
TextSpan(
text: result,
style: failed ? dim.copyWith(color: color) : dim,
),
], indent: true),
];
}
/// The running status: the pending dots, then what the turn is doing and
/// for how long, in the accent colour.
Widget _live(BuildContext context, TextStyle style) {
final accent =
AppDesignTokens.of(context).ansi?.yellow ??
Theme.of(context).colorScheme.primary;
return Row(
children: [
SizedBox(
width: terminalGlyphColumn(context),
child: ExcludeSemantics(
child: DefaultTextStyle.merge(
style: TextStyle(color: accent),
child: const Align(
alignment: AlignmentDirectional.centerStart,
child: ChatResponsePending(),
),
),
),
),
Flexible(
child: Text(
'${data.label}… (${seconds}s)',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: style.copyWith(color: accent),
),
),
],
);
}
Widget _line(
BuildContext context,
TerminalGlyphKind? glyph,
Color glyphColor,
List<TextSpan> spans, {
bool indent = false,
}) {
final column = terminalGlyphColumn(context);
return Padding(
padding: EdgeInsetsDirectional.only(start: indent ? column * 0.5 : 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (glyph == null)
SizedBox(width: column)
else
TerminalGlyph(glyph, color: glyphColor),
Flexible(
child: Text.rich(
TextSpan(children: spans),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
);
}
}
@@ -0,0 +1,101 @@
import 'package:flutter/material.dart';
/// The width of a terminal transcript's glyph column: about two monospace
/// cells of the ambient text, so lines after a glyph align like a CLI's.
double terminalGlyphColumn(BuildContext context) {
final style = DefaultTextStyle.of(context).style;
final size = MediaQuery.textScalerOf(context).scale(style.fontSize ?? 14);
return size * 1.3;
}
/// The height of one line of the ambient text, so a painted glyph centres on
/// the first line of the text beside it.
double terminalLineHeight(BuildContext context, [TextStyle? style]) {
final ambient = style ?? DefaultTextStyle.of(context).style;
final size = MediaQuery.textScalerOf(context).scale(ambient.fontSize ?? 14);
return size * (ambient.height ?? 1.35);
}
/// The kind of mark a terminal transcript draws in its glyph column. They
/// are painted rather than typed: the bundled monospace family has no
/// record (U+25CF) or bracket corner (U+23BF), and the web engine would
/// otherwise fetch a fallback font for them.
enum TerminalGlyphKind {
/// A filled dot: an answer, or a tool call (its colour gives the status).
dot,
/// A bracket corner under a call: its result line.
elbow,
}
/// One painted terminal glyph, a glyph column wide and one text line tall,
/// in [color].
class TerminalGlyph extends StatelessWidget {
const TerminalGlyph(this.kind, {super.key, required this.color, this.style});
final TerminalGlyphKind kind;
final Color color;
/// The text the glyph sits beside; the ambient style when null.
final TextStyle? style;
@override
Widget build(BuildContext context) => ExcludeSemantics(
child: SizedBox(
width: terminalGlyphColumn(context),
height: terminalLineHeight(context, style),
child: CustomPaint(painter: _GlyphPainter(kind, color)),
),
);
}
class _GlyphPainter extends CustomPainter {
const _GlyphPainter(this.kind, this.color);
final TerminalGlyphKind kind;
final Color color;
@override
void paint(Canvas canvas, Size size) {
final h = size.height;
final paint = Paint()
..color = color
..isAntiAlias = true;
switch (kind) {
case TerminalGlyphKind.dot:
canvas.drawCircle(Offset(h * 0.3, h / 2), h * 0.17, paint);
case TerminalGlyphKind.elbow:
paint
..style = PaintingStyle.stroke
..strokeWidth = 1;
final x = h * 0.3;
final path = Path()
..moveTo(x, 0)
..lineTo(x, h * 0.55)
..lineTo(size.width * 0.95, h * 0.55);
canvas.drawPath(path, paint);
}
}
@override
bool shouldRepaint(_GlyphPainter old) =>
old.kind != kind || old.color != color;
}
/// [child] after a [glyph] in the glyph column, the glyph centred on the
/// child's first line.
class TerminalGlyphRow extends StatelessWidget {
const TerminalGlyphRow({super.key, required this.glyph, required this.child});
final Widget glyph;
final Widget child;
@override
Widget build(BuildContext context) => Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
glyph,
Expanded(child: child),
],
);
}
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import '../../../../../ui/theme/app_design_tokens.dart';
import '../../sessions/chat_color_palette.dart';
import '../chat_message_bubble.dart';
/// How strongly a coloured chat's shade washes a prompt line's band.
const double terminalPromptTint = 0.1;
/// The operator's turn under a terminal design: a prompt line, the prompt
/// glyph then the message, over a faint band with a dim gutter on its
/// leading edge (in the chat's colour when it has one). It spans the reading
/// column instead of shrinking into a bubble.
class TerminalPromptLine extends StatelessWidget {
const TerminalPromptLine({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
final tokens = AppDesignTokens.of(context);
final scheme = Theme.of(context).colorScheme;
final shade = chatColorShade(context, ChatBubbleColor.of(context));
final gutter = shade ?? scheme.outline;
final glyph = shade ?? scheme.primary;
return Material(
key: const Key('chat-terminal-prompt-line'),
// A faint wash of the chat's colour: its gutter and glyph carry it.
color: shade == null
? scheme.surfaceContainerLow
: Color.alphaBlend(
shade.withValues(alpha: terminalPromptTint),
scheme.surfaceContainerLow,
),
shape: BorderDirectional(start: BorderSide(color: gutter, width: 2)),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(10, 6, 12, 6),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ExcludeSemantics(
child: Padding(
padding: const EdgeInsetsDirectional.only(end: 10),
child: Text(
tokens.promptGlyph,
style: chatMessageTextStyle(
context,
)?.copyWith(color: glyph, fontWeight: FontWeight.w700),
),
),
),
Flexible(child: child),
],
),
),
);
}
}