提交 f990f8b0 编写于 作者: C Chris Bracken 提交者: GitHub

Add support for TextInputType.emailAddress (#3729)

Adds support for requesting a platform keyboard optimised for entering
email addresses.
上级 9af413ca
......@@ -80,9 +80,13 @@ public class TextInputPlugin implements MethodCallHandler {
return InputType.TYPE_CLASS_NUMBER;
if (inputType.equals("TextInputType.phone"))
return InputType.TYPE_CLASS_PHONE;
return obscureText
? InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
: InputType.TYPE_CLASS_TEXT;
int textType = InputType.TYPE_CLASS_TEXT;
if (inputType.equals("TextInputType.emailAddress"))
textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
if (obscureText)
textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
return textType;
}
public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs)
......
......@@ -16,6 +16,8 @@ static UIKeyboardType ToUIKeyboardType(NSString* inputType) {
return UIKeyboardTypeDecimalPad;
if ([inputType isEqualToString:@"TextInputType.phone"])
return UIKeyboardTypePhonePad;
if ([inputType isEqualToString:@"TextInputType.emailAddress"])
return UIKeyboardTypeEmailAddress;
return UIKeyboardTypeDefault;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册