fix(player): 收起键盘不关闭评论输入弹窗

This commit is contained in:
Zhou Weidong committed 2026-10-21 14:10:09 +08:00
1 parent f9f77090d9
commit cb58f649c1
2 files changed
+36 -40

No files matched your search

+35 -1
View File
@@ -387,7 +387,8 @@ void main() {
tester.view.viewInsets = const FakeViewPadding();
await tester.pumpAndSettle();
expect(composer, findsNothing);
expect(composer, findsOneWidget);
expect(tester.getBottomLeft(composer).dy, closeTo(844, 0.1));
expect(commentsSheet, findsOneWidget);
expect(list, findsOneWidget);
expect(placeholder, findsOneWidget);
@@ -395,6 +396,35 @@ void main() {
expect(tester.getSize(commentsSheet).height, closeTo(sheetHeight, 0.1));
});
testWidgets('should_keep_composer_open_after_input_loses_focus', (
tester,
) async {
final repository = FakeCommentRepository(
pages: [
CommentPage(
comments: [commentFixture(id: '10', content: 'A comment')],
),
],
);
await _pumpSheet(tester, repository: repository);
await tester.tap(find.byKey(const Key('comment-input-placeholder')));
await tester.pumpAndSettle();
final composer = find.byKey(const Key('comment-composer-sheet'));
final input = find.byKey(const Key('comment-composer-input'));
expect(composer, findsOneWidget);
tester.widget<TextField>(input).focusNode?.unfocus();
await tester.pumpAndSettle();
expect(composer, findsOneWidget);
await tester.tap(input);
await tester.pump();
expect(composer, findsOneWidget);
expect(tester.widget<TextField>(input).focusNode?.hasFocus, isTrue);
});
testWidgets('should_close_composer_before_comment_panel_from_outside', (
tester,
) async {
@@ -430,6 +460,10 @@ void main() {
final sheetRect = tester.getRect(sheet);
final composerRect = tester.getRect(composer);
await tester.tap(find.byKey(const Key('comment-composer-input')));
await tester.pump();
expect(composer, findsOneWidget);
await tester.tapAt(
Offset(sheetRect.center.dx, (sheetRect.top + composerRect.top) / 2),
);