PasswordInput class

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.

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."

PasswordInput(
  placeholder: 'API token',
  onSubmit: (text) => save(text),
)
Inheritance
Available extensions

Constructors

PasswordInput({Key? key, TextEditingController? controller, FocusNode? focusNode, bool autofocus = false, void onChanged(String text)?, void onSubmit(String text)?, void onEscape()?, String placeholder = '', CellStyle placeholderStyle = const CellStyle(dim: true), CellStyle style = CellStyle.none, CellStyle cursorStyle = const CellStyle(inverse: true), String obscuringCharacter = '•', bool enabled = true, bool readOnly = false, bool canReveal = true, KeySequence? revealChord, String? validationError, String? semanticLabel, SemanticState semanticState = SemanticState.empty})
const

Properties

autofocus → bool
Whether the field should request focus when mounted.
final
canReveal → bool
When true, revealChord toggles the masked / plain rendering while the field is focused.
final
controller → TextEditingController?
Text controller holding the unredacted secret value.
final
cursorStyle → CellStyle
Style applied to the cursor cell.
final
enabled → bool
Whether the field accepts focus and user input.
final
focusNode → FocusNode?
Focus node used by the underlying text input.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
finalinherited
obscuringCharacter → String
Glyph used in place of each typed grapheme. Defaults to •.
final
onChanged → void Function(String text)?
Called with the new unredacted text on every edit. See TextInput.onChanged.
final
onEscape → void Function()?
Called when Escape is pressed.
final
onSubmit → void Function(String text)?
Called with the unredacted text when the user submits.
final
placeholder → String
Placeholder text shown when the field is empty.
final
placeholderStyle → CellStyle
Style used for placeholder.
final
readOnly → bool
Whether the field can receive focus but not edit text.
final
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.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
Label exposed through the semantic app graph.
final
semanticState → SemanticState
Additional semantic metadata for app-specific secret fields.
final
style → CellStyle
Entered-text base styling, plus optional hover, focus, disabled, and invalid state entries from CellStyle.interactive.
final
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.
final

Methods

animate({Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate

Available on Widget, provided by the AnimateExtension extension

Starts an Animate chain over this widget. duration / curve apply to the whole chain. With no trigger it plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes.
createElement() → StatefulElement
Creates the Element that will mount this widget into the tree.
inherited
createState() → State<PasswordInput>
Creates the mutable state for this widget at the current location in the tree. Called exactly once per StatefulElement instance.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited