PasswordFormBox constructor
PasswordFormBox({
- Key? key,
- AutovalidateMode? autovalidateMode,
- bool enabled = true,
- String? initialValue,
- FormFieldSetter<
String> ? onSaved, - String? restorationId,
- FormFieldValidator<
String> ? validator, - PasswordRevealMode revealMode = PasswordRevealMode.peek,
- FocusNode? focusNode,
- bool autofocus = false,
- bool readOnly = false,
- bool? showCursor,
- String obscuringCharacter = '•',
- TextEditingController? controller,
- double cursorWidth = 2.0,
- double? cursorHeight,
- Radius cursorRadius = const Radius.circular(2.0),
- Color? cursorColor,
- VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onFieldSubmitted, - Color? highlightColor,
- Color? errorHighlightColor,
- String? placeholder,
- TextStyle? placeholderStyle,
- Widget? leadingIcon,
Creates a FormField that contains a PasswordBox.
When a controller is specified, initialValue must be null (the
default). If controller is null, then a TextEditingController
will be constructed automatically and its text
will be initialized
to initialValue or the empty string.
For documentation about the various parameters, see the PasswordBox class and PasswordBox.new, the constructor.
Implementation
PasswordFormBox({
super.key,
super.autovalidateMode,
super.enabled,
super.initialValue,
super.onSaved,
super.restorationId,
super.validator,
PasswordRevealMode revealMode = PasswordRevealMode.peek,
FocusNode? focusNode,
bool autofocus = false,
bool readOnly = false,
bool? showCursor,
String obscuringCharacter = '•',
super.controller,
double cursorWidth = 2.0,
double? cursorHeight,
Radius cursorRadius = const Radius.circular(2.0),
Color? cursorColor,
VoidCallback? onEditingComplete,
ValueChanged<String>? onFieldSubmitted,
Color? highlightColor,
Color? errorHighlightColor,
String? placeholder,
TextStyle? placeholderStyle,
Widget? leadingIcon,
}) : super(builder: (FormFieldState<String> field) {
assert(debugCheckHasFluentTheme(field.context));
final theme = FluentTheme.of(field.context);
void onChangedHandler(String value) {
field.didChange(value);
}
return UnmanagedRestorationScope(
bucket: field.bucket,
child: FormRow(
padding: EdgeInsets.zero,
error: (field.errorText == null) ? null : Text(field.errorText!),
child: PasswordBox(
revealMode: revealMode,
focusNode: focusNode,
autofocus: autofocus,
readOnly: readOnly,
showCursor: showCursor,
obscuringCharacter: obscuringCharacter,
controller: controller,
cursorColor: cursorColor,
cursorHeight: cursorHeight,
cursorRadius: cursorRadius,
cursorWidth: cursorWidth,
enabled: enabled,
onEditingComplete: onEditingComplete,
onSubmitted: onFieldSubmitted,
onChanged: onChangedHandler,
highlightColor: (field.errorText == null)
? highlightColor
: errorHighlightColor ??
Colors.red.defaultBrushFor(theme.brightness),
placeholder: placeholder,
placeholderStyle: placeholderStyle,
leadingIcon: leadingIcon,
),
),
);
});