OptimusInputFormField constructor
OptimusInputFormField({
- Key? key,
- String? initialValue,
- TextEditingController? controller,
- FormFieldSetter<
String> ? onSaved, - FormFieldValidator<
String> ? validator, - AutovalidateMode? autovalidateMode,
- String? placeholder,
- TextInputType? keyboardType,
- bool isPasswordField = false,
- bool isEnabled = true,
- TextInputAction? textInputAction,
- ValueChanged<
String> ? onSubmitted, - FocusNode? focusNode,
- String? label,
- int maxLines = 1,
- int? minLines,
- bool enableInteractiveSelection = true,
- bool autofocus = false,
- bool autocorrect = true,
- bool hasBorders = true,
- bool isRequired = false,
- Widget? leading,
- Widget? suffix,
- Widget? prefix,
- Widget? trailing,
- Key? inputKey,
- bool readOnly = false,
- bool? showCursor,
- VoidCallback? onTap,
- TextAlign textAlign = TextAlign.start,
- TextCapitalization textCapitalization = TextCapitalization.none,
- Widget? caption,
- Widget? helperMessage,
- Brightness? keyboardAppearance,
- bool enableIMEPersonalizedLearning = false,
- bool enableSuggestions = true,
Implementation
OptimusInputFormField({
super.key,
String? initialValue,
this.controller,
super.onSaved,
super.validator,
super.autovalidateMode,
String? placeholder,
TextInputType? keyboardType,
bool isPasswordField = false,
bool isEnabled = true,
TextInputAction? textInputAction,
ValueChanged<String>? onSubmitted,
FocusNode? focusNode,
String? label,
int maxLines = 1,
int? minLines,
bool enableInteractiveSelection = true,
bool autofocus = false,
bool autocorrect = true,
bool hasBorders = true,
bool isRequired = false,
Widget? leading,
Widget? suffix,
Widget? prefix,
Widget? trailing,
Key? inputKey,
bool readOnly = false,
bool? showCursor,
VoidCallback? onTap,
TextAlign textAlign = TextAlign.start,
TextCapitalization textCapitalization = TextCapitalization.none,
Widget? caption,
Widget? helperMessage,
Brightness? keyboardAppearance,
bool enableIMEPersonalizedLearning = false,
bool enableSuggestions = true,
}) : assert(
initialValue == null || controller == null,
'Provide either initial value or controller',
),
super(
initialValue:
controller != null ? controller.text : (initialValue ?? ''),
enabled: isEnabled,
builder: (FormFieldState<String> field) {
final _InputFormFieldState state = field as _InputFormFieldState;
return OptimusInputField(
onChanged: field.didChange,
placeholder: placeholder,
keyboardType: keyboardType,
isPasswordField: isPasswordField,
isEnabled: isEnabled,
textInputAction: textInputAction,
onSubmitted: onSubmitted,
focusNode: focusNode,
label: label,
maxLines: maxLines,
minLines: minLines,
controller: state._effectiveController,
error: field.errorText,
enableInteractiveSelection: enableInteractiveSelection,
autofocus: autofocus,
autocorrect: autocorrect,
hasBorders: hasBorders,
isRequired: isRequired,
leading: leading,
prefix: prefix,
suffix: suffix,
trailing: trailing,
inputKey: inputKey,
readOnly: readOnly,
showCursor: showCursor,
onTap: onTap,
textAlign: textAlign,
textCapitalization: textCapitalization,
caption: caption,
helperMessage: helperMessage,
keyboardAppearance: keyboardAppearance,
enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
enableSuggestions: enableSuggestions,
);
},
);