fix(flutter): 调整播放页底部信息排版

This commit is contained in:
Zhou Weidong committed 2026-10-20 11:55:28 +08:00
1 parent 55d22a9940
commit d25519bed7
11 files changed
+236 -77

No files matched your search

+120 -3
View File
@@ -129,7 +129,7 @@ void main() {
expect(find.byTooltip('Exit clear screen'), findsOneWidget);
expect(
tester.getSize(find.byKey(const Key('player-bottom-clear-screen'))),
const Size(30, 30),
const Size(40, 40),
);
await tester.tapAt(const Offset(80, 300));
@@ -204,6 +204,31 @@ void main() {
.color,
AppColors.playerOverlayPill,
);
expect(
tester
.widget<Material>(find.byKey(const Key('player-episodes-pill')))
.borderRadius,
BorderRadius.circular(7),
);
expect(
tester
.widget<Text>(
find
.descendant(
of: find.byKey(const Key('player-episodes-pill')),
matching: find.byType(Text),
)
.first,
)
.style
?.fontSize,
13.5,
);
expect(
tester.getSize(find.byKey(const Key('player-bottom-clear-screen'))),
const Size(40, 40),
);
expect(tester.widget<Slider>(find.byType(Slider)).padding, EdgeInsets.zero);
expect(bottom.height, lessThanOrEqualTo(200));
expect(bottom.top, greaterThanOrEqualTo(screenHeight * 0.78));
@@ -227,8 +252,10 @@ void main() {
final expandedBottom = tester.getRect(
find.byKey(const Key('player-controls-bottom')),
);
expect(expandedBottom.height, lessThanOrEqualTo(200));
expect(expandedBottom.top, greaterThanOrEqualTo(screenHeight * 0.78));
// K29.9 展开态展示简介全文,高度会增长,但仍需留在画面下半区。
expect(expandedBottom.height, lessThanOrEqualTo(330));
expect(expandedBottom.top, greaterThanOrEqualTo(screenHeight * 0.5));
expect(tester.takeException(), isNull);
});
testWidgets('should_keep_series_clear_state_when_swiping_next_episode', (
@@ -258,6 +285,96 @@ void main() {
expect(find.byKey(const Key('player-interaction-rail')), findsOneWidget);
});
testWidgets('should_toggle_synopsis_with_inline_text_button', (tester) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);
final toggle = find.byKey(const Key('player-synopsis-toggle'));
final synopsis = find.byKey(const Key('player-synopsis'));
expect(
find.descendant(of: toggle, matching: find.text('More')),
findsOneWidget,
);
expect(tester.widget<Text>(synopsis).maxLines, 1);
expect(
tester.getRect(toggle).left - tester.getRect(synopsis).right,
lessThanOrEqualTo(4),
);
await tester.tap(toggle);
await tester.pumpAndSettle();
expect(
find.descendant(of: toggle, matching: find.text('Less')),
findsOneWidget,
);
expect(tester.widget<Text>(synopsis).maxLines, isNull);
await tester.tap(toggle);
await tester.pumpAndSettle();
expect(
find.descendant(of: toggle, matching: find.text('More')),
findsOneWidget,
);
expect(tester.widget<Text>(synopsis).maxLines, 1);
});
testWidgets('should_fit_long_title_and_synopsis_at_320_width', (
tester,
) async {
final longCopy = Drama(
id: 'long-copy-demo',
title:
'An Extremely Long Drama Title That Keeps Going Beyond Any '
'Sensible Width On A Narrow Screen',
synopsis:
'A very long synopsis that keeps describing the story far beyond '
'the single line space available in the compact bottom panel of '
'the fullscreen player.',
posterUrl: '/files/long-copy-demo.png',
genre: 'Drama',
detailLoaded: true,
episodes: const [
Episode(
id: 'long-copy-demo-1',
number: 1,
title: 'Episode 1',
isFree: true,
videoUrl: 'https://example.test/long-demo-1.mp4',
),
],
);
await _pumpApp(
tester,
size: const Size(320, 568),
catalog: FakeCatalogRepository(dramas: [longCopy]),
);
await _openSeriesPlayer(
tester,
cardKey: const Key('home-drama-card-long-copy-demo'),
);
expect(tester.takeException(), isNull);
final title = tester.getRect(find.byKey(const Key('player-drama-title')));
final chevron = tester.getRect(
find.descendant(
of: find.byKey(const Key('player-open-detail')),
matching: find.byIcon(Icons.chevron_right_rounded),
),
);
expect(chevron.left - title.right, lessThanOrEqualTo(6));
expect(chevron.right, lessThanOrEqualTo(320 - 14));
final synopsis = tester.widget<Text>(
find.byKey(const Key('player-synopsis')),
);
expect(synopsis.maxLines, 1);
expect(synopsis.overflow, TextOverflow.ellipsis);
expect(
tester.getRect(find.byKey(const Key('player-episodes-pill'))).right,
lessThanOrEqualTo(320 - 14 - 40 - 8),
);
expect(tester.takeException(), isNull);
});
testWidgets('should_open_speed_sheet_and_apply_selected_speed', (
tester,
) async {