fix(player): 去除评论输入面板安全区导致的收键盘位移
This commit is contained in:
1 parent
036bd29855
commit
3fbfa9ab81
2 files changed
+49
No files matched your search
@@ -224,6 +224,7 @@ class _CommentComposerSheetState extends State<CommentComposerSheet> {
|
|||||||
),
|
),
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
top: false,
|
top: false,
|
||||||
|
bottom: false,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: _pinnedKeyboardInset),
|
padding: EdgeInsets.only(bottom: _pinnedKeyboardInset),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
@@ -469,6 +469,54 @@ void main() {
|
|||||||
expect(tester.getBottomLeft(composer).dy, closeTo(844, 0.1));
|
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(
|
testWidgets(
|
||||||
'should_keep_composer_position_when_keyboard_insets_change_after_settling',
|
'should_keep_composer_position_when_keyboard_insets_change_after_settling',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
|
|||||||
Reference in new issue
Block a user