style(home): 匹配观看全集设计稿配色

This commit is contained in:
Zhou Weidong committed 2026-11-04 13:42:47 +08:00
1 parent f3cfd0d0ec
commit 6acc00394b
4 files changed
+23 -31

No files matched your search

+13 -11
View File
@@ -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));
}
});
});
}