TextFieldState constructor
TextFieldState(
- String? value, {
- required String label,
- String? error,
- List<
ValidationRule< rules = const [],String?> > - bool validateOnUpdate = true,
- bool touched = false,
- TextEditingController? controller,
- FocusNode? focusNode,
Creates a new instance of TextFieldState.
value: The initial value of the text input field.label: The label or name of the text input form field (required).rules: The list of validation rules to apply to the text field (default is an empty list).validateOnUpdate: Indicates whether validation should occur on updates (default istrue).touched: Indicates whether the field has been touched (interacted with) by the user (default isfalse).controller: Optionally provide your own TextEditingController. If not provided, one will be created.
Implementation
TextFieldState(
String? value, {
required String label,
String? error,
List<ValidationRule<String?>> rules = const [],
bool validateOnUpdate = true,
bool touched = false,
widgets.TextEditingController? controller,
widgets.FocusNode? focusNode,
}) : _controller = controller ??
widgets.TextEditingController.fromValue(
widgets.TextEditingValue(
text: value ?? '',
selection: value != null
? widgets.TextSelection.collapsed(offset: value.length)
: const widgets.TextSelection.collapsed(offset: 0),
),
),
_focusNode = focusNode ?? widgets.FocusNode(),
super(
value: value,
error: error,
label: label,
rules: rules,
validateOnUpdate: validateOnUpdate,
touched: touched,
);