style(player): 播放页与首页浮层的控件样式统一
播放页顶部按钮与选集条去掉底色、进度条不再画滑块圆点并压到最底部; 剧名与简介收在互动栏左侧,清屏后只留右下角退出按钮。 首页观看条与进度条共用 20pt 页边距,进度槽底色与播放页一致。
This commit is contained in:
1 parent
d5bcda54d3
commit
543d0aadd5
12 files changed
+298
-297
No files matched your search
@@ -293,7 +293,10 @@ void main() {
|
||||
expect(find.byKey(const Key('home-feed-synopsis-more')), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('home-feed-synopsis-more')));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('home-feed-synopsis-expanded')), findsOneWidget);
|
||||
expect(
|
||||
find.byKey(const Key('home-feed-synopsis-expanded')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
.widget<Text>(find.byKey(const Key('home-feed-synopsis-expanded')))
|
||||
@@ -371,7 +374,7 @@ void main() {
|
||||
find.byKey(const Key('home-feed-progress-inactive')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byKey(const Key('home-feed-progress-thumb')), findsNothing);
|
||||
expect(find.byKey(const Key('home-feed-progress-played')), findsNothing);
|
||||
await tester.tap(find.byKey(const Key('rail-share')));
|
||||
expect(shares, 1);
|
||||
});
|
||||
@@ -575,26 +578,36 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final bar = tester.getRect(find.byKey(const Key('home-feed-full-series')));
|
||||
expect(bar.height, 44);
|
||||
expect(bar.height, 38);
|
||||
final overlayRect = tester.getRect(
|
||||
find.byKey(const Key('home-feed-gesture')),
|
||||
);
|
||||
// 通栏观看条铺满浮层宽度,不再左右内缩。
|
||||
expect(bar.left, closeTo(overlayRect.left, 0.1));
|
||||
expect(bar.width, closeTo(overlayRect.width, 0.1));
|
||||
// 进度线中心比观看条顶沿高 8pt。
|
||||
// 观看条与底部进度条共用同一组左右边距(各 20pt),宽度一致。
|
||||
expect(bar.left, closeTo(overlayRect.left + 20, 0.1));
|
||||
expect(bar.width, closeTo(overlayRect.width - 40, 0.1));
|
||||
expect(
|
||||
bar.top -
|
||||
tester
|
||||
.getCenter(find.byKey(const Key('home-feed-progress-track')))
|
||||
.dy,
|
||||
closeTo(8, 0.1),
|
||||
bar.left,
|
||||
closeTo(
|
||||
tester.getRect(find.byKey(const Key('home-feed-progress'))).left,
|
||||
0.1,
|
||||
),
|
||||
);
|
||||
expect(
|
||||
bar.width,
|
||||
closeTo(
|
||||
tester.getRect(find.byKey(const Key('home-feed-progress'))).width,
|
||||
0.1,
|
||||
),
|
||||
);
|
||||
// 进度线贴着浮层底部(线心距底 4pt),且位于观看条下方。
|
||||
final trackCenter = tester.getCenter(
|
||||
find.byKey(const Key('home-feed-progress-track')),
|
||||
);
|
||||
expect(overlayRect.bottom - trackCenter.dy, closeTo(4, 0.1));
|
||||
expect(trackCenter.dy, greaterThan(bar.bottom));
|
||||
expect(
|
||||
tester
|
||||
.widget<Material>(
|
||||
find.byKey(const Key('home-feed-full-series-bg')),
|
||||
)
|
||||
.widget<Material>(find.byKey(const Key('home-feed-full-series-bg')))
|
||||
.color,
|
||||
AppColors.textPrimary.withValues(alpha: 0.15),
|
||||
);
|
||||
@@ -602,13 +615,9 @@ void main() {
|
||||
tester.getRect(find.textContaining('Watch full series')).center.dy,
|
||||
closeTo(bar.center.dy, 2),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(6, 6),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress'))).height,
|
||||
greaterThanOrEqualTo(32),
|
||||
greaterThanOrEqualTo(16),
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
@@ -620,19 +629,6 @@ void main() {
|
||||
.getRect(find.byKey(const Key('home-feed-progress-track')))
|
||||
.center
|
||||
.dy;
|
||||
expect(
|
||||
tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-thumb')))
|
||||
.center
|
||||
.dy,
|
||||
closeTo(
|
||||
tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-track')))
|
||||
.center
|
||||
.dy,
|
||||
0.5,
|
||||
),
|
||||
);
|
||||
|
||||
final gesture = await tester.startGesture(
|
||||
tester.getCenter(find.byKey(const Key('home-feed-progress'))),
|
||||
@@ -704,10 +700,6 @@ void main() {
|
||||
closeTo(trackRect.right - 12, 0.1),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 130));
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(14, 14),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-track'))).height,
|
||||
6,
|
||||
@@ -719,19 +711,6 @@ void main() {
|
||||
.dy,
|
||||
closeTo(idleTrackCenter, 0.1),
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-thumb')))
|
||||
.center
|
||||
.dy,
|
||||
closeTo(
|
||||
tester
|
||||
.getRect(find.byKey(const Key('home-feed-progress-track')))
|
||||
.center
|
||||
.dy,
|
||||
0.5,
|
||||
),
|
||||
);
|
||||
await gesture.up();
|
||||
await tester.pumpAndSettle();
|
||||
expect(scrubVisibility.last, isFalse);
|
||||
@@ -746,10 +725,6 @@ void main() {
|
||||
);
|
||||
expect(seeked, isNotNull);
|
||||
expect(seeked!.inSeconds, greaterThan(0));
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(6, 6),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-track'))).height,
|
||||
2,
|
||||
@@ -825,11 +800,11 @@ void main() {
|
||||
isBuffering: true,
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
expect(find.byKey(const Key('home-feed-progress-thumb')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-progress-played')), findsOneWidget);
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
expect(find.byKey(const Key('home-feed-progress-thumb')), findsNothing);
|
||||
expect(find.byKey(const Key('home-feed-progress-played')), findsNothing);
|
||||
expect(find.byKey(const Key('progress-loading')), findsOneWidget);
|
||||
|
||||
controller.value = const VideoPlayerValue(
|
||||
@@ -838,7 +813,7 @@ void main() {
|
||||
isInitialized: true,
|
||||
);
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('home-feed-progress-thumb')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-progress-played')), findsOneWidget);
|
||||
|
||||
final gesture = await tester.startGesture(
|
||||
tester.getCenter(find.byKey(const Key('home-feed-progress'))),
|
||||
@@ -853,7 +828,7 @@ void main() {
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
|
||||
expect(find.byKey(const Key('home-feed-progress-thumb')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-progress-played')), findsOneWidget);
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
|
||||
controller.value = const VideoPlayerValue(
|
||||
@@ -872,7 +847,7 @@ void main() {
|
||||
isBuffering: true,
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
expect(find.byKey(const Key('home-feed-progress-thumb')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-progress-played')), findsOneWidget);
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
});
|
||||
|
||||
|
||||
@@ -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