PasswordBox class
A fluent design input form for password.
A password box is a text input box that conceals the characters typed into it for the purpose of privacy. A password box looks like a text box, except that it renders placeholder characters in place of the text that has been entered. You can configure the placeholder character.
See also:
- learn.microsoft.com/en-us/windows/apps/design/controls/password-box
- PasswordRevealMode, the different modes that the password box can have
- TextBox, the underlaying widget that renders the text box
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PasswordBox
- Available extensions
Constructors
-
PasswordBox({Key? key, TextEditingController? controller, VoidCallback? onEditingComplete, ValueChanged<
String> ? onSubmitted, ValueChanged<String> ? onChanged, FocusNode? focusNode, bool enabled = true, String? placeholder, PasswordRevealMode revealMode = PasswordRevealMode.peek, bool autofocus = false, Widget? leadingIcon, TextStyle? placeholderStyle, double cursorWidth = 1.5, Radius cursorRadius = const Radius.circular(2.0), double? cursorHeight, Color? cursorColor, bool? showCursor, bool readOnly = false, String obscuringCharacter = '•', WidgetStateProperty<BoxDecoration> ? decoration, WidgetStateProperty<BoxDecoration> ? foregroundDecoration, Color? unfocusedColor, Color? highlightColor, Brightness? keyboardAppearance, TextAlign textAlign = TextAlign.start, TextAlignVertical? textAlignVertical, TextStyle? style, EdgeInsetsGeometry padding = kTextBoxPadding, ScrollController? scrollController, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), ScrollPhysics? scrollPhysics}) -
Creates a password box
const
Properties
- autofocus → bool
-
Whether this text field should focus itself if nothing else is already
focused.
final
- controller → TextEditingController?
-
Controls the text being edited.
final
- cursorColor → Color?
-
The color of the cursor.
final
- cursorHeight → double?
-
How tall the cursor will be.
final
- cursorRadius → Radius
-
How rounded the corners of the cursor should be.
final
- cursorWidth → double
-
How thick the cursor will be.
final
-
decoration
→ WidgetStateProperty<
BoxDecoration> ? -
Controls the BoxDecoration of the box behind the text input.
final
- enabled → bool
-
Disables the text field when false.
final
- focusNode → FocusNode?
-
An optional focus node to use as the focus node for this widget.
final
-
foregroundDecoration
→ WidgetStateProperty<
BoxDecoration> ? -
Controls the BoxDecoration of the box in front of the text input.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightColor → Color?
-
The highlight color of the text box.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardAppearance → Brightness?
-
The appearance of the keyboard.
final
- leadingIcon → Widget?
-
A widget displayed at the start of the text box
final
- obscuringCharacter → String
-
Character used for obscuring text if
obscureText
is true.final -
onChanged
→ ValueChanged<
String> ? -
Called when the user initiates a change to the TextField's
value: when they have inserted or deleted text.
final
- onEditingComplete → VoidCallback?
-
Called when the user submits editable content (e.g., user presses the "done"
button on the keyboard).
final
-
onSubmitted
→ ValueChanged<
String> ? -
Called when the user indicates that they are done editing the text in the
field.
final
- padding → EdgeInsetsGeometry
-
Padding around the text entry area between the
prefix
andsuffix
.final - placeholder → String?
-
The text shown when the text box is empty
final
- placeholderStyle → TextStyle?
-
The style of placeholder
final
- readOnly → bool
-
Whether the text can be changed.
final
- revealMode → PasswordRevealMode
-
The reveal mode determine how the password is visible or obscured.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
The ScrollController to use when vertically scrolling the input.
final
- scrollPadding → EdgeInsets
-
Configures the padding for the edges surrounding a Scrollable when the
text field scrolls into view.
final
- scrollPhysics → ScrollPhysics?
-
The ScrollPhysics to use when vertically scrolling the input.
final
- showCursor → bool?
-
Whether to show cursor.
final
- style → TextStyle?
-
The style to use for the text being edited.
final
- textAlign → TextAlign
-
How the text should be aligned horizontally.
final
- textAlignVertical → TextAlignVertical?
-
How the text should be aligned vertically.
final
- unfocusedColor → Color?
-
The unfocused color of the highlight border.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PasswordBox> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
getProperty<
T> ([dynamic def]) → T? -
Available on Widget, provided by the ItemExtension extension
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited