Skip to content

Add numeric-password variation to TextInputType.numberWithOptions - #190637

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
AlexV525:numeric-password-framework
Aug 18, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:masterfrom
AlexV525:numeric-password-framework

Conversation

@AlexV525

@AlexV525 AlexV525 commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

Working towards #190204.

Framework companion to the engine/embedding change in #190207.

Summary

Adds a password parameter to TextInputType.numberWithOptions, symmetric to the existing visiblePassword text-class variation.

const TextInputType.numberWithOptions({
  this.signed = false,
  this.decimal = false,
  this.password = false,   // NEW
});

On Android this maps to TYPE_NUMBER_VARIATION_PASSWORD, which the embedding now parses via json.optBoolean("password", false) and ORs into the NUMBER branch of TextInputPlugin.inputTypeFromTextInputType (#190207). It has no effect on iOS, web, or desktop.

password: true declares the platform input classification only. It does not obscure the glyphs Flutter renders — that remains the responsibility of obscureText.

Backward compatibility

  • Additive; default false; existing TextInputType.number and numberWithOptions(...) callers are byte-for-byte unchanged.
  • JSON is additive — older engines ignore the extra password key.
  • No change to obscureText, AutofillHints, or enableIMEPersonalizedLearning semantics.

toJson, operator ==, hashCode, toString, and dartdoc are updated accordingly.

Landing order

Per Tree Hygiene the engine JSON parsing + Android mapping (#190207, merged) lands first; this framework field follows once the engine revision is rolled into the framework.

Pre-launch Checklist

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Aug 6, 2026
@AlexV525
AlexV525 marked this pull request as ready for review August 6, 2026 01:43

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a password parameter to TextInputType.numberWithOptions to support numeric password inputs, updating serialization, string representation, equality, and hashing. The feedback suggests adding a test case to verify that password: true is correctly serialized to JSON, as the current test updates only cover null and false cases.

Comment thread packages/flutter/test/services/text_input_test.dart
@AlexV525

Copy link
Copy Markdown
Member Author

fyi @Renzo-Olivares

@Renzo-Olivares Renzo-Olivares left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, we should add a TextInputType.password check for EditableTextState._isPasswordInput so spell check remains disabled for this new TextInputType.

static bool _isPasswordInput({
required bool obscureText,
required TextInputType keyboardType,
required Iterable<String>? autofillHints,
}) {
return obscureText ||
keyboardType == TextInputType.visiblePassword ||
(autofillHints?.any(
(String hint) => hint == AutofillHints.password || hint == AutofillHints.newPassword,
) ??
false);
}

@Renzo-Olivares Renzo-Olivares added waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds CICD Run CI/CD labels Aug 17, 2026
@AlexV525

Copy link
Copy Markdown
Member Author

Done in af4e8a3 — _isPasswordInput now also checks keyboardType.password == true (covers all numeric-password combinations, not just the exact numberWithOptions(password: true)), with a matching spell-check test. Doc template updated.

@github-actions github-actions Bot removed the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 17, 2026
Comment thread packages/flutter/lib/src/widgets/editable_text.dart Outdated
@AlexV525

Copy link
Copy Markdown
Member Author

Fixed in 5f7a90f — dartdoc can't resolve chained references like [keyboardType.password], so it now links [TextInputType.password] directly. Verified with a local dev/bots/docs.sh run: 0 warnings, 0 errors.

@Renzo-Olivares Renzo-Olivares added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 18, 2026

@Renzo-Olivares Renzo-Olivares left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the contribution @AlexV525!

@Renzo-Olivares Renzo-Olivares added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2026
@AlexV525 AlexV525 removed the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 18, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 18, 2026
Merged via the queue into flutter:master with commit 3527084 Aug 18, 2026
28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2026
@AlexV525
AlexV525 deleted the numeric-password-framework branch August 18, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants