From d1eba29a4a0cbfd696ee862d4db6ba47a9faf331 Mon Sep 17 00:00:00 2001 From: zarzet <42882290+zarzet@users.noreply.github.com> Date: Thu, 1 Oct 2026 01:29:00 +0700 Subject: [PATCH] fix(mornye): soften glass rims and increase transparency --- lib/theme/mornye_theme.dart | 19 +++++++++++-------- lib/widgets/mornye_chrome.dart | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lib/theme/mornye_theme.dart b/lib/theme/mornye_theme.dart index f7a48dcc..dc996434 100644 --- a/lib/theme/mornye_theme.dart +++ b/lib/theme/mornye_theme.dart @@ -45,15 +45,18 @@ class MornyeTheme extends ThemeExtension { ); } - static double chromeOpacity(BuildContext context) => - Theme.of(context).extension()?.chromeSurface != null - ? 0.42 - : 0.70; + static double chromeOpacity(BuildContext context) { + final theme = Theme.of(context); + if (theme.extension()?.chromeSurface != null) return 0.36; + // Light glass needs more fill to keep dark subtitles readable over black. + return theme.brightness == Brightness.dark ? 0.60 : 0.70; + } - static double navigationOpacity(BuildContext context) => - Theme.of(context).extension()?.chromeSurface != null - ? 0.28 - : 0.54; + static double navigationOpacity(BuildContext context) { + final theme = Theme.of(context); + if (theme.extension()?.chromeSurface != null) return 0.24; + return theme.brightness == Brightness.dark ? 0.44 : 0.54; + } static const lightAccent = Color.fromRGBO(204, 46, 51, 1); static const darkAccent = Color.fromRGBO(224, 61, 60, 1); diff --git a/lib/widgets/mornye_chrome.dart b/lib/widgets/mornye_chrome.dart index aa280301..b9c618f5 100644 --- a/lib/widgets/mornye_chrome.dart +++ b/lib/widgets/mornye_chrome.dart @@ -259,7 +259,7 @@ class MornyeGlass extends StatelessWidget { firstInGroup = true, lastInGroup = true; - /// Shares the navigation bar's tint, blur and visible outer rim. + /// Shares the navigation bar's tint, blur and subtle edge reflections. const MornyeGlass.navigation({ super.key, required this.child, @@ -465,8 +465,8 @@ class _MornyeGlassSurface extends StatelessWidget { } } -/// Static, axis-aligned highlights: bright upper/lower inner edges and a thin -/// shadow at the sides. No offscreen layer, extra blur, or per-frame readback. +/// Faint edge reflections define the glass without a bright capsule outline. +/// No offscreen layer, extra blur, or per-frame readback. class _MornyeGlassRim extends CustomPainter { const _MornyeGlassRim({ required this.shape, @@ -499,24 +499,24 @@ class _MornyeGlassRim extends CustomPainter { Paint() ..style = PaintingStyle.stroke ..strokeWidth = 0.5 - ..color = Colors.black.withValues(alpha: 0.22), + ..color = Colors.black.withValues(alpha: illuminated ? 0.10 : 0.22), ); if (illuminated) { canvas.drawRRect( - outline.deflate(0.9), + outline.deflate(0.8), Paint() ..style = PaintingStyle.stroke - ..strokeWidth = 0.8 + ..strokeWidth = 0.6 ..shader = LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - stops: const [0, 0.18, 0.5, 0.82, 1], + stops: const [0, 0.14, 0.5, 0.86, 1], colors: [ - firstInGroup ? const Color(0x99ffffff) : Colors.transparent, - const Color(0x18ffffff), - const Color(0x30000000), - const Color(0x18ffffff), - lastInGroup ? const Color(0x80ffffff) : Colors.transparent, + firstInGroup ? const Color(0x2effffff) : Colors.transparent, + const Color(0x08ffffff), + const Color(0x0a000000), + const Color(0x08ffffff), + lastInGroup ? const Color(0x1fffffff) : Colors.transparent, ], ).createShader(bounds), );