Glass: glass activity chip, rail slab, header fade, cheaper glow, veil baked into the mesh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 00:04:09 +00:00
parent 7bcdb2feae
commit a0380aef51
10 changed files with 91 additions and 47 deletions
@@ -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(
@@ -185,8 +185,21 @@ class _ChatTurnActivityViewState extends State<ChatTurnActivityView> {
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<ChatTurnActivityView> {
: 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,
+5 -1
View File
@@ -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),
);
+3 -7
View File
@@ -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,
+2 -2
View File
@@ -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),
),
+10 -9
View File
@@ -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),
),
+19 -17
View File
@@ -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),
+4 -2
View File
@@ -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
+1 -1
View File
@@ -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,
@@ -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++) {