Skip to content

PasswordInput

A TextInput tuned for password / secret entry: every typed grapheme is rendered as a single • (or obscuringCharacter) regardless of what’s in the controller. The real text is unchanged; only the displayed glyphs are masked.

Learn more: Forms & validation

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

PasswordInput(
controller: controller,
semanticLabel: 'Password',
// Ctrl+R shows or hides the value while the field has focus.
)

When canReveal is set (the default), revealChord (Ctrl+R) toggles a show / hide state while the field is focused, so a user can sanity-check what they typed. The field consumes the chord, so it never reaches app-level shortcuts. The clipboard and the semantic value stay redacted even while revealed — revealing is a visual convenience only.

This is sugar over TextInput(obscureText: true) so the call site reads as “this is a password,” not “a text field that happens to be obscured.”

ParameterTypeDefaultDescription
controller:TextEditingController?—Text controller holding the unredacted secret value.
focusNode:FocusNode?—Focus node used by the underlying text input.
autofocus:boolfalseWhether the field should request focus when mounted.
onChanged:void Function(String text)?—Called with the new unredacted text on every edit. See TextInput.onChanged.
onSubmit:void Function(String text)?—Called with the unredacted text when the user submits.
onEscape:void Function()?—Called when Escape is pressed.
placeholder:String''Placeholder text shown when the field is empty.
placeholderStyle:CellStyleconst CellStyle(dim: true)Style used for placeholder.
style:CellStyleCellStyle.noneEntered-text base styling, plus optional hover, focus, disabled, and invalid state entries from CellStyle.interactive.
cursorStyle:CellStyleconst CellStyle(inverse: true)Style applied to the cursor cell.
obscuringCharacter:String'•'Glyph used in place of each typed grapheme. Defaults to •.
enabled:booltrueWhether the field accepts focus and user input.
readOnly:boolfalseWhether the field can receive focus but not edit text.
canReveal:booltrueWhen true, revealChord toggles the masked / plain rendering while the field is focused.
revealChord:KeySequence?—The sequence that toggles reveal. Defaults to Ctrl+R. The focused field consumes it, so it shadows any app-level binding on the same sequence.
validationError:String?—Marks the current value invalid: the field draws in the theme’s error style and reports this message through semantics, but doesn’t show the text. Inside a FormField, this message wins over the FormField’s validator, though not over its own error, and the FormField shows the winning message below the input.
semanticLabel:String?—Label exposed through the semantic app graph.
semanticState:SemanticStateSemanticState.emptyAdditional semantic metadata for app-specific secret fields. More
  • semanticState: Secret-field facts owned by PasswordInput, such as fieldType and redaction state, remain authoritative.

PasswordInput is defined in packages/fleury/lib/src/catalog/password_input.dart.

Category: Inputs & controls · All widgets