Add support for TextInputType.url (flutter/engine#3730)

Adds support for requesting a platform keyboard optimised for entering
URLs.
This commit is contained in:
Chris Bracken
2017-06-02 15:13:37 -07:00
committed by GitHub
parent 0d10984a47
commit 621d051cfa
2 changed files with 4 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;
}