fix(player): 评论输入改为透明浮层并消除收起键盘抖动

This commit is contained in:
Zhou Weidong committed 2026-10-21 14:24:24 +08:00
1 parent 5b4526cb97
commit 4908dc9d76
3 files changed
+198 -147

No files matched your search

+39 -4
View File
@@ -352,10 +352,18 @@ void main() {
final composer = find.byKey(const Key('comment-composer-sheet'));
final composerInput = find.byKey(const Key('comment-composer-input'));
expect(composer, findsOneWidget);
expect(
ModalRoute.of(tester.element(composer))?.barrierColor,
Colors.transparent,
);
final overlayRoot = find.byKey(const Key('comment-composer-overlay'));
expect(overlayRoot, findsOneWidget);
final overlayStack = tester.widget<Stack>(overlayRoot);
expect(overlayStack.children, hasLength(2));
final dismissLayer = overlayStack.children.first as Positioned;
expect(dismissLayer.left, 0);
expect(dismissLayer.top, 0);
expect(dismissLayer.right, 0);
expect(dismissLayer.bottom, 0);
final dismissGesture = dismissLayer.child as GestureDetector;
expect(dismissGesture.child, isNull);
expect(dismissGesture.behavior, HitTestBehavior.opaque);
final compactHeight = tester.getSize(composer).height;
expect(compactHeight, inInclusiveRange(100, 150));
expect(tester.widget<TextField>(composerInput).focusNode?.hasFocus, isTrue);
@@ -486,6 +494,33 @@ void main() {
expect(sheet, findsNothing);
});
testWidgets(
'should_close_composer_overlay_on_back_without_closing_comments',
(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 sheet = find.byKey(const Key('player-comments-sheet'));
final composer = find.byKey(const Key('comment-composer-sheet'));
expect(sheet, findsOneWidget);
expect(composer, findsOneWidget);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(sheet, findsOneWidget);
expect(composer, findsNothing);
},
);
testWidgets('should_use_polished_comment_sizes', (tester) async {
final repository = FakeCommentRepository(
pages: [