TextInputField<TDestination> constructor

TextInputField<TDestination>({
  1. required FieldModel<String?, TDestination> field,
  2. required String labelText,
  3. void onFieldSubmitted(
    1. String
    )?,
  4. ITranslator? translator,
  5. String? helperText,
  6. String? hintText,
  7. int helperMaxLines = 2,
  8. AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction,
  9. Key? key,
  10. TextEditingController? controller,
  11. TextInputType? keyboardType,
  12. TextInputAction? textInputAction,
  13. TextCapitalization textCapitalization = TextCapitalization.none,
  14. TextStyle? style,
  15. StrutStyle? strutStyle,
  16. TextAlign textAlign = TextAlign.start,
  17. TextAlignVertical? textAlignVertical,
  18. TextDirection? textDirection,
  19. bool readOnly = false,
  20. ToolbarOptions? toolbarOptions,
  21. bool? showCursor,
  22. bool autofocus = false,
  23. String obscuringCharacter = '•',
  24. bool obscureText = false,
  25. bool autocorrect = true,
  26. SmartDashesType smartDashesType = SmartDashesType.disabled,
  27. SmartQuotesType smartQuotesType = SmartQuotesType.disabled,
  28. bool enableSuggestions = true,
  29. int? maxLines,
  30. int? minLines,
  31. bool expands = false,
  32. int? maxLength,
  33. List<TextInputFormatter>? inputFormatters,
  34. bool enabled = true,
  35. double cursorWidth = 2.0,
  36. double? cursorHeight,
  37. Radius? cursorRadius,
  38. Color? cursorColor,
  39. BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  40. BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  41. Brightness? keyboardAppearance,
  42. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  43. bool enableInteractiveSelection = true,
  44. TextSelectionControls? selectionControls,
  45. GestureTapCallback? onTap,
  46. InputCounterWidgetBuilder? buildCounter,
  47. ScrollController? scrollController,
  48. ScrollPhysics? scrollPhysics,
  49. Iterable<String>? autofillHints,
  50. String? restorationId,
  51. MaxLengthEnforcement? maxLengthEnforcement,
  52. FocusNode? focusNode,
})

Implementation

TextInputField(
    {required this.field,
    required String labelText,
    void Function(String)? onFieldSubmitted,
    ITranslator? translator,
    String? helperText,
    String? hintText,
    int helperMaxLines = 2,
    AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction,
    Key? key,
    TextEditingController? controller,
    TextInputType? keyboardType,
    TextInputAction? textInputAction,
    TextCapitalization textCapitalization = TextCapitalization.none,
    TextStyle? style,
    StrutStyle? strutStyle,
    TextAlign textAlign = TextAlign.start,
    TextAlignVertical? textAlignVertical,
    TextDirection? textDirection,
    bool readOnly = false,
    ToolbarOptions? toolbarOptions,
    bool? showCursor,
    bool autofocus = false,
    String obscuringCharacter = '•',
    bool obscureText = false,
    bool autocorrect = true,
    SmartDashesType smartDashesType = SmartDashesType.disabled,
    SmartQuotesType smartQuotesType = SmartQuotesType.disabled,
    bool enableSuggestions = true,
    int? maxLines,
    int? minLines,
    bool expands = false,
    int? maxLength,
    List<TextInputFormatter>? inputFormatters,
    bool enabled = true,
    double cursorWidth = 2.0,
    double? cursorHeight,
    Radius? cursorRadius,
    Color? cursorColor,
    BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
    BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
    Brightness? keyboardAppearance,
    EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
    bool enableInteractiveSelection = true,
    TextSelectionControls? selectionControls,
    GestureTapCallback? onTap,
    InputCounterWidgetBuilder? buildCounter,
    ScrollController? scrollController,
    ScrollPhysics? scrollPhysics,
    Iterable<String>? autofillHints,
    String? restorationId,
    MaxLengthEnforcement? maxLengthEnforcement,
    FocusNode? focusNode})
    : this.focusNode = focusNode ?? FocusNode(),
      super(
        initialValue: field.sourceValue,
        autocorrect: autocorrect,
        autofillHints: autofillHints,
        autofocus: autofocus,
        autovalidateMode: autovalidateMode,
        buildCounter: buildCounter,
        controller: controller,
        cursorColor: cursorColor,
        cursorHeight: cursorHeight,
        cursorRadius: cursorRadius,
        cursorWidth: cursorWidth,
        enableInteractiveSelection: enableInteractiveSelection,
        decoration: InputDecoration(
            labelText: labelText,
            helperText: helperText,
            helperMaxLines: helperMaxLines,
            hintText: hintText),
        enableSuggestions: enableSuggestions,
        enabled: enabled,
        expands: expands,
        focusNode: focusNode,
        inputFormatters: inputFormatters,
        key: key,
        keyboardAppearance: keyboardAppearance,
        keyboardType: keyboardType,
        maxLength: maxLength,
        maxLengthEnforcement: maxLengthEnforcement,
        maxLines: !obscureText ? maxLines : 1,
        minLines: minLines,
        obscureText: obscureText,
        obscuringCharacter: obscuringCharacter,
        onChanged: field.setValue,
        onFieldSubmitted: (value) {
          field.post();
          if (onFieldSubmitted != null) onFieldSubmitted(value);
        },
        onSaved: (value) => field.post(),
        onTap: onTap,
        readOnly: readOnly,
        scrollPadding: scrollPadding,
        scrollPhysics: scrollPhysics,
        selectionControls: selectionControls,
        showCursor: showCursor,
        smartDashesType: smartDashesType,
        smartQuotesType: smartQuotesType,
        strutStyle: strutStyle,
        style: style,
        textAlign: textAlign,
        textAlignVertical: textAlignVertical,
        textCapitalization: textCapitalization,
        textDirection: textDirection,
        textInputAction: textInputAction,
        toolbarOptions: toolbarOptions,
        validator: (value) => field.validator(value, translator: translator),
      ) {
  this.focusNode.addListener(onFocusNode);
}