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,8 @@
|
||||
import 'dart:ui' show SemanticsRole;
|
||||
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
import '../theme/app_design_tokens.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../motion/motion.dart';
|
||||
@@ -109,18 +111,22 @@ class FloatingTabButton extends StatelessWidget {
|
||||
({Color tint, Color selectedIcon, Color icon}) colors,
|
||||
double t,
|
||||
) {
|
||||
// A flat design (Terminal) squares the button and its fill.
|
||||
final shape = AppDesignTokens.of(context).shape(const CircleBorder());
|
||||
final decoration = ShapeDecoration(
|
||||
color: colors.tint.withValues(alpha: colors.tint.a * t),
|
||||
shape: const CircleBorder(),
|
||||
shape: shape,
|
||||
);
|
||||
final Widget fill = Ink(
|
||||
key: fillKey,
|
||||
decoration: decoration,
|
||||
child: InkResponse(
|
||||
onTap: enabled ? onTap : null,
|
||||
customBorder: const CircleBorder(),
|
||||
customBorder: shape,
|
||||
containedInkWell: true,
|
||||
highlightShape: BoxShape.circle,
|
||||
highlightShape: shape is CircleBorder
|
||||
? BoxShape.circle
|
||||
: BoxShape.rectangle,
|
||||
),
|
||||
);
|
||||
Widget glyph = IconTheme.merge(
|
||||
@@ -147,7 +153,7 @@ class FloatingTabButton extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GlassPill(shape: const CircleBorder(), child: fill),
|
||||
child: GlassPill(shape: shape, child: fill),
|
||||
),
|
||||
IgnorePointer(child: glyph),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_design_tokens.dart';
|
||||
import 'glass_surface.dart';
|
||||
|
||||
/// A frosted-glass piece floating over content: the content behind is
|
||||
@@ -60,20 +61,28 @@ class GlassPill extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _build(BuildContext context, double reveal, Widget child) {
|
||||
final solid = MediaQuery.maybeHighContrastOf(context) ?? false;
|
||||
// A flat design (Terminal) draws a solid piece in its own corners with
|
||||
// its 1px frame: no blur, highlight, rim or shadow.
|
||||
final tokens = AppDesignTokens.of(context);
|
||||
final flat = tokens.flat;
|
||||
final solid = flat || (MediaQuery.maybeHighContrastOf(context) ?? false);
|
||||
final shape = tokens.shape(this.shape);
|
||||
final textDirection = Directionality.maybeOf(context);
|
||||
final Color base;
|
||||
final Color edge;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
base = scheme.surfaceContainerHigh;
|
||||
edge = scheme.outlineVariant;
|
||||
base = flat ? scheme.surfaceContainerLow : scheme.surfaceContainerHigh;
|
||||
edge = flat ? tokens.frame ?? scheme.outline : scheme.outlineVariant;
|
||||
final opaque = fill ?? (solid ? base : base.withValues(alpha: fillOpacity));
|
||||
final color = opaque.withValues(alpha: opaque.a * reveal);
|
||||
final look = GlassLook.forFill(opaque);
|
||||
Color faded(Color c, [double by = 1]) =>
|
||||
c.withValues(alpha: c.a * by * reveal);
|
||||
final border = shape.copyWith(
|
||||
side: BorderSide(color: faded(edge, solid ? 1 : 0.6), width: 0.5),
|
||||
side: BorderSide(
|
||||
color: faded(edge, solid ? 1 : 0.6),
|
||||
width: flat ? 1 : 0.5,
|
||||
),
|
||||
);
|
||||
Widget content = Material(type: MaterialType.transparency, child: child);
|
||||
if (!solid) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_design_tokens.dart';
|
||||
import 'package:flutter/physics.dart';
|
||||
|
||||
import '../motion/motion.dart';
|
||||
@@ -122,7 +123,7 @@ class _SegmentedPressState extends State<SegmentedPress>
|
||||
child: DecoratedBox(
|
||||
position: DecorationPosition.foreground,
|
||||
decoration: ShapeDecoration(
|
||||
shape: const StadiumBorder(),
|
||||
shape: AppDesignTokens.of(context).shape(const StadiumBorder()),
|
||||
color: tint.withValues(
|
||||
alpha:
|
||||
tint.a *
|
||||
|
||||
Reference in New Issue
Block a user