未验证 提交 a94e8820 编写于 作者: C Chris Bracken 提交者: GitHub

Set window.viewInsets.bottom to keyboard height on iOS (#4420)

This allows for us to start migrating framework classes (notably
Scaffold) to use window.viewInsets.bottom to get the keyboard height.
Once framework updates have landed, we will land an engine patch to
expose the iOS bottom safe area inset as padding.

This change is already landed for Android.

Related issue: flutter/flutter#12098
上级 affa4e7c
......@@ -656,17 +656,19 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
NSDictionary* info = [notification userInfo];
CGFloat bottom = CGRectGetHeight([[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]);
CGFloat scale = [UIScreen mainScreen].scale;
// TODO(cbracken): Once framework has been updated to use view insets, keyboard should change
// insets rather than padding.
// _viewportMetrics.physical_view_inset_bottom = bottom * scale;
_viewportMetrics.physical_view_inset_bottom = bottom * scale;
// TODO(cbracken): Once framework has been updated to use view insets for keyboard padding,
// eliminate this line.
_viewportMetrics.physical_padding_bottom = bottom * scale;
[self updateViewportMetrics];
}
- (void)keyboardWillBeHidden:(NSNotification*)notification {
// TODO(cbracken): Once framework has been updated to use view insets, keyboard should change
// insets rather than padding.
// _viewportMetrics.physical_view_inset_bottom = 0;
_viewportMetrics.physical_view_inset_bottom = 0;
// TODO(cbracken): Once framework has been updated to use view insets for keyboard padding,
// eliminate this line.
_viewportMetrics.physical_padding_bottom = 0;
[self updateViewportMetrics];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册