style(player): 播放页与首页浮层的控件样式统一
播放页顶部按钮与选集条去掉底色、进度条不再画滑块圆点并压到最底部; 剧名与简介收在互动栏左侧,清屏后只留右下角退出按钮。 首页观看条与进度条共用 20pt 页边距,进度槽底色与播放页一致。
This commit is contained in:
1 parent
d5bcda54d3
commit
543d0aadd5
12 files changed
+298
-297
No files matched your search
@@ -35,12 +35,12 @@ void main() {
|
||||
Key('player-play-toggle'),
|
||||
]) {
|
||||
expect(tester.getSize(find.byKey(key)), const Size(68, 68));
|
||||
// 圆形底改为半透明黑色,不再是完全透明或蓝色实底。
|
||||
// 圆形深色底:压在亮画面上也能看见播放/暂停。
|
||||
final container = tester.widget<Container>(
|
||||
find.descendant(of: find.byKey(key), matching: find.byType(Container)),
|
||||
);
|
||||
final decoration = container.decoration! as BoxDecoration;
|
||||
expect(decoration.color, Colors.black26);
|
||||
expect(decoration.color, const Color(0x66000000));
|
||||
expect(decoration.shape, BoxShape.circle);
|
||||
final icon = tester.widget<Icon>(
|
||||
find.descendant(of: find.byKey(key), matching: find.byType(Icon)),
|
||||
|
||||
@@ -983,9 +983,11 @@ void main() {
|
||||
expect(find.byKey(const Key('player-video-tap')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-bottom-clear-screen')), findsOneWidget);
|
||||
expect(find.byTooltip('Exit clear screen'), findsOneWidget);
|
||||
// 清屏后左侧选集条一起收起,只留右下角的退出按钮。
|
||||
expect(find.byKey(const Key('player-episodes-pill')), findsNothing);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('player-bottom-clear-screen'))),
|
||||
const Size(40, 40),
|
||||
const Size(40, 34),
|
||||
);
|
||||
|
||||
await tester.tapAt(const Offset(80, 300));
|
||||
@@ -1100,8 +1102,8 @@ void main() {
|
||||
expect(find.byKey(const Key('player-speed-boost-hint')), findsNothing);
|
||||
expect(find.byKey(const Key('player-interaction-rail')), findsNothing);
|
||||
expect(find.byTooltip('Exit clear screen'), findsOneWidget);
|
||||
// 清屏态本来显示的选集胶囊与右下按钮,在加速结束后恢复。
|
||||
expect(find.byKey(const Key('player-episodes-pill')), findsOneWidget);
|
||||
// 清屏态只恢复右下退出按钮;左侧选集条在清屏下一直不显示。
|
||||
expect(find.byKey(const Key('player-episodes-pill')), findsNothing);
|
||||
expect(find.byKey(const Key('player-bottom-clear-screen')), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
@@ -1118,7 +1120,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('player-back'))),
|
||||
const Size(36, 36),
|
||||
const Size(40, 40),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
@@ -1160,17 +1162,12 @@ void main() {
|
||||
.child,
|
||||
isNotNull,
|
||||
);
|
||||
// 选集条给一层浅底色,标出可点区域。
|
||||
expect(
|
||||
tester
|
||||
.widget<Material>(find.byKey(const Key('player-episodes-pill')))
|
||||
.color,
|
||||
AppColors.playerOverlayPill,
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
.widget<Material>(find.byKey(const Key('player-episodes-pill')))
|
||||
.borderRadius,
|
||||
BorderRadius.circular(7),
|
||||
AppColors.textPrimary.withValues(alpha: 0.14),
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
@@ -1186,9 +1183,14 @@ void main() {
|
||||
?.fontSize,
|
||||
13.5,
|
||||
);
|
||||
// 清屏按钮与左侧选集条等高。
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('player-bottom-clear-screen'))),
|
||||
const Size(40, 40),
|
||||
const Size(40, 34),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('player-episodes-pill'))).height,
|
||||
34,
|
||||
);
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
expect(find.byKey(const Key('progress-inactive')), findsOneWidget);
|
||||
@@ -1289,7 +1291,8 @@ void main() {
|
||||
matching: find.byIcon(Icons.keyboard_arrow_up_rounded),
|
||||
),
|
||||
);
|
||||
expect(pill.right - arrow.right, closeTo(14, 0.5));
|
||||
// 选集条左右各留 10pt 内边距,箭头不再贴边。
|
||||
expect(pill.right - arrow.right, closeTo(10, 0.5));
|
||||
expect(arrow.left - label.right, closeTo(8, 0.5));
|
||||
});
|
||||
|
||||
@@ -1551,7 +1554,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
expect(chevron.left - title.right, lessThanOrEqualTo(6));
|
||||
expect(chevron.right, lessThanOrEqualTo(320 - 14));
|
||||
// 剧名和简介一样收在互动栏左侧,不再铺到屏幕最右边。
|
||||
expect(chevron.right, lessThanOrEqualTo(320 - 14 - 54));
|
||||
final synopsis = tester.widget<Text>(
|
||||
find.byKey(const Key('player-synopsis')),
|
||||
);
|
||||
@@ -1647,11 +1651,11 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('player-episodes')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('player-episodes-sheet')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-episodes-close')), findsOneWidget);
|
||||
expect(find.byKey(const Key('drama-info-sheet')), findsOneWidget);
|
||||
expect(find.byKey(const Key('drama-info-close')), findsOneWidget);
|
||||
final grid = tester.widget<GridView>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('player-episodes-sheet')),
|
||||
of: find.byKey(const Key('drama-info-sheet')),
|
||||
matching: find.byType(GridView),
|
||||
),
|
||||
);
|
||||
@@ -1659,14 +1663,14 @@ void main() {
|
||||
grid.gridDelegate as SliverGridDelegateWithFixedCrossAxisCount;
|
||||
expect(delegate.crossAxisCount, 6);
|
||||
final overlay = tester.widget<AnnotatedRegion<SystemUiOverlayStyle>>(
|
||||
find.byKey(const Key('player-episodes-system-overlay')),
|
||||
find.byKey(const Key('drama-info-system-overlay')),
|
||||
);
|
||||
expect(overlay.value.systemNavigationBarColor, AppColors.card);
|
||||
expect(overlay.value.systemNavigationBarContrastEnforced, isFalse);
|
||||
final safeArea = tester.widget<SafeArea>(
|
||||
find
|
||||
.descendant(
|
||||
of: find.byKey(const Key('player-episodes-sheet')),
|
||||
of: find.byKey(const Key('drama-info-sheet')),
|
||||
matching: find.byType(SafeArea),
|
||||
)
|
||||
.first,
|
||||
@@ -2030,7 +2034,7 @@ void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
expect(find.byKey(const Key('player-synopsis')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-more')), findsOneWidget);
|
||||
for (final key in const [Key('player-back'), Key('player-more')]) {
|
||||
expect(tester.getSize(find.byKey(key)), const Size(36, 36));
|
||||
expect(tester.getSize(find.byKey(key)), const Size(40, 40));
|
||||
}
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsNothing);
|
||||
expect(find.byKey(const Key('player-episodes')), findsOneWidget);
|
||||
|
||||
@@ -37,11 +37,8 @@ void main() {
|
||||
expect(find.byKey(const Key('scrub-overlay')), findsNothing);
|
||||
expect(harness.scrubStarts, 1);
|
||||
expect(_sliderTheme(tester).trackHeight, 6);
|
||||
expect(
|
||||
(_sliderTheme(tester).thumbShape! as RoundSliderThumbShape)
|
||||
.enabledThumbRadius,
|
||||
8,
|
||||
);
|
||||
// 不画滑块圆点,进度只靠已播段表达。
|
||||
expect(_sliderTheme(tester).thumbShape, SliderComponentShape.noThumb);
|
||||
|
||||
await gesture.moveBy(const Offset(72, 0));
|
||||
await tester.pump();
|
||||
@@ -67,11 +64,7 @@ void main() {
|
||||
expect(harness.scrubEnds, 1);
|
||||
expect(harness.seeks, 1);
|
||||
expect(_sliderTheme(tester).trackHeight, 2);
|
||||
expect(
|
||||
(_sliderTheme(tester).thumbShape! as RoundSliderThumbShape)
|
||||
.enabledThumbRadius,
|
||||
6,
|
||||
);
|
||||
expect(_sliderTheme(tester).thumbShape, SliderComponentShape.noThumb);
|
||||
});
|
||||
|
||||
testWidgets('feed progress tap does not clear overlay content', (
|
||||
@@ -154,29 +147,27 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('feed progress thumb stays on the finger when dragged right', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpFeedOverlay(tester);
|
||||
final bar = find.byKey(const Key('home-feed-progress'));
|
||||
final gesture = await tester.startGesture(tester.getCenter(bar));
|
||||
testWidgets(
|
||||
'feed progress played segment follows the finger when dragged right',
|
||||
(tester) async {
|
||||
await _pumpFeedOverlay(tester);
|
||||
final bar = find.byKey(const Key('home-feed-progress'));
|
||||
final gesture = await tester.startGesture(tester.getCenter(bar));
|
||||
|
||||
await gesture.moveBy(const Offset(800, 0));
|
||||
await tester.pump();
|
||||
await gesture.moveBy(const Offset(800, 0));
|
||||
await tester.pump();
|
||||
|
||||
final thumbCenter = tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-thumb')))
|
||||
.center
|
||||
.dx;
|
||||
final playedRight = tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-played')))
|
||||
.right;
|
||||
expect(thumbCenter, closeTo(tester.getRect(bar).right, 0.5));
|
||||
expect(playedRight, closeTo(thumbCenter, 0.5));
|
||||
expect(
|
||||
tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-played')))
|
||||
.right,
|
||||
closeTo(tester.getRect(bar).right, 0.5),
|
||||
);
|
||||
|
||||
await gesture.up();
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
await gesture.up();
|
||||
await tester.pumpAndSettle();
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('full player drag clears chrome and release restores it', (
|
||||
tester,
|
||||
|
||||
Reference in new issue
Block a user