refine: add milky translucency and curved reflections to Dock

This commit is contained in:
Codex
2026-10-24 20:16:34 +08:00
parent 8abb132bc3
commit db953b8b3d
8 changed files with 84 additions and 32 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
const appVersion = '0.7.8';
const appBuildNumber = 26;
const appBuildNumber = 27;
const appFilingNumber = '蜀ICP备2025169276号-5A';
+16 -16
View File
@@ -142,9 +142,9 @@ class _GlassDockState extends State<GlassDock> with TickerProviderStateMixin {
)!,
]
: [
Colors.white.withValues(alpha: 0.05),
_blue.withValues(alpha: 0.008),
Colors.white.withValues(alpha: 0.018),
Colors.white.withValues(alpha: 0.24),
const Color(0xFFF9FBFF).withValues(alpha: 0.12),
Colors.white.withValues(alpha: 0.18),
],
),
),
@@ -154,8 +154,8 @@ class _GlassDockState extends State<GlassDock> with TickerProviderStateMixin {
return ClipRRect(
borderRadius: BorderRadius.circular(40),
child: GlassRefraction(
strength: lens ? 0.70 + pressure * 0.70 : 0.95,
blurSigma: lens ? 1.6 - pressure * 0.6 : 1.4,
strength: lens ? 0.78 + pressure * 0.70 : 1.05,
blurSigma: lens ? 1.6 - pressure * 0.6 : 1.5,
child: content,
),
);
@@ -188,8 +188,8 @@ class _GlassDockState extends State<GlassDock> with TickerProviderStateMixin {
boxShadow: [
BoxShadow(
color: const Color(0xFF4C6078).withValues(alpha: 0.075),
blurRadius: 16,
offset: const Offset(0, 5),
blurRadius: 18,
offset: const Offset(0, 6),
),
],
),
@@ -352,15 +352,15 @@ class _GlassDockState extends State<GlassDock> with TickerProviderStateMixin {
);
}
/// A diffuse silver bevel and thin directional glints show optical thickness.
/// The painted highlights stay on the edge so background colour passes through.
/// A white, rounded bevel catches light around a translucent milky body.
/// Highlights stay at the edge; the backdrop remains visible beneath the glass.
class _GlassRimPainter extends CustomPainter {
const _GlassRimPainter({required this.lens, required this.pressure});
final bool lens;
final double pressure;
@override
void paint(Canvas canvas, Size size) {
final edge = lens ? const Color(0xFF7B838F) : const Color(0xFFAFBECF);
final edge = lens ? const Color(0xFF7B838F) : const Color(0xFF9CAABD);
// A quiet grey selection at rest; the glossy lens rim returns on touch.
final opacity = lens ? 0.25 + pressure * 0.75 : 1.0;
final bounds = Offset.zero & size;
@@ -376,15 +376,15 @@ class _GlassRimPainter extends CustomPainter {
outer,
Paint()
..style = PaintingStyle.stroke
..strokeWidth = lens ? 1.8 : 2.2
..maskFilter = MaskFilter.blur(BlurStyle.normal, lens ? 0.9 : 0.45)
..strokeWidth = lens ? 1.8 : 2.8
..maskFilter = MaskFilter.blur(BlurStyle.normal, lens ? 0.9 : 0.65)
..shader = ui.Gradient.linear(
bounds.topLeft,
bounds.bottomRight,
[
Colors.white.withValues(alpha: 0.24 * opacity),
Colors.white.withValues(alpha: (lens ? 0.24 : 0.42) * opacity),
edge.withValues(alpha: 0.04 * opacity),
Colors.white.withValues(alpha: 0.14 * opacity),
Colors.white.withValues(alpha: (lens ? 0.14 : 0.30) * opacity),
],
[0.0, 0.55, 1.0],
),
@@ -419,9 +419,9 @@ class _GlassRimPainter extends CustomPainter {
bounds.topLeft,
bounds.bottomRight,
[
Colors.white.withValues(alpha: 0.20 * opacity),
Colors.white.withValues(alpha: (lens ? 0.20 : 0.34) * opacity),
edge.withValues(alpha: (lens ? 0.13 : 0.07) * opacity),
Colors.white.withValues(alpha: 0.28 * opacity),
Colors.white.withValues(alpha: (lens ? 0.28 : 0.40) * opacity),
],
[0.0, 0.5, 1.0],
),