Improve auto-correct disabling on Android when obscureText is true (flutter/engine#3731)

Some keyboards (e.g., on some Samsung devices, SwiftKey) ignore
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS and require
InputType.TYPE_TEXT_VARIATION_PASSWORD.
This commit is contained in:
Chris Bracken
2017-06-02 15:50:23 -07:00
committed by GitHub
parent 4ac92f5b50
commit 4f3220eebc

View File

@@ -86,8 +86,11 @@ public class TextInputPlugin implements MethodCallHandler {
textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
else if (inputType.equals("TextInputType.url"))
textType |= InputType.TYPE_TEXT_VARIATION_URI;
if (obscureText)
if (obscureText) {
// Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS.
textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
textType |= InputType.TYPE_TEXT_VARIATION_PASSWORD;
}
return textType;
}