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:
@@ -1,6 +1,7 @@
|
||||
import '../ui/adaptive/window_margins.dart';
|
||||
import '../ui/theme/app_design.dart';
|
||||
import '../ui/theme/app_design_controller.dart';
|
||||
import '../ui/theme/app_font_controller.dart';
|
||||
import '../ui/theme/app_theme.dart';
|
||||
import '../ui/scale/ui_scale.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -19,6 +20,7 @@ class MyApp extends StatelessWidget {
|
||||
this.destination,
|
||||
this.onDestinationSelected,
|
||||
this.fonts,
|
||||
this.designs,
|
||||
}) : routerConfig = null;
|
||||
|
||||
/// A host for a [Router]-owned location, so browser Back/Forward and deep
|
||||
@@ -28,6 +30,7 @@ class MyApp extends StatelessWidget {
|
||||
super.key,
|
||||
required RouterConfig<Object> this.routerConfig,
|
||||
this.fonts,
|
||||
this.designs,
|
||||
}) : destinationBodies = const {},
|
||||
destination = null,
|
||||
onDestinationSelected = null;
|
||||
@@ -42,24 +45,29 @@ class MyApp extends StatelessWidget {
|
||||
/// A change rebuilds the themes in place, without a restart.
|
||||
final AppFontController? fonts;
|
||||
|
||||
/// The device's design; defaults to the app's shared controller. A change
|
||||
/// rebuilds the themes in place, like a font change.
|
||||
final AppDesignController? designs;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final fonts = this.fonts ?? AppFontController.instance;
|
||||
final designs = this.designs ?? AppDesignController.instance;
|
||||
return ListenableBuilder(
|
||||
listenable: fonts,
|
||||
builder: (context, _) => _host(fonts.family),
|
||||
listenable: Listenable.merge([fonts, designs]),
|
||||
builder: (context, _) => _host(designs.design, fonts.family),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _host(String? fontFamily) {
|
||||
Widget _host(AppDesign design, String? fontFamily) {
|
||||
final router = routerConfig;
|
||||
if (router != null) {
|
||||
return MaterialApp.router(
|
||||
title: 'Pipelines',
|
||||
scaffoldMessengerKey: appScaffoldMessengerKey,
|
||||
builder: _scaled,
|
||||
theme: appLightTheme(fontFamily: fontFamily),
|
||||
darkTheme: appDarkTheme(fontFamily: fontFamily),
|
||||
theme: design.light(fontFamily: fontFamily),
|
||||
darkTheme: design.dark(fontFamily: fontFamily),
|
||||
themeMode: ThemeMode.system,
|
||||
routerConfig: router,
|
||||
);
|
||||
@@ -68,8 +76,8 @@ class MyApp extends StatelessWidget {
|
||||
title: 'Pipelines',
|
||||
scaffoldMessengerKey: appScaffoldMessengerKey,
|
||||
builder: _scaled,
|
||||
theme: appLightTheme(fontFamily: fontFamily),
|
||||
darkTheme: appDarkTheme(fontFamily: fontFamily),
|
||||
theme: design.light(fontFamily: fontFamily),
|
||||
darkTheme: design.dark(fontFamily: fontFamily),
|
||||
themeMode: ThemeMode.system,
|
||||
home: AdaptiveShell(
|
||||
destinationBodies: destinationBodies,
|
||||
|
||||
Reference in New Issue
Block a user