merge: 合并 K86.22 评论输入面板安全区修复

This commit is contained in:
Zhou Weidong committed 2026-10-21 15:00:26 +08:00
commit d39d8d43c1
2 files changed
+49

No files matched your search

@@ -224,6 +224,7 @@ class _CommentComposerSheetState extends State<CommentComposerSheet> {
),
child: SafeArea(
top: false,
bottom: false,
child: Padding(
padding: EdgeInsets.only(bottom: _pinnedKeyboardInset),
child: Padding(
@@ -469,6 +469,54 @@ void main() {
expect(tester.getBottomLeft(composer).dy, closeTo(844, 0.1));
});
testWidgets(
'should_keep_composer_input_position_when_safe_area_padding_changes',
(tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
tester.view.padding = const FakeViewPadding();
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.view.resetViewInsets);
addTearDown(tester.view.resetPadding);
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 input = find.byKey(const Key('comment-composer-input'));
tester.view.viewInsets = const FakeViewPadding(bottom: 180);
await tester.pump();
await tester.pump(const Duration(milliseconds: 90));
final keyboardUpInputRect = tester.getRect(input);
tester.view.viewInsets = const FakeViewPadding();
tester.view.padding = const FakeViewPadding(bottom: 48);
await tester.pumpAndSettle();
final keyboardClosedInputRect = tester.getRect(input);
expect(
keyboardClosedInputRect.top,
closeTo(keyboardUpInputRect.top, 0.1),
);
expect(
keyboardClosedInputRect.bottom,
closeTo(keyboardUpInputRect.bottom, 0.1),
);
expect(
keyboardClosedInputRect.height,
closeTo(keyboardUpInputRect.height, 0.1),
);
},
);
testWidgets(
'should_keep_composer_position_when_keyboard_insets_change_after_settling',
(tester) async {