OptimusInputFormField constructor

OptimusInputFormField({
  1. Key? key,
  2. String? initialValue,
  3. TextEditingController? controller,
  4. FormFieldSetter<String>? onSaved,
  5. FormFieldValidator<String>? validator,
  6. AutovalidateMode? autovalidateMode,
  7. String? placeholder,
  8. TextInputType? keyboardType,
  9. bool isPasswordField = false,
  10. bool isEnabled = true,
  11. TextInputAction? textInputAction,
  12. ValueChanged<String>? onSubmitted,
  13. FocusNode? focusNode,
  14. String? label,
  15. int maxLines = 1,
  16. int? minLines,
  17. bool enableInteractiveSelection = true,
  18. bool autofocus = false,
  19. bool autocorrect = true,
  20. bool hasBorders = true,
  21. bool isRequired = false,
  22. Widget? leading,
  23. Widget? suffix,
  24. Widget? prefix,
  25. Widget? trailing,
  26. Key? inputKey,
  27. bool readOnly = false,
  28. bool? showCursor,
  29. VoidCallback? onTap,
  30. TextAlign textAlign = TextAlign.start,
  31. TextCapitalization textCapitalization = TextCapitalization.none,
  32. Widget? caption,
  33. Widget? helperMessage,
  34. Brightness? keyboardAppearance,
  35. bool enableIMEPersonalizedLearning = false,
  36. 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,
          );
        },
      );