From afbc193bde57e08f76985fb3ecec29947505ec2e Mon Sep 17 00:00:00 2001 From: 5u3it Date: Fri, 20 Oct 2017 02:26:35 +0530 Subject: [PATCH] Native keyboard behavior update for multiline input (flutter/engine#4234) Use sentence capitalization for non-obscuretext fields of TextInputType.text and TextInputType.multiline on iOS and Android. --- .../android/io/flutter/plugin/editing/TextInputPlugin.java | 5 ++++- .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index f4c2e7279a4..0e553544e7c 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -98,8 +98,11 @@ public class TextInputPlugin implements MethodCallHandler { // Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS. textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; textType |= InputType.TYPE_TEXT_VARIATION_PASSWORD; - } else if (autocorrect) { + } else { + if (autocorrect) textType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; + if (inputType.equals("TextInputType.text") || inputType.equals("TextInputType.multiline")) + textType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } return textType; } diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index a1640d11551..8b91a498db0 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -34,6 +34,8 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) { static UITextAutocapitalizationType ToUITextAutocapitalizationType(NSString* inputType) { if ([inputType isEqualToString:@"TextInputType.text"]) return UITextAutocapitalizationTypeSentences; + if ([inputType isEqualToString:@"TextInputType.multiline"]) + return UITextAutocapitalizationTypeSentences; return UITextAutocapitalizationTypeNone; }