style(mine): 收紧 VIP 入口并统一徽记视觉

This commit is contained in:
Zhou Weidong committed 2026-11-17 09:56:36 +08:00
1 parent fe0e77775e
commit 52e1883862
8 files changed
+251 -250

No files matched your search

+55 -1
View File
@@ -1,6 +1,8 @@
// Author: fruit.com.cn
// 绘制个人数据区统一的红色叠层质感图标。
import 'dart:math' as math;
import 'package:flutter/material.dart';
import '../../../core/theme/app_colors.dart';
@@ -57,10 +59,31 @@ class MineStatIcon extends StatelessWidget {
}
}
/// VIP 专用徽记,与个人数据图标共享红色叠层绘制语言。
class MineVipEmblem extends StatelessWidget {
/// 绘制会员主视觉。
const MineVipEmblem({super.key});
@override
Widget build(BuildContext context) {
return SizedBox.square(
dimension: AppDimens.mineVipCrownSize,
child: DecoratedBox(
decoration: const BoxDecoration(
gradient: RadialGradient(
colors: [AppColors.mineStatGlow, AppColors.transparent],
),
),
child: const CustomPaint(painter: _MineStatPainter(null)),
),
);
}
}
class _MineStatPainter extends CustomPainter {
const _MineStatPainter(this.type);
final MineStatIconType type;
final MineStatIconType? type;
@override
void paint(Canvas canvas, Size size) {
@@ -81,6 +104,8 @@ class _MineStatPainter extends CustomPainter {
case MineStatIconType.favorites:
_tilt(canvas, _bookmarkTilt);
_bookmark(canvas);
case null:
_vip(canvas);
}
canvas.restore();
}
@@ -159,6 +184,35 @@ class _MineStatPainter extends CustomPainter {
_reflection(canvas, reflectionStart, reflectionEnd);
}
void _vip(Canvas canvas) {
const backBounds = Rect.fromLTWH(12, 5, 32, 32);
const frontBounds = Rect.fromLTWH(4, 9, 36, 36);
const center = Offset(22, 27);
const double innerRadius = 14;
const double starOuter = 9;
const double starInner = 4;
const int points = 5;
final turn = 2 * math.pi;
final startAngle = -math.pi / 2;
_surface(canvas, Path()..addOval(backBounds), backBounds, _backGradient);
_surface(canvas, Path()..addOval(frontBounds), frontBounds, _faceGradient);
canvas.drawCircle(
center,
innerRadius,
Paint()
..color = AppColors.mineStatEdge
..style = PaintingStyle.stroke
..strokeWidth = _ringWidth,
);
final star = <Offset>[];
for (var index = 0; index < points * 2; index++) {
final angle = startAngle + turn * index / (points * 2);
final radius = index.isEven ? starOuter : starInner;
star.add(center + Offset(math.cos(angle), math.sin(angle)) * radius);
}
canvas.drawPath(_polygon(star), Paint()..color = AppColors.mineStatGlint);
}
void _surface(Canvas canvas, Path path, Rect bounds, Gradient gradient) {
canvas.save();
canvas.translate(0, _depth);