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
@@ -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) => [