style(mine): 收紧 VIP 入口并统一徽记视觉
This commit is contained in:
1 parent
fe0e77775e
commit
52e1883862
8 files changed
+207
-206
No files matched your search
@@ -61,6 +61,8 @@ abstract final class AppColors {
|
||||
static const vipCardStart = Color(0xFF21191C);
|
||||
static const vipCardMiddle = Color(0xFF181719);
|
||||
static const vipCardEnd = Color(0xFF141416);
|
||||
static const mineVipSurfaceStart = Color(0xFF2D1519);
|
||||
static const mineVipSurfaceEnd = Color(0xFF171416);
|
||||
static const vipCardBorder = Color(0x2EFFFFFF);
|
||||
static const vipCardRedGlow = Color(0x2EF04E4E);
|
||||
static const vipCardGoldGlow = Color(0x16F5D9A0);
|
||||
|
||||
@@ -274,23 +274,16 @@ abstract final class AppDimens {
|
||||
static const double mineSectionGap = 12;
|
||||
|
||||
/// 「我的」页紧凑会员横幅尺寸。
|
||||
static const double mineVipRadius = 18;
|
||||
static const double mineVipPadding = 10;
|
||||
static const double mineVipTitleFont = 21;
|
||||
static const double mineVipSubtitleFont = 11;
|
||||
static const double mineVipEmblem = 48;
|
||||
static const double mineVipEmblemIcon = 28;
|
||||
static const double mineVipArtWidth = 84;
|
||||
static const double mineVipArtHeight = 84;
|
||||
static const double mineVipArtGlow = 56;
|
||||
static const double mineVipArtSurface = 44;
|
||||
static const double mineVipArtIcon = 22;
|
||||
static const double mineVipActionWidth = 86;
|
||||
static const double mineVipBenefitFont = 10.5;
|
||||
static const double mineVipBenefitSurface = 28;
|
||||
static const double mineVipRadius = 14;
|
||||
static const double mineVipPadding = 9;
|
||||
static const double mineVipBrandFont = 20;
|
||||
static const double mineVipLeadFont = 22;
|
||||
static const double mineVipCrownSize = 52;
|
||||
static const double mineVipActionWidth = 92;
|
||||
static const double mineVipArrowSize = 16;
|
||||
static const double mineVipBenefitFont = 11;
|
||||
static const double mineVipBenefitGlyph = 16;
|
||||
static const double mineVipBenefitRowGap = 2;
|
||||
static const double mineVipButtonHeight = 26;
|
||||
static const double mineVipButtonHeight = 28;
|
||||
static const double mineContinueCardWidth = 96;
|
||||
static const double mineContinueRowHeight = 172;
|
||||
static const double mineContinueTitleFont = 13;
|
||||
|
||||
@@ -6,11 +6,12 @@ import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_dimens.dart';
|
||||
import '../../../core/widgets/app_press_scale.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import 'mine_stat_icon.dart';
|
||||
|
||||
const double _vipMaxTextScale = 1.15;
|
||||
const double _vipGradientMiddleStop = 0.62;
|
||||
const double _vipGlowRadius = 0.9;
|
||||
const double _vipButtonLetterSpacing = 0.2;
|
||||
const double _vipLabelLetterSpacing = 1.2;
|
||||
const double _vipGlowRadius = 0.85;
|
||||
|
||||
/// 「我的」页 VIP 会员卡:主视觉、权益横排与开通入口。
|
||||
class MineVipBanner extends StatelessWidget {
|
||||
@@ -38,7 +39,7 @@ class MineVipBanner extends StatelessWidget {
|
||||
const Positioned.fill(child: _VipAmbientGlow()),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(AppDimens.mineVipPadding),
|
||||
child: _VipContent(l10n: l10n, onOpen: onOpen),
|
||||
child: _VipContent(l10n: l10n),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -54,30 +55,17 @@ class MineVipBanner extends StatelessWidget {
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
AppColors.vipCardStart,
|
||||
AppColors.vipCardMiddle,
|
||||
AppColors.vipCardEnd,
|
||||
],
|
||||
stops: [0, _vipGradientMiddleStop, 1],
|
||||
colors: [AppColors.mineVipSurfaceStart, AppColors.mineVipSurfaceEnd],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppDimens.mineVipRadius),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: AppColors.shadowSoft,
|
||||
blurRadius: AppDimens.spaceLg,
|
||||
offset: Offset(0, AppDimens.spaceSm),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VipContent extends StatelessWidget {
|
||||
const _VipContent({required this.l10n, required this.onOpen});
|
||||
const _VipContent({required this.l10n});
|
||||
|
||||
final AppLocalizations l10n;
|
||||
final VoidCallback onOpen;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -87,11 +75,17 @@ class _VipContent extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _VipCopy(l10n: l10n, onOpen: onOpen),
|
||||
),
|
||||
Expanded(child: _VipCopy(l10n: l10n)),
|
||||
const SizedBox(width: AppDimens.spaceSm),
|
||||
const _VipArt(),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
const _VipCrown(),
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
_VipOpenButton(label: l10n.vipOpenNow),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
@@ -102,10 +96,9 @@ class _VipContent extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _VipCopy extends StatelessWidget {
|
||||
const _VipCopy({required this.l10n, required this.onOpen});
|
||||
const _VipCopy({required this.l10n});
|
||||
|
||||
final AppLocalizations l10n;
|
||||
final VoidCallback onOpen;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -115,70 +108,65 @@ class _VipCopy extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
l10n.vipBrandName,
|
||||
key: const Key('mine-vip-brand'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.vipCardText,
|
||||
fontSize: AppDimens.mineVipTitleFont,
|
||||
color: AppColors.primary,
|
||||
fontSize: AppDimens.mineVipBrandFont,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: 1.0,
|
||||
letterSpacing: _vipLabelLetterSpacing,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
Text(
|
||||
l10n.mineVipSubtitle,
|
||||
maxLines: 1,
|
||||
l10n.vipBenefitFree,
|
||||
key: const Key('mine-vip-benefit-0'),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.vipCardMuted,
|
||||
fontSize: AppDimens.mineVipSubtitleFont,
|
||||
height: 1.3,
|
||||
color: AppColors.vipCardText,
|
||||
fontSize: AppDimens.mineVipLeadFont,
|
||||
fontWeight: FontWeight.w800,
|
||||
height: 1.15,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
_VipOpenButton(label: l10n.vipOpenNow, onOpen: onOpen),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VipArt extends StatelessWidget {
|
||||
const _VipArt();
|
||||
class _VipCrown extends StatelessWidget {
|
||||
const _VipCrown();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
key: const Key('mine-vip-art'),
|
||||
width: AppDimens.mineVipArtWidth,
|
||||
height: AppDimens.mineVipArtHeight,
|
||||
child: Image.asset(
|
||||
'assets/icon/vip_membership_badge.png',
|
||||
return SizedBox.square(
|
||||
key: const Key('mine-vip-emblem'),
|
||||
width: AppDimens.mineVipArtWidth,
|
||||
height: AppDimens.mineVipArtHeight,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
dimension: AppDimens.mineVipCrownSize,
|
||||
child: const MineVipEmblem(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VipOpenButton extends StatelessWidget {
|
||||
const _VipOpenButton({required this.label, required this.onOpen});
|
||||
const _VipOpenButton({required this.label});
|
||||
|
||||
final String label;
|
||||
final VoidCallback onOpen;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
return Container(
|
||||
key: const Key('mine-vip-open'),
|
||||
width: AppDimens.mineVipActionWidth,
|
||||
height: AppDimens.mineVipButtonHeight,
|
||||
child: InkWell(
|
||||
onTap: onOpen,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColors.vipButtonStart, AppColors.vipButtonEnd],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppDimens.pillRadius),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
@@ -186,8 +174,8 @@ class _VipOpenButton extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.vipGoldStart,
|
||||
fontSize: AppDimens.body,
|
||||
color: AppColors.onPrimary,
|
||||
fontSize: AppDimens.chipFont,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: _vipButtonLetterSpacing,
|
||||
),
|
||||
@@ -196,11 +184,27 @@ class _VipOpenButton extends StatelessWidget {
|
||||
const SizedBox(width: AppDimens.spaceXs),
|
||||
const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
color: AppColors.vipGoldStart,
|
||||
size: AppDimens.mineVipBenefitGlyph,
|
||||
color: AppColors.onPrimary,
|
||||
size: AppDimens.mineVipArrowSize,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VipAmbientGlow extends StatelessWidget {
|
||||
const _VipAmbientGlow();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
center: Alignment(0.9, -0.75),
|
||||
radius: _vipGlowRadius,
|
||||
colors: [AppColors.vipCardRedGlow, AppColors.transparent],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -213,32 +217,14 @@ class _VipBenefits extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final items = [
|
||||
(Icons.all_inclusive_rounded, l10n.vipBenefitFree),
|
||||
(Icons.block_rounded, l10n.vipBenefitNoAds),
|
||||
(Icons.hd_outlined, l10n.vipBenefitHd),
|
||||
(Icons.download_for_offline_outlined, l10n.vipBenefitFastCache),
|
||||
];
|
||||
return Column(
|
||||
final items = [l10n.vipBenefitNoAds, l10n.vipBenefitHd];
|
||||
return Row(
|
||||
key: const Key('mine-vip-benefits'),
|
||||
children: [
|
||||
_row(items, 0),
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
_row(items, 2),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _row(List<(IconData, String)> items, int start) {
|
||||
return Row(
|
||||
children: [
|
||||
for (var index = start; index < start + 2; index++)
|
||||
Expanded(
|
||||
child: _VipBenefit(
|
||||
itemKey: Key('mine-vip-benefit-$index'),
|
||||
icon: items[index].$1,
|
||||
label: items[index].$2,
|
||||
),
|
||||
for (var index = 0; index < items.length; index++)
|
||||
_VipBenefit(
|
||||
itemKey: Key('mine-vip-benefit-${index + 1}'),
|
||||
label: items[index],
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -246,24 +232,16 @@ class _VipBenefits extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _VipBenefit extends StatelessWidget {
|
||||
const _VipBenefit({
|
||||
required this.itemKey,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
});
|
||||
const _VipBenefit({required this.itemKey, required this.label});
|
||||
|
||||
final Key itemKey;
|
||||
final IconData icon;
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
return Padding(
|
||||
key: itemKey,
|
||||
children: [
|
||||
_VipBenefitGlyph(icon: icon),
|
||||
const SizedBox(width: AppDimens.spaceXs),
|
||||
Expanded(
|
||||
padding: const EdgeInsets.only(right: AppDimens.spaceMd),
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
@@ -275,57 +253,6 @@ class _VipBenefit extends StatelessWidget {
|
||||
height: 1.15,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VipBenefitGlyph extends StatelessWidget {
|
||||
const _VipBenefitGlyph({required this.icon});
|
||||
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Icon(
|
||||
icon,
|
||||
color: AppColors.vipGoldStart,
|
||||
size: AppDimens.mineVipBenefitGlyph,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VipAmbientGlow extends StatelessWidget {
|
||||
const _VipAmbientGlow();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: const [
|
||||
Positioned.fill(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
center: Alignment(0.85, -0.8),
|
||||
radius: _vipGlowRadius,
|
||||
colors: [AppColors.vipCardGoldGlow, AppColors.transparent],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
center: Alignment(-0.9, 1),
|
||||
radius: _vipGlowRadius,
|
||||
colors: [AppColors.vipCardRedGlow, AppColors.transparent],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -11,30 +11,42 @@ import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/mine/mine_types.dart';
|
||||
import 'package:fruitshorts/pages/mine/widgets/mine_action_grid.dart';
|
||||
import 'package:fruitshorts/pages/mine/widgets/mine_menu.dart';
|
||||
import 'package:fruitshorts/pages/mine/widgets/mine_stat_icon.dart';
|
||||
|
||||
const _layoutTolerance = 0.1;
|
||||
const _minimumVipHeight = 110.0;
|
||||
const _premiumVipHeightLimit = 150.0;
|
||||
const _minimumVipHeight = 95.0;
|
||||
const _premiumVipHeightLimit = 120.0;
|
||||
|
||||
void main() {
|
||||
testWidgets('should_keep_equal_visible_vip_padding_and_reduce_height', (
|
||||
for (final localeTag in ['en', 'id', 'zh']) {
|
||||
testWidgets('should_keep_vip_compact_when_locale_is_$localeTag', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpLocalized(
|
||||
tester,
|
||||
const SizedBox(width: 342, child: MineVipBanner(onOpen: _noop)),
|
||||
locale: Locale(localeTag),
|
||||
);
|
||||
|
||||
final cardRect = tester.getRect(find.byKey(const Key('mine-vip')));
|
||||
final emblemRect = tester.getRect(find.byKey(const Key('mine-vip-emblem')));
|
||||
final emblem = tester.widget<Image>(
|
||||
final emblemRect = tester.getRect(
|
||||
find.byKey(const Key('mine-vip-emblem')),
|
||||
);
|
||||
expect(emblemRect.width, greaterThanOrEqualTo(52));
|
||||
expect(
|
||||
(emblem.image as AssetImage).assetName,
|
||||
'assets/icon/vip_membership_badge.png',
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('mine-vip-emblem')),
|
||||
matching: find.byType(MineVipEmblem),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final titleRect = tester.getRect(find.text('VIP'));
|
||||
final titleRect = tester.getRect(
|
||||
find.byKey(const Key('mine-vip-benefit-0')),
|
||||
);
|
||||
final brand = tester.widget<Text>(
|
||||
find.byKey(const Key('mine-vip-brand')),
|
||||
);
|
||||
expect(brand.style?.fontSize, greaterThanOrEqualTo(20));
|
||||
final benefitsRect = tester.getRect(
|
||||
find.byKey(const Key('mine-vip-benefits')),
|
||||
);
|
||||
@@ -46,11 +58,44 @@ void main() {
|
||||
);
|
||||
expect(benefitsRect.bottom, lessThan(cardRect.bottom));
|
||||
expect(emblemRect.left, greaterThan(titleRect.right));
|
||||
final first = tester.getRect(find.byKey(const Key('mine-vip-benefit-0')));
|
||||
final second = tester.getRect(find.byKey(const Key('mine-vip-benefit-1')));
|
||||
final second = tester.getRect(
|
||||
find.byKey(const Key('mine-vip-benefit-1')),
|
||||
);
|
||||
final third = tester.getRect(find.byKey(const Key('mine-vip-benefit-2')));
|
||||
expect(first.top, second.top);
|
||||
expect(third.top, greaterThan(first.top));
|
||||
final open = tester.getRect(find.byKey(const Key('mine-vip-open')));
|
||||
expect(titleRect.top, lessThan(second.top));
|
||||
expect(second.top, third.top);
|
||||
expect(find.byKey(const Key('mine-vip-benefit-3')), findsNothing);
|
||||
expect(open.top, greaterThan(titleRect.top));
|
||||
expect(open.height, greaterThanOrEqualTo(28));
|
||||
expect(open.right, lessThanOrEqualTo(cardRect.right));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('mine-vip-benefits')),
|
||||
matching: find.byType(Icon),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('should_keep_indonesian_vip_readable_when_width_is_narrow', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpLocalized(
|
||||
tester,
|
||||
const SizedBox(width: 292, child: MineVipBanner(onOpen: _noop)),
|
||||
locale: const Locale('id'),
|
||||
);
|
||||
|
||||
final title = tester.widget<Text>(
|
||||
find.byKey(const Key('mine-vip-benefit-0')),
|
||||
);
|
||||
final cardRect = tester.getRect(find.byKey(const Key('mine-vip')));
|
||||
expect(title.maxLines, 2);
|
||||
expect(cardRect.height, lessThan(125));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
for (final localeTag in ['en', 'id']) {
|
||||
|
||||
@@ -169,14 +169,13 @@ void main() {
|
||||
final vip = tester.widget<Container>(find.byKey(const Key('mine-vip')));
|
||||
final vipDecoration = vip.decoration! as BoxDecoration;
|
||||
expect((vipDecoration.gradient! as LinearGradient).colors, const [
|
||||
AppColors.vipCardStart,
|
||||
AppColors.vipCardMiddle,
|
||||
AppColors.vipCardEnd,
|
||||
AppColors.mineVipSurfaceStart,
|
||||
AppColors.mineVipSurfaceEnd,
|
||||
]);
|
||||
expect(vipDecoration.border, isNull);
|
||||
expect(vipDecoration.boxShadow, isNotEmpty);
|
||||
expect(vipDecoration.boxShadow, isNull);
|
||||
|
||||
// 卡片高度由内容撑开,身份头部与底部 CTA 都保留安全内边距。
|
||||
// 核心权益在主行,辅助权益保留为轻量文字。
|
||||
final vipRect = tester.getRect(find.byKey(const Key('mine-vip')));
|
||||
final emblemRect = tester.getRect(find.byKey(const Key('mine-vip-emblem')));
|
||||
final benefitsRect = tester.getRect(
|
||||
@@ -191,28 +190,16 @@ void main() {
|
||||
tester.getSize(find.byKey(const Key('mine-vip-open'))).height,
|
||||
greaterThanOrEqualTo(AppDimens.mineVipButtonHeight),
|
||||
);
|
||||
const benefitKeys = [
|
||||
Key('mine-vip-benefit-0'),
|
||||
Key('mine-vip-benefit-1'),
|
||||
Key('mine-vip-benefit-2'),
|
||||
Key('mine-vip-benefit-3'),
|
||||
];
|
||||
final benefitTops = benefitKeys
|
||||
.map((key) => tester.getTopLeft(find.byKey(key)))
|
||||
final leadBenefit = tester.getRect(
|
||||
find.byKey(const Key('mine-vip-benefit-0')),
|
||||
);
|
||||
final detailBenefits = [1, 2]
|
||||
.map(
|
||||
(index) => tester.getRect(find.byKey(Key('mine-vip-benefit-$index'))),
|
||||
)
|
||||
.toList();
|
||||
expect(
|
||||
benefitTops.take(2).map((position) => position.dy).toSet(),
|
||||
hasLength(1),
|
||||
);
|
||||
expect(
|
||||
benefitTops.skip(2).map((position) => position.dy).toSet(),
|
||||
hasLength(1),
|
||||
);
|
||||
expect(benefitTops[2].dy, greaterThan(benefitTops[0].dy));
|
||||
expect(
|
||||
benefitTops.take(2).map((position) => position.dx).toSet(),
|
||||
hasLength(2),
|
||||
);
|
||||
expect(detailBenefits.every((rect) => rect.top > leadBenefit.top), isTrue);
|
||||
expect(find.byKey(const Key('mine-vip-benefit-3')), findsNothing);
|
||||
|
||||
final order = [
|
||||
tester.getTopLeft(find.byKey(const Key('mine-user-row'))).dy,
|
||||
|
||||
@@ -69,13 +69,6 @@ void main() {
|
||||
expect(tops.toSet(), hasLength(1));
|
||||
expect(tester.takeException(), isNull);
|
||||
if (_captureEnabled) {
|
||||
final context = tester.element(find.byKey(const Key('mine-vip-emblem')));
|
||||
await tester.runAsync(() async {
|
||||
await precacheImage(
|
||||
const AssetImage('assets/icon/vip_membership_badge.png'),
|
||||
context,
|
||||
);
|
||||
});
|
||||
await tester.pumpAndSettle();
|
||||
await saveWidgetCapture(tester, _captureKey, _capturePath);
|
||||
}
|
||||
|
||||
@@ -1170,7 +1170,7 @@ void main() {
|
||||
tester
|
||||
.widget<Material>(find.byKey(const Key('player-episodes-pill')))
|
||||
.color,
|
||||
AppColors.textPrimary.withValues(alpha: 0.14),
|
||||
AppColors.glassSurface,
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
|
||||
Reference in new issue
Block a user