PasswordInput class
A secure password input field component for the Alter Design System built on InputControl.
Features:
- Clean surface with no left icon by default (
leftIcon: null, customizable). - Space-denial input formatting (
allowSpaces: falseby default). - Dynamic interactive eye toggle button (ButtonIconGhost) switching between visible and obscured text.
- Obscured text with
•bullet point characters. - Character limit counting and overflow handling.
- Configurable strength & complexity rules (min length, numbers, special characters, uppercase, lowercase).
- Full Flutter
FormField<String>integration supportingForm.validate().
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PasswordInput
Constructors
-
PasswordInput({Key? key, String? label = 'Password', bool isRequired = false, int? characterLimit, InputControlType type = InputControlType.gray, IconData? leftIcon, Widget? leftIconWidget, String? prefix, Widget? prefixWidget, String placeholder = 'Enter password', String? value, TextEditingController? controller, FocusNode? focusNode, String? suffix, Widget? suffixWidget, bool showEyeToggle = true, bool initiallyObscured = true, String obscuringCharacter = '•', ValueChanged<
bool> ? onToggleObscure, bool allowSpaces = false, List<TextInputFormatter> ? inputFormatters, int? minCharacters = 8, bool requireNumber = false, bool requireSpecialChar = false, bool requireUppercase = false, bool requireLowercase = false, bool autoValidateRules = true, String? minCharactersErrorText, String? requireNumberErrorText, String? requireSpecialCharErrorText, String? requireUppercaseErrorText, String? requireLowercaseErrorText, String? requiredErrorText, bool isError = false, bool showErrorMessage = true, String errorMessage = 'Error Message', List<String> ? errorMessages, Widget? errorIconWidget, FormFieldValidator<String> ? validator, FormFieldSetter<String> ? onSaved, AutovalidateMode? autovalidateMode, bool enabled = true, bool readOnly = false, bool autofocus = false, ValueChanged<String> ? onChanged, ValueChanged<String> ? onSubmitted, VoidCallback? onTap}) -
Creates a PasswordInput instance.
const
Properties
- allowSpaces → bool
-
Whether spaces are allowed in the password field.
final
- autofocus → bool
-
Whether the input field autofocuses.
final
- autovalidateMode → AutovalidateMode?
-
Autovalidate mode for form integration.
final
- autoValidateRules → bool
-
Whether built-in password validation rules run automatically.
final
- characterLimit → int?
-
Maximum allowed character limit counter displayed on typing.
final
- controller → TextEditingController?
-
External text editing controller.
final
- enabled → bool
-
Whether the password input is interactive.
final
- errorIconWidget → Widget?
-
Custom icon widget override for the error message banner.
final
- errorMessage → String
-
Default error message text.
final
-
errorMessages
→ List<
String> ? -
Optional list of multiple error messages.
final
- focusNode → FocusNode?
-
Focus node controlling input focus.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initiallyObscured → bool
-
Whether the text is initially masked.
final
-
inputFormatters
→ List<
TextInputFormatter> ? -
Formatters applied to the text field input.
final
- isError → bool
-
Whether the input is in an explicit error state.
final
- isRequired → bool
-
Whether to display a red required asterisk next to the label.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Label text displayed above the password field.
final
- leftIcon → IconData?
-
Leading icon data.
final
- leftIconWidget → Widget?
-
Custom leading widget override.
final
- minCharacters → int?
-
Minimum character count required for valid password.
final
- minCharactersErrorText → String?
-
Custom error message when minimum characters are not met.
final
- obscuringCharacter → String
-
Character used to mask obscured text (defaults to '•').
final
-
onChanged
→ ValueChanged<
String> ? -
Callback executed on value changes.
final
-
onSaved
→ FormFieldSetter<
String> ? -
Form field on-saved callback.
final
-
onSubmitted
→ ValueChanged<
String> ? -
Callback executed on keyboard submit.
final
- onTap → VoidCallback?
-
Callback executed when the input container is tapped.
final
-
onToggleObscure
→ ValueChanged<
bool> ? -
Callback executed when the visibility toggle is clicked.
final
- placeholder → String
-
Hint placeholder text.
final
- prefix → String?
-
Prefix text displayed before the input value.
final
- prefixWidget → Widget?
-
Custom prefix widget override.
final
- readOnly → bool
-
Whether the field is read-only.
final
- requiredErrorText → String?
-
Custom error message when required field is empty.
final
- requireLowercase → bool
-
Whether at least one lowercase letter is required.
final
- requireLowercaseErrorText → String?
-
Custom error message when required lowercase letter is missing.
final
- requireNumber → bool
-
Whether at least one digit is required.
final
- requireNumberErrorText → String?
-
Custom error message when required number is missing.
final
- requireSpecialChar → bool
-
Whether at least one special character is required.
final
- requireSpecialCharErrorText → String?
-
Custom error message when required special character is missing.
final
- requireUppercase → bool
-
Whether at least one uppercase letter is required.
final
- requireUppercaseErrorText → String?
-
Custom error message when required uppercase letter is missing.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showErrorMessage → bool
-
Whether to render the error message beneath the field.
final
- showEyeToggle → bool
-
Whether the eye show/hide password toggle button is displayed.
final
- suffix → String?
-
Suffix descriptor text displayed at the trailing end.
final
- suffixWidget → Widget?
-
Custom suffix widget override.
final
- type → InputControlType
-
Surface background and border style variant.
final
-
validator
→ FormFieldValidator<
String> ? -
Form field validation callback.
final
- value → String?
-
Initial or bound value string.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PasswordInput> -
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
-
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
Constants
- version → const String
- Component version for reference. v2.2.1: Fixed isRequired trigger lifecycle: Defer required error until blur (unfocus after focus) or explicit typing & clearing, preventing immediate error upon clicking into an empty field. v2.2.0: Removed default leftIcon (defaults to null); added allowSpaces formatter (deny spaces by default); added configurable password strength validation rules (minCharacters, requireNumber, requireSpecialChar, requireUppercase, requireLowercase); full characterLimit overflow support. v2.1.0: Aligned with InputControl v2.1.0 & TextInput v2.1.0 (removed showLabel/showCharacterLimit; labelBar renders when label is provided). v2.0.0: Aligned with InputControl v2.0.0 & TextInput v2.0.0 (removed statusOverride and redundant hasX booleans in favor of clean nullable props). v1.0.0: Initial release of PasswordInput wrapper built on TextInput with ButtonIconGhost eye toggle.