From a0380aef514796468cc83068929b343951b66499 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 4 Dec 2026 00:04:09 +0000 Subject: [PATCH] Glass: glass activity chip, rail slab, header fade, cheaper glow, veil baked into the mesh Co-Authored-By: Claude Opus 5.5 --- .../chat/conversation/chat_thread_header.dart | 25 +++++++++---- .../transcript/chat_turn_activity_view.dart | 27 ++++++++++++-- app/lib/shell/navigation_rail.dart | 6 +++- app/lib/ui/layout/app_list_row_glow.dart | 10 ++---- app/lib/ui/theme/app_design.dart | 4 +-- app/lib/ui/theme/glass_controls.dart | 19 +++++----- app/lib/ui/theme/glass_palette.dart | 36 ++++++++++--------- app/lib/ui/theme/glass_style.dart | 6 ++-- app/lib/ui/theme/glass_theme.dart | 2 +- app/test/ui/theme/compact_switch_test.dart | 3 ++ 10 files changed, 91 insertions(+), 47 deletions(-) diff --git a/app/lib/features/chat/conversation/chat_thread_header.dart b/app/lib/features/chat/conversation/chat_thread_header.dart index 9c335cd3..a2720fe8 100644 --- a/app/lib/features/chat/conversation/chat_thread_header.dart +++ b/app/lib/features/chat/conversation/chat_thread_header.dart @@ -166,12 +166,25 @@ class ChatThreadHeader extends StatelessWidget { ], bottomPadding: compact ? 8 : 16, ); - // A glass design's header is part of the pane's glass: clear, so - // the pane's tint runs up to the top edge without a band. - return ColoredBox( - color: AppDesignTokens.of(context).glass == null - ? Theme.of(context).colorScheme.surface - : const Color(0x00000000), + // A glass design's header is part of the pane's glass: no band, a + // soft fade from the pane's solid tone at the top edge, so what + // scrolls under the bar dissolves rather than shows through. + final glass = AppDesignTokens.of(context).glass; + return DecoratedBox( + decoration: glass == null + ? BoxDecoration(color: Theme.of(context).colorScheme.surface) + : BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + glass.solid.withValues(alpha: 0.92), + glass.solid.withValues(alpha: 0.6), + glass.solid.withValues(alpha: 0), + ], + stops: const [0, 0.6, 1], + ), + ), child: tint == null ? bar : ChatBarTintScope( diff --git a/app/lib/features/chat/ui/transcript/chat_turn_activity_view.dart b/app/lib/features/chat/ui/transcript/chat_turn_activity_view.dart index 98dbfcc7..7b80fc73 100644 --- a/app/lib/features/chat/ui/transcript/chat_turn_activity_view.dart +++ b/app/lib/features/chat/ui/transcript/chat_turn_activity_view.dart @@ -185,8 +185,21 @@ class _ChatTurnActivityViewState extends State { final button = TextButton( key: const Key('chat-turn-activity'), style: TextButton.styleFrom( - minimumSize: Size(0, dense ? math.max(28, density.minTouchRow) : 48), - padding: dense + minimumSize: Size( + 0, + dense + ? math.max(28, density.minTouchRow) + // A glass chip is slim on a pointer device. + : tokens.glass != null && compact + ? 36 + : 48, + ), + padding: tokens.glass != null && !dense + ? const EdgeInsets.symmetric( + horizontal: chatAgentContentInset, + vertical: 6, + ) + : dense ? const EdgeInsets.symmetric( horizontal: chatAgentContentInset, vertical: 4, @@ -194,6 +207,16 @@ class _ChatTurnActivityViewState extends State { : const EdgeInsets.all(chatAgentContentInset), tapTargetSize: MaterialTapTargetSize.shrinkWrap, alignment: AlignmentDirectional.centerStart, + // A glass design draws the line as a slim glass chip. + backgroundColor: tokens.glass?.card, + shape: switch (tokens.glass) { + final glass? => GlassBorder( + borderRadius: const BorderRadius.all(Radius.circular(12)), + highlight: glass.highlight, + edge: glass.edge, + ), + null => null, + }, ), onPressed: _open, child: content, diff --git a/app/lib/shell/navigation_rail.dart b/app/lib/shell/navigation_rail.dart index 8f2c18c1..93367602 100644 --- a/app/lib/shell/navigation_rail.dart +++ b/app/lib/shell/navigation_rail.dart @@ -178,7 +178,11 @@ class _SettingsRailItem extends StatelessWidget { alignment: Alignment.center, decoration: ShapeDecoration( shape: AppDesignTokens.of(context).shape(const StadiumBorder()), - color: selected ? scheme.secondaryContainer : null, + // A glass design's rail marks its item with a bright glass slab. + color: selected + ? AppDesignTokens.of(context).glass?.slab ?? + scheme.secondaryContainer + : null, ), child: Icon(item.icon, color: foreground), ); diff --git a/app/lib/ui/layout/app_list_row_glow.dart b/app/lib/ui/layout/app_list_row_glow.dart index 5f1b3c8e..8faf8ee6 100644 --- a/app/lib/ui/layout/app_list_row_glow.dart +++ b/app/lib/ui/layout/app_list_row_glow.dart @@ -86,17 +86,13 @@ class AppListRowGlow extends StatelessWidget { // covers most of it. decoration: BoxDecoration( borderRadius: _corners, + // One small blur: a CPU rasteriser redraws it every frame. boxShadow: selected ? [ BoxShadow( color: accent.withValues(alpha: glass.glow), - blurRadius: 16, - spreadRadius: -2, - ), - BoxShadow( - color: glass.shadow, - blurRadius: 6, - offset: const Offset(0, 2), + blurRadius: 10, + offset: const Offset(0, 1), ), ] : null, diff --git a/app/lib/ui/theme/app_design.dart b/app/lib/ui/theme/app_design.dart index fff39478..18e81dc8 100644 --- a/app/lib/ui/theme/app_design.dart +++ b/app/lib/ui/theme/app_design.dart @@ -176,12 +176,12 @@ enum AppDesign { glass => dark ? const DesignSwatch( - Color(0xFF0E101C), + Color(0xFF101220), Color(0xFFE9E9F4), Color(0xFFB9B0FF), ) : const DesignSwatch( - Color(0xFFECEEF8), + Color(0xFFF2F3FA), Color(0xFF1A1A2B), Color(0xFF5546C7), ), diff --git a/app/lib/ui/theme/glass_controls.dart b/app/lib/ui/theme/glass_controls.dart index a83c37d3..e3b5fb3e 100644 --- a/app/lib/ui/theme/glass_controls.dart +++ b/app/lib/ui/theme/glass_controls.dart @@ -94,7 +94,7 @@ ThemeData glassControls(ThemeData base, GlassSurfaces surfaces) { filled: false, border: OutlineInputBorder( borderRadius: fieldCorners, - borderSide: BorderSide(color: scheme.outline), + borderSide: BorderSide(color: scheme.outline.withValues(alpha: 0.5)), ), ), searchBarTheme: SearchBarThemeData( @@ -116,14 +116,15 @@ ThemeData glassControls(ThemeData base, GlassSurfaces surfaces) { labelColor: scheme.onSurface, unselectedLabelColor: scheme.onSurfaceVariant, indicatorSize: TabBarIndicatorSize.tab, - indicator: _tabIndicators[( - scheme.secondaryContainer, - style.highlight, - style.edge, - )] ??= ShapeDecoration( - color: scheme.secondaryContainer, - shape: surfaces.edge(GlassRadii.small), - ), + indicator: + _tabIndicators[( + scheme.secondaryContainer, + style.highlight, + style.edge, + )] ??= ShapeDecoration( + color: scheme.secondaryContainer, + shape: surfaces.edge(GlassRadii.small), + ), splashBorderRadius: const BorderRadius.all( Radius.circular(GlassRadii.small), ), diff --git a/app/lib/ui/theme/glass_palette.dart b/app/lib/ui/theme/glass_palette.dart index 0f96f26b..a22a974b 100644 --- a/app/lib/ui/theme/glass_palette.dart +++ b/app/lib/ui/theme/glass_palette.dart @@ -24,19 +24,21 @@ const AnsiAccents glassDarkAccents = AnsiAccents( ); /// Light glass: a pale lavender, peach, sky and mint mesh under frosted -/// white panes. +/// white panes. The list pane's veil (white at 32%) is baked into the mesh's +/// colours, so the rail and the list draw no tint of their own: one image +/// draw per frame, not a full-window blend on top of it. const GlassStyle glassLightStyle = GlassStyle( backdrop: GlassBackdropMesh( - base: Color(0xFFECEEF8), + base: Color(0xFFF2F3FA), glows: [ - GlassGlow(Alignment(-1, -1), 0.95, Color(0xFFD9D0FF)), - GlassGlow(Alignment(1, -0.85), 0.8, Color(0xFFFFDCCB)), - GlassGlow(Alignment(-0.8, 1), 0.85, Color(0xFFC8E3FF)), - GlassGlow(Alignment(1, 1), 0.75, Color(0xFFCDEFE2)), + GlassGlow(Alignment(-1, -1), 0.95, Color(0xFFE5DFFF)), + GlassGlow(Alignment(1, -0.85), 0.8, Color(0xFFFFE7DC)), + GlassGlow(Alignment(-0.8, 1), 0.85, Color(0xFFDAECFF)), + GlassGlow(Alignment(1, 1), 0.75, Color(0xFFDDF4EB)), ], ), - rail: Color(0x1FFFFFFF), - pane: Color(0x52FFFFFF), + rail: Color(0x00000000), + pane: Color(0x00000000), detail: Color(0x80FFFFFF), bar: Color(0xB8FCFCFF), solid: Color(0xFFF7F7FC), @@ -49,19 +51,19 @@ const GlassStyle glassLightStyle = GlassStyle( ); /// Dark glass: a deep indigo, plum, teal and night-blue mesh under smoked -/// glass panes. +/// glass panes, the list pane's smoke (30%) baked into its colours. const GlassStyle glassDarkStyle = GlassStyle( backdrop: GlassBackdropMesh( - base: Color(0xFF0E101C), + base: Color(0xFF101220), glows: [ - GlassGlow(Alignment(-1, -1), 0.95, Color(0xFF2A2766)), - GlassGlow(Alignment(1, -0.85), 0.8, Color(0xFF3A1D4C)), - GlassGlow(Alignment(-0.8, 1), 0.85, Color(0xFF0E3846)), - GlassGlow(Alignment(1, 1), 0.75, Color(0xFF172A5A)), + GlassGlow(Alignment(-1, -1), 0.95, Color(0xFF242254)), + GlassGlow(Alignment(1, -0.85), 0.8, Color(0xFF2F1B41)), + GlassGlow(Alignment(-0.8, 1), 0.85, Color(0xFF102E3D)), + GlassGlow(Alignment(1, 1), 0.75, Color(0xFF16254B)), ], ), - rail: Color(0x2E0B0D18), - pane: Color(0x4D151829), + rail: Color(0x00000000), + pane: Color(0x00000000), detail: Color(0x8C121524), bar: Color(0xC2262A40), solid: Color(0xFF1C1F31), @@ -100,7 +102,7 @@ ColorScheme glassColorScheme(Brightness brightness) { surface: Color(0xFF141627), onSurface: Color(0xFFE9E9F4), onSurfaceVariant: Color(0xFFB9BAD0), - surfaceDim: Color(0xFF0E101C), + surfaceDim: Color(0xFF101220), surfaceBright: Color(0xFF3A3E5C), surfaceContainerLowest: Color(0x99101222), surfaceContainerLow: Color(0x6B2A2E48), diff --git a/app/lib/ui/theme/glass_style.dart b/app/lib/ui/theme/glass_style.dart index 46406088..73734ac8 100644 --- a/app/lib/ui/theme/glass_style.dart +++ b/app/lib/ui/theme/glass_style.dart @@ -73,10 +73,12 @@ class GlassStyle { /// The gradient behind every page. final GlassBackdropMesh backdrop; - /// The navigation rail's tint over the backdrop. + /// The navigation rail's tint over the backdrop; clear when the backdrop + /// already carries it. final Color rail; - /// A list pane's tint over the backdrop. + /// A list pane's tint over the backdrop; clear when the backdrop already + /// carries it (cheaper: no full-window blend per frame). final Color pane; /// The open item's (reading) pane: a stronger tint, so long text reads on diff --git a/app/lib/ui/theme/glass_theme.dart b/app/lib/ui/theme/glass_theme.dart index 4047e0c3..60cd621f 100644 --- a/app/lib/ui/theme/glass_theme.dart +++ b/app/lib/ui/theme/glass_theme.dart @@ -170,7 +170,7 @@ ThemeData glassTheme(Brightness brightness, {String? fontFamily}) { navigationRailTheme: NavigationRailThemeData( backgroundColor: _clear, elevation: 0, - indicatorColor: scheme.secondaryContainer, + indicatorColor: style.slab, ), navigationBarTheme: NavigationBarThemeData( backgroundColor: style.bar, diff --git a/app/test/ui/theme/compact_switch_test.dart b/app/test/ui/theme/compact_switch_test.dart index cc34a60e..3eb514a2 100644 --- a/app/test/ui/theme/compact_switch_test.dart +++ b/app/test/ui/theme/compact_switch_test.dart @@ -106,7 +106,10 @@ void main() { AppDesign.standard, AppDesign.terminal, AppDesign.paper, + // Glass blends with the comfortable designs and snaps to Compact. + AppDesign.glass, AppDesign.compact, + AppDesign.glass, ]) { design.value = other; for (var f = 0; f < 20; f++) {