ca2f7eee32
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>
61 lines
2.0 KiB
Dart
61 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
import 'app_design_tokens.dart';
|
||
import 'app_theme.dart';
|
||
import 'terminal_theme.dart';
|
||
|
||
/// An app-wide design: how every surface is shaped, typed and coloured, not
|
||
/// only a colour. Each design builds a light and a dark [ThemeData] carrying
|
||
/// its [AppDesignTokens], so widgets that draw design-specific shapes read the
|
||
/// tokens instead of hard-coding one look.
|
||
///
|
||
/// Adding a design means one more value here and its theme builder; the
|
||
/// Settings picker lists [AppDesign.values].
|
||
enum AppDesign {
|
||
/// The app's own Material look.
|
||
standard('default', 'Default', 'The app’s Material look.'),
|
||
|
||
/// A terminal-style look: monospace text, near-black pages, thin frames
|
||
/// and a transcript drawn as prompt and tool lines.
|
||
terminal(
|
||
'terminal',
|
||
'Terminal',
|
||
'Monospace, flat frames and prompt-style chat, like a CLI agent.',
|
||
);
|
||
|
||
const AppDesign(this.id, this.label, this.description);
|
||
|
||
/// The stored value; stable across releases and renames.
|
||
final String id;
|
||
|
||
/// The picker's name for the design.
|
||
final String label;
|
||
|
||
/// The picker's one-line summary of the design.
|
||
final String description;
|
||
|
||
/// The design stored as [id], or [standard] for an unknown or missing id.
|
||
static AppDesign fromId(String? id) {
|
||
for (final design in values) {
|
||
if (design.id == id) return design;
|
||
}
|
||
return standard;
|
||
}
|
||
|
||
/// The design's light theme. [fontFamily] is the device's interface font;
|
||
/// a design with its own family (Terminal's monospace) keeps that instead.
|
||
ThemeData light({String? fontFamily}) => switch (this) {
|
||
standard => appLightTheme(fontFamily: fontFamily),
|
||
terminal => terminalTheme(Brightness.light),
|
||
};
|
||
|
||
/// The design's dark theme; see [light].
|
||
ThemeData dark({String? fontFamily}) => switch (this) {
|
||
standard => appDarkTheme(fontFamily: fontFamily),
|
||
terminal => terminalTheme(Brightness.dark),
|
||
};
|
||
|
||
/// Whether the device's interface font applies under this design.
|
||
bool get usesInterfaceFont => this == standard;
|
||
}
|