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:
@@ -0,0 +1,61 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../ui/theme/app_design.dart';
|
||||
import '../../ui/theme/app_design_controller.dart';
|
||||
import 'settings_group.dart';
|
||||
import 'settings_theme.dart';
|
||||
|
||||
const designSectionTitle = 'Design';
|
||||
const designSectionFooter =
|
||||
'Saved on this device only and applied at once. Light and dark follow '
|
||||
'the system under every design; Terminal uses its monospace font '
|
||||
'instead of the Font choice below.';
|
||||
const designSaveFailedText =
|
||||
'Not saved on this device; it applies until reload.';
|
||||
|
||||
ValueKey<String> settingsDesignKey(AppDesign design) =>
|
||||
ValueKey<String>('settings-design-${design.id}');
|
||||
|
||||
/// The device's app-wide design: one radio row per [AppDesign], each with a
|
||||
/// one-line summary. A choice applies at once, without a restart.
|
||||
class SettingsDesignSection extends StatelessWidget {
|
||||
const SettingsDesignSection({super.key, required this.controller});
|
||||
|
||||
final AppDesignController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ListenableBuilder(
|
||||
listenable: controller,
|
||||
builder: (context, _) => RadioGroup<AppDesign>(
|
||||
groupValue: controller.design,
|
||||
onChanged: (design) {
|
||||
if (design != null) unawaited(controller.select(design));
|
||||
},
|
||||
child: SettingsGroup(
|
||||
title: designSectionTitle,
|
||||
footer: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Text(designSectionFooter),
|
||||
if (controller.saveFailed)
|
||||
Text(
|
||||
designSaveFailedText,
|
||||
style: TextStyle(color: settingsErrorColor(context)),
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
for (final design in AppDesign.values)
|
||||
RadioListTile<AppDesign>(
|
||||
key: settingsDesignKey(design),
|
||||
value: design,
|
||||
title: Text(design.label),
|
||||
subtitle: Text(design.description),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../ui/theme/app_design_tokens.dart';
|
||||
|
||||
import 'settings_layout.dart';
|
||||
|
||||
@@ -31,6 +32,7 @@ class SettingsGroup extends StatelessWidget {
|
||||
final title = this.title;
|
||||
final footer = this.footer;
|
||||
final theme = Theme.of(context);
|
||||
final tokens = AppDesignTokens.of(context);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
@@ -50,10 +52,17 @@ class SettingsGroup extends StatelessWidget {
|
||||
if (children.isNotEmpty)
|
||||
Material(
|
||||
type: MaterialType.card,
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
color: tokens.flat
|
||||
? theme.colorScheme.surfaceContainerLow
|
||||
: theme.colorScheme.surfaceContainer,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(settingsGroupRadius),
|
||||
borderRadius: tokens.corners(
|
||||
BorderRadius.circular(settingsGroupRadius),
|
||||
),
|
||||
side: tokens.frame == null
|
||||
? BorderSide.none
|
||||
: BorderSide(color: tokens.frame!),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
|
||||
@@ -28,6 +28,14 @@ extension _SettingsPageSections on _SettingsScreenState {
|
||||
widget.animationSpeed ?? AnimationSpeedController.instance,
|
||||
),
|
||||
),
|
||||
SettingsSection(
|
||||
id: 'design',
|
||||
title: designSectionTitle,
|
||||
keywords: 'design theme look style terminal monospace appearance',
|
||||
builder: (_) => SettingsDesignSection(
|
||||
controller: widget.designs ?? AppDesignController.instance,
|
||||
),
|
||||
),
|
||||
SettingsSection(
|
||||
id: 'font',
|
||||
title: fontSectionTitle,
|
||||
|
||||
@@ -11,10 +11,12 @@ import '../attention/notify/notification_controller.dart';
|
||||
import '../attention/notify/notification_models.dart';
|
||||
import 'default_endpoint.dart';
|
||||
import 'settings_controller.dart';
|
||||
import 'settings_design_section.dart';
|
||||
import 'settings_font_section.dart';
|
||||
import 'settings_animation_section.dart';
|
||||
import 'settings_scale_section.dart';
|
||||
import '../../ui/motion/animation_speed.dart';
|
||||
import '../../ui/theme/app_design_controller.dart';
|
||||
import '../../ui/theme/app_font_controller.dart';
|
||||
import 'settings_group.dart';
|
||||
import 'storage/settings_storage_section.dart';
|
||||
@@ -72,6 +74,7 @@ class SettingsScreen extends StatefulWidget {
|
||||
this.deliveryService,
|
||||
this.deliveryServiceController,
|
||||
this.fonts,
|
||||
this.designs,
|
||||
this.animationSpeed,
|
||||
this.terminalLayout,
|
||||
this.onShowWalkthrough,
|
||||
@@ -83,6 +86,9 @@ class SettingsScreen extends StatefulWidget {
|
||||
|
||||
/// The device's interface font; defaults to the app's shared controller.
|
||||
final AppFontController? fonts;
|
||||
|
||||
/// The device's app-wide design; defaults to the app's shared controller.
|
||||
final AppDesignController? designs;
|
||||
final AnimationSpeedController? animationSpeed;
|
||||
|
||||
/// The terminal surface's layout (its mode is chosen here); null is the
|
||||
|
||||
Reference in New Issue
Block a user