diff --git a/lib/core/theme/app_colors.dart b/lib/core/theme/app_colors.dart index 1b041f1..086d4d7 100644 --- a/lib/core/theme/app_colors.dart +++ b/lib/core/theme/app_colors.dart @@ -30,6 +30,9 @@ abstract final class AppColors { /// 首页及剧集播放页视频信息文案:参考设计图的 65% 半透明白。 static const homeFeedVideoCopy = Color(0xA6FFFFFF); + /// 首页观看全集按钮:参考设计稿的中性深灰表面。 + static const watchAllSurface = Color(0xFF333333); + /// 主操作、选中态、播放进度。旧品牌橙已全量映射为品牌红(2026-10 改版)。 static const blue = Color(0xFFF04E4E); static const primary = blue; diff --git a/lib/pages/player/widgets/home_feed_recommend_panel.dart b/lib/pages/player/widgets/home_feed_recommend_panel.dart index 8956862..6d9af4c 100644 --- a/lib/pages/player/widgets/home_feed_recommend_panel.dart +++ b/lib/pages/player/widgets/home_feed_recommend_panel.dart @@ -35,13 +35,8 @@ const _metadataStrutStyle = StrutStyle( const double _watchAllInset = 12; const double _watchAllRadius = 6; const double _watchAllFont = 16; -const _watchAllGradient = LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [AppColors.mineStatShade, AppColors.brandRed, AppColors.vipButtonEnd], -); -/// 「观看完整剧集」渐变按钮高度,overlay 用它安排底部避让。 +/// 「观看完整剧集」按钮高度,overlay 用它安排底部避让。 const double homeFeedWatchAllHeight = _watchAllHeight; /// 播放量紧凑展示(跟随语言):zh 20万 / en 200K / id 200 rb。 @@ -212,8 +207,8 @@ class HomeFeedWatchAllBar extends StatelessWidget { return ClipRRect( borderRadius: BorderRadius.circular(_watchAllRadius), child: DecoratedBox( - key: const Key('home-feed-full-series-gradient'), - decoration: const BoxDecoration(gradient: _watchAllGradient), + key: const Key('home-feed-full-series-surface'), + decoration: const BoxDecoration(color: AppColors.watchAllSurface), child: Material( key: const Key('home-feed-full-series-bg'), color: AppColors.transparent, diff --git a/test/home/feed_info_hierarchy_test.dart b/test/home/feed_info_hierarchy_test.dart index ac40c3e..c10205b 100644 --- a/test/home/feed_info_hierarchy_test.dart +++ b/test/home/feed_info_hierarchy_test.dart @@ -260,23 +260,15 @@ void main() { _expectNoShadows(tester); }); - testWidgets('should_use_small_radius_and_brand_gradient_when_watching_all', ( - tester, - ) async { + testWidgets('should_use_reference_surface_when_watching_all', (tester) async { await _pump(tester); final background = find.byKey(const Key('home-feed-full-series-bg')); final decorated = tester.widget( - find.byKey(const Key('home-feed-full-series-gradient')), + find.byKey(const Key('home-feed-full-series-surface')), ); final decoration = decorated.decoration as BoxDecoration; - expect((decoration.gradient! as LinearGradient).colors, [ - AppColors.mineStatShade, - AppColors.brandRed, - AppColors.vipButtonEnd, - ]); - final gradient = decoration.gradient! as LinearGradient; - expect(gradient.begin, Alignment.centerLeft); - expect(gradient.end, Alignment.centerRight); + expect(decoration.color, AppColors.watchAllSurface); + expect(decoration.gradient, isNull); expect(tester.widget(find.text('Watch all')).style?.fontSize, 16); expect( tester.widget(find.text('Watch all')).style?.fontWeight, diff --git a/test/home/feed_watch_all_gradient_test.dart b/test/home/feed_watch_all_gradient_test.dart index 3343822..8965365 100644 --- a/test/home/feed_watch_all_gradient_test.dart +++ b/test/home/feed_watch_all_gradient_test.dart @@ -1,5 +1,5 @@ // Author: fruit.com.cn -// 职责:检查观看全集按钮实际绘制像素,防止渐变只配置而不可见。 +// 职责:检查观看全集按钮实际绘制像素,防止配色只配置而不可见。 import 'dart:typed_data'; import 'dart:ui' as ui; @@ -10,15 +10,16 @@ import 'package:fruitshorts/core/data/models/drama.dart'; import 'package:fruitshorts/l10n/app_localizations.dart'; import 'package:fruitshorts/pages/player/widgets/home_feed_recommend_panel.dart'; -const _boundaryKey = Key('watch-gradient-boundary'); +const _boundaryKey = Key('watch-surface-boundary'); const _width = 280.0; const _sampleInset = 16; const _sampleY = 4; const _rgbaChannels = 4; -const _minimumRedDelta = 50; +const _surfaceChannel = 0.2; +const _surfaceTolerance = 0.01; const _drama = Drama( - id: 'gradient', - title: 'Gradient', + id: 'surface', + title: 'Surface', synopsis: '', posterUrl: '', ); @@ -52,7 +53,7 @@ Color _sample(ByteData bytes, int width, int x) { } void main() { - testWidgets('should_paint_visible_red_gradient_instead_of_flat_fill', ( + testWidgets('should_paint_reference_dark_surface_when_watching_all', ( tester, ) async { await _pumpButton(tester); @@ -68,11 +69,12 @@ void main() { final middle = _sample(bytes, image.width, image.width ~/ 2); final right = _sample(bytes, image.width, image.width - _sampleInset); image.dispose(); - expect(left.a, 1); - expect(right.a, 1); - expect((right.r - left.r) * 255, greaterThan(_minimumRedDelta)); - expect(left.g, lessThan(middle.g)); - expect(middle.g, lessThan(right.g)); + for (final sample in [left, middle, right]) { + expect(sample.a, 1); + expect(sample.r, closeTo(_surfaceChannel, _surfaceTolerance)); + expect(sample.g, closeTo(_surfaceChannel, _surfaceTolerance)); + expect(sample.b, closeTo(_surfaceChannel, _surfaceTolerance)); + } }); }); }