Skip to content

Commit bd09286

Browse files
authored
Improve auto-correct disabling on Android when obscureText is true (flutter#3731)
Some keyboards (e.g., on some Samsung devices, SwiftKey) ignore InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS and require InputType.TYPE_TEXT_VARIATION_PASSWORD.
1 parent 28e50a6 commit bd09286

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ private static int inputTypeFromTextInputType(String inputType, boolean obscureT
8686
textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
8787
else if (inputType.equals("TextInputType.url"))
8888
textType |= InputType.TYPE_TEXT_VARIATION_URI;
89-
if (obscureText)
89+
if (obscureText) {
90+
// Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS.
9091
textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
92+
textType |= InputType.TYPE_TEXT_VARIATION_PASSWORD;
93+
}
9194
return textType;
9295
}
9396

0 commit comments

Comments
 (0)