From 34b9f8685b9876d6c994ca00cae97094485a4896 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 7 Dec 2017 18:37:46 -0800 Subject: [PATCH] Expose keyboard height as view inset on iOS (flutter/engine#4428) Keyboard height is now treated as a view inset, which could be used to shrink the content area of the app as is done in the Material Scaffold, rather than padding, which is used to indicate content areas where user interaction should be avoided. --- .../ios/framework/Source/FlutterViewController.mm | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index ea84cb43f2..531e834711 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -641,9 +641,7 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to _viewportMetrics.physical_padding_top = self.view.safeAreaInsets.top * scale; _viewportMetrics.physical_padding_left = self.view.safeAreaInsets.left * scale; _viewportMetrics.physical_padding_right = self.view.safeAreaInsets.right * scale; - // TODO(cbracken): Once framework has been updated to use view insets for the keyboard, enable - // bottom safe area padding. - // _viewportMetrics.physical_padding_bottom = self.view.safeAreaInsets.bottom * scale; + _viewportMetrics.physical_padding_bottom = self.view.safeAreaInsets.bottom * scale; #pragma clang diagnostic pop } else { _viewportMetrics.physical_padding_top = [self statusBarPadding] * scale; @@ -657,19 +655,11 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to CGFloat bottom = CGRectGetHeight([[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]); CGFloat scale = [UIScreen mainScreen].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 { _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]; }