From 621d051cface962c1f0aa523888e9b3999a53110 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 2 Jun 2017 15:13:37 -0700 Subject: [PATCH] Add support for TextInputType.url (flutter/engine#3730) Adds support for requesting a platform keyboard optimised for entering URLs. --- .../android/io/flutter/plugin/editing/TextInputPlugin.java | 2 ++ .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 2 ++ 2 files changed, 4 insertions(+) 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 9cbd823bf9..4d517522fd 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 @@ -84,6 +84,8 @@ public class TextInputPlugin implements MethodCallHandler { int textType = InputType.TYPE_CLASS_TEXT; if (inputType.equals("TextInputType.emailAddress")) textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; + else if (inputType.equals("TextInputType.url")) + textType |= InputType.TYPE_TEXT_VARIATION_URI; if (obscureText) textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; 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 f80cf49e70..8a27efb5fc 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 @@ -18,6 +18,8 @@ static UIKeyboardType ToUIKeyboardType(NSString* inputType) { return UIKeyboardTypePhonePad; if ([inputType isEqualToString:@"TextInputType.emailAddress"]) return UIKeyboardTypeEmailAddress; + if ([inputType isEqualToString:@"TextInputType.url"]) + return UIKeyboardTypeURL; return UIKeyboardTypeDefault; }