fix(player): 评论面板固定半屏高度

This commit is contained in:
Zhou Weidong committed 2026-10-21 13:20:28 +08:00
1 parent fc877f25bf
commit 50edbf40c4
2 files changed
+34 -100

No files matched your search

+5 -15
View File
@@ -581,7 +581,7 @@ void main() {
expect(find.byIcon(Icons.more_horiz_rounded), findsNothing);
});
testWidgets('should_size_short_list_to_content', (tester) async {
testWidgets('should_use_half_screen_height_for_one_comment', (tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
@@ -589,10 +589,7 @@ void main() {
final repository = FakeCommentRepository(
pages: [
CommentPage(
comments: [
commentFixture(id: '10', content: 'Short list one'),
commentFixture(id: '11', content: 'Short list two'),
],
comments: [commentFixture(id: '10', content: 'One comment')],
),
],
);
@@ -600,14 +597,7 @@ void main() {
await _pumpSheet(tester, repository: repository);
final sheet = find.byKey(const Key('player-comments-sheet'));
expect(tester.getSize(sheet).height, lessThan(520));
final lastCommentBottom = tester
.getBottomLeft(find.byKey(const Key('comment-item-11')))
.dy;
final composerTop = tester
.getTopLeft(find.byKey(const Key('comment-composer')))
.dy;
expect(composerTop - lastCommentBottom, lessThan(80));
expect(tester.getSize(sheet).height, closeTo(844 / 2, 0.1));
});
testWidgets('should_keep_minimum_height_for_empty_state', (tester) async {
@@ -627,7 +617,7 @@ void main() {
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final repository = FakeCommentRepository(
pages: [CommentPage(comments: _comments(30))],
pages: [CommentPage(comments: _comments(20))],
);
await _pumpSheet(tester, repository: repository);
@@ -649,7 +639,7 @@ void main() {
expect(position.pixels, greaterThan(0));
expect(
tester.getSize(find.byKey(const Key('player-comments-sheet'))).height,
520,
closeTo(844 / 2, 0.1),
);
});