ShadInputFormField constructor

ShadInputFormField({
  1. String? id,
  2. Key? key,
  3. FormFieldSetter<String>? onSaved,
  4. String? forceErrorText,
  5. String? validator(
    1. String
    )?,
  6. String? initialValue,
  7. bool enabled = true,
  8. AutovalidateMode? autovalidateMode,
  9. String? restorationId,
  10. TextEditingController? controller,
  11. Widget? label,
  12. Widget error(
    1. String error
    )?,
  13. Widget? description,
  14. void onChanged(
    1. String
    )?,
  15. @Deprecated('Use toValueTransformer instead') ToValueTransformer<String?>? valueTransformer,
  16. ToValueTransformer<String?>? toValueTransformer,
  17. FromValueTransformer<String?>? fromValueTransformer,
  18. VoidCallback? onReset,
  19. FocusNode? focusNode,
  20. ShadDecoration? decoration,
  21. Widget? placeholder,
  22. TextMagnifierConfiguration magnifierConfiguration = TextMagnifierConfiguration.disabled,
  23. TextInputType? keyboardType,
  24. TextInputAction? textInputAction,
  25. TextCapitalization textCapitalization = TextCapitalization.none,
  26. TextStyle? style,
  27. StrutStyle? strutStyle,
  28. TextAlign textAlign = TextAlign.start,
  29. TextDirection? textDirection,
  30. bool autofocus = false,
  31. String obscuringCharacter = '•',
  32. bool obscureText = false,
  33. bool autocorrect = true,
  34. SmartDashesType? smartDashesType,
  35. SmartQuotesType? smartQuotesType,
  36. bool enableSuggestions = true,
  37. int? maxLines = 1,
  38. int? minLines,
  39. bool expands = false,
  40. bool readOnly = false,
  41. bool? showCursor,
  42. int? maxLength,
  43. MaxLengthEnforcement? maxLengthEnforcement,
  44. VoidCallback? onEditingComplete,
  45. ValueChanged<String>? onSubmitted,
  46. AppPrivateCommandCallback? onAppPrivateCommand,
  47. List<TextInputFormatter>? inputFormatters,
  48. double? cursorWidth,
  49. double? cursorHeight,
  50. Radius? cursorRadius,
  51. bool? cursorOpacityAnimates,
  52. Color? cursorColor,
  53. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  54. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  55. Brightness? keyboardAppearance,
  56. EdgeInsets scrollPadding = const EdgeInsets.all(20),
  57. bool? enableInteractiveSelection,
  58. TextSelectionControls? selectionControls,
  59. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  60. GestureTapCallback? onPressed,
  61. bool onPressedAlwaysCalled = false,
  62. TapRegionCallback? onPressedOutside,
  63. MouseCursor? mouseCursor,
  64. ScrollPhysics? scrollPhysics,
  65. ScrollController? scrollController,
  66. Iterable<String>? autofillHints,
  67. Clip clipBehavior = Clip.hardEdge,
  68. bool scribbleEnabled = true,
  69. bool enableIMEPersonalizedLearning = true,
  70. ContentInsertionConfiguration? contentInsertionConfiguration,
  71. EditableTextContextMenuBuilder? contextMenuBuilder,
  72. UndoHistoryController? undoController,
  73. SpellCheckConfiguration? spellCheckConfiguration,
  74. Color? selectionColor,
  75. EdgeInsetsGeometry? padding,
  76. Widget? leading,
  77. Widget? trailing,
  78. MainAxisAlignment? mainAxisAlignment,
  79. CrossAxisAlignment? crossAxisAlignment,
  80. TextStyle? placeholderStyle,
  81. AlignmentGeometry? alignment,
  82. AlignmentGeometry? placeholderAlignment,
  83. EdgeInsetsGeometry? inputPadding,
  84. double? gap,
  85. BoxConstraints? constraints,
  86. Object? groupId,
  87. WidgetBuilder? keyboardToolbarBuilder,
  88. Widget? top,
  89. Widget? bottom,
  90. ValueChanged<int>? onLineCountChange,
  91. Size? editableTextSize,
  92. bool? useBrowserContextMenu,
  93. ValueChanged<List<ShadClipboardItem>>? onPasteFiles,
  94. ValueChanged<Object>? onPasteFilesError,
})

Implementation

ShadInputFormField({
  super.id,
  super.key,
  super.onSaved,
  super.forceErrorText,
  String? Function(String)? validator,
  String? initialValue,
  super.enabled,
  super.autovalidateMode,
  super.restorationId,
  this.controller,
  super.label,
  super.error,
  super.description,
  void Function(String)? onChanged,
  @Deprecated('Use toValueTransformer instead') super.valueTransformer,
  super.toValueTransformer,
  super.fromValueTransformer,
  super.onReset,
  super.focusNode,

  /// {@macro ShadInput.decoration}
  ShadDecoration? decoration,

  /// {@macro ShadInput.placeholder}
  Widget? placeholder,

  /// {@macro ShadInput.magnifierConfiguration}
  TextMagnifierConfiguration magnifierConfiguration =
      TextMagnifierConfiguration.disabled,

  /// {@macro ShadInput.keyboardType}
  TextInputType? keyboardType,

  /// {@macro ShadInput.textInputAction}
  TextInputAction? textInputAction,

  /// {@macro ShadInput.textCapitalization}
  TextCapitalization textCapitalization = TextCapitalization.none,

  /// {@macro ShadInput.style}
  TextStyle? style,

  /// {@macro ShadInput.strutStyle}
  StrutStyle? strutStyle,

  /// {@macro ShadInput.textAlign}
  TextAlign textAlign = TextAlign.start,

  /// {@macro ShadInput.textDirection}
  TextDirection? textDirection,

  /// {@macro ShadInput.autofocus}
  bool autofocus = false,

  /// {@macro ShadInput.obscuringCharacter}
  String obscuringCharacter = '•',

  /// {@macro ShadInput.obscureText}
  bool obscureText = false,

  /// {@macro ShadInput.autocorrect}
  bool autocorrect = true,

  /// {@macro ShadInput.smartDashesType}
  SmartDashesType? smartDashesType,

  /// {@macro ShadInput.smartQuotesType}
  SmartQuotesType? smartQuotesType,

  /// {@macro ShadInput.enableSuggestions}
  bool enableSuggestions = true,

  /// {@macro ShadInput.maxLines}
  int? maxLines = 1,

  /// {@macro ShadInput.minLines}
  int? minLines,

  /// {@macro ShadInput.expands}
  bool expands = false,

  /// {@macro ShadFormBuilderField.readOnly}
  super.readOnly,

  /// {@macro ShadInput.showCursor}
  bool? showCursor,

  /// {@macro ShadInput.maxLength}
  int? maxLength,

  /// {@macro ShadInput.maxLengthEnforcement}
  MaxLengthEnforcement? maxLengthEnforcement,

  /// {@macro ShadInput.onEditingComplete}
  VoidCallback? onEditingComplete,

  /// {@macro ShadInput.onSubmitted}
  ValueChanged<String>? onSubmitted,

  /// {@macro ShadInput.onAppPrivateCommand}
  AppPrivateCommandCallback? onAppPrivateCommand,

  /// {@macro ShadInput.inputFormatters}
  List<TextInputFormatter>? inputFormatters,

  /// {@macro ShadInput.cursorWidth}
  double? cursorWidth,

  /// {@macro ShadInput.cursorHeight}
  double? cursorHeight,

  /// {@macro ShadInput.cursorRadius}
  Radius? cursorRadius,

  /// {@macro ShadInput.cursorOpacityAnimates}
  bool? cursorOpacityAnimates,

  /// {@macro ShadInput.cursorColor}
  Color? cursorColor,

  /// {@macro ShadInput.selectionHeightStyle}
  ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,

  /// {@macro ShadInput.selectionWidthStyle}
  ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,

  /// {@macro ShadInput.keyboardAppearance}
  Brightness? keyboardAppearance,

  /// {@macro ShadInput.scrollPadding}
  EdgeInsets scrollPadding = const EdgeInsets.all(20),

  /// {@macro ShadInput.enableInteractiveSelection}
  bool? enableInteractiveSelection,

  /// {@macro ShadInput.selectionControls}
  TextSelectionControls? selectionControls,

  /// {@macro ShadInput.dragStartBehavior}
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,

  /// {@macro ShadInput.onPressed}
  GestureTapCallback? onPressed,

  /// {@macro ShadInput.onPressedAlwaysCalled}
  bool onPressedAlwaysCalled = false,

  /// {@macro ShadInput.onPressedOutside}
  TapRegionCallback? onPressedOutside,

  /// {@macro ShadInput.mouseCursor}
  MouseCursor? mouseCursor,

  /// {@macro ShadInput.scrollPhysics}
  ScrollPhysics? scrollPhysics,

  /// {@macro ShadInput.scrollController}
  ScrollController? scrollController,

  /// {@macro ShadInput.autofillHints}
  Iterable<String>? autofillHints,

  /// {@macro ShadInput.clipBehavior}
  Clip clipBehavior = Clip.hardEdge,

  /// {@macro ShadInput.scribbleEnabled}
  bool scribbleEnabled = true,

  /// {@macro ShadInput.enableIMEPersonalizedLearning}
  bool enableIMEPersonalizedLearning = true,

  /// {@macro ShadInput.contentInsertionConfiguration}
  ContentInsertionConfiguration? contentInsertionConfiguration,

  /// {@macro ShadInput.contextMenuBuilder}
  EditableTextContextMenuBuilder? contextMenuBuilder,

  /// {@macro ShadInput.undoController}
  UndoHistoryController? undoController,

  /// {@macro ShadInput.spellCheckConfiguration}
  SpellCheckConfiguration? spellCheckConfiguration,

  /// {@macro ShadInput.selectionColor}
  Color? selectionColor,

  /// {@macro ShadInput.padding}
  EdgeInsetsGeometry? padding,

  /// {@macro ShadInput.leading}
  Widget? leading,

  /// {@macro ShadInput.trailing}
  Widget? trailing,

  /// {@macro ShadInput.mainAxisAlignment}
  MainAxisAlignment? mainAxisAlignment,

  /// {@macro ShadInput.crossAxisAlignment}
  CrossAxisAlignment? crossAxisAlignment,

  /// {@macro ShadInput.placeholderStyle}
  TextStyle? placeholderStyle,

  /// {@macro ShadInput.alignment}
  AlignmentGeometry? alignment,

  /// {@macro ShadInput.placeholderAlignment}
  AlignmentGeometry? placeholderAlignment,

  /// {@macro ShadInput.inputPadding}
  EdgeInsetsGeometry? inputPadding,

  /// {@macro ShadInput.gap}
  double? gap,

  /// {@macro ShadInput.constraints}
  BoxConstraints? constraints,

  /// {@macro flutter.widgets.editableText.groupId}
  Object? groupId,

  /// {@macro ShadKeyboardToolbar.toolbarBuilder}
  WidgetBuilder? keyboardToolbarBuilder,

  /// {@macro ShadInput.top}
  Widget? top,

  /// {@macro ShadInput.bottom}
  Widget? bottom,

  /// {@macro ShadInput.onLineCountChange}
  ValueChanged<int>? onLineCountChange,

  /// {@macro ShadInput.editableTextSize}
  Size? editableTextSize,

  /// {@macro ShadInput.useBrowserContextMenu}
  bool? useBrowserContextMenu,

  /// {@macro ShadInput.onPasteFiles}
  ValueChanged<List<ShadClipboardItem>>? onPasteFiles,

  /// {@macro ShadInput.onPasteFilesError}
  ValueChanged<Object>? onPasteFilesError,
}) : super(
       initialValue: controller != null ? controller.text : initialValue,
       validator: validator == null ? null : (v) => validator(v ?? ''),
       onChanged: onChanged == null ? null : (v) => onChanged(v ?? ''),
       decorationBuilder: (context) =>
           (ShadTheme.of(context).inputTheme.decoration ??
                   const ShadDecoration())
               .merge(decoration),
       builder: (state) {
         state as ShadFormBuilderInputState;
         return ShadInput(
           key: state.inputKey,
           controller: state.controller,
           restorationId: restorationId,
           enabled: state.enabled,
           focusNode: state.focusNode,
           decoration: state.decoration,
           style: style,
           cursorColor: cursorColor,
           selectionColor: selectionColor,
           keyboardType: keyboardType,
           textInputAction: textInputAction,
           textCapitalization: textCapitalization,
           autofocus: autofocus,
           obscureText: obscureText,
           autocorrect: autocorrect,
           magnifierConfiguration: magnifierConfiguration,
           smartDashesType: smartDashesType,
           smartQuotesType: smartQuotesType,
           enableSuggestions: enableSuggestions,
           maxLines: maxLines,
           minLines: minLines,
           expands: expands,
           onEditingComplete: onEditingComplete,
           onSubmitted: onSubmitted,
           onAppPrivateCommand: onAppPrivateCommand,
           inputFormatters: inputFormatters,
           cursorWidth: cursorWidth,
           cursorHeight: cursorHeight,
           cursorRadius: cursorRadius,
           selectionHeightStyle: selectionHeightStyle,
           selectionWidthStyle: selectionWidthStyle,
           scrollPadding: scrollPadding,
           dragStartBehavior: dragStartBehavior,
           scrollController: scrollController,
           scrollPhysics: scrollPhysics,
           autofillHints: autofillHints,
           clipBehavior: clipBehavior,
           scribbleEnabled: scribbleEnabled,
           enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
           contentInsertionConfiguration: contentInsertionConfiguration,
           contextMenuBuilder: contextMenuBuilder,
           selectionControls: selectionControls,
           mouseCursor: mouseCursor,
           enableInteractiveSelection: enableInteractiveSelection,
           undoController: undoController,
           spellCheckConfiguration: spellCheckConfiguration,
           placeholder: placeholder,
           onPressed: onPressed,
           onPressedAlwaysCalled: onPressedAlwaysCalled,
           onPressedOutside: onPressedOutside,
           keyboardAppearance: keyboardAppearance,
           cursorOpacityAnimates: cursorOpacityAnimates,
           readOnly: readOnly,
           strutStyle: strutStyle,
           textAlign: textAlign,
           textDirection: textDirection,
           obscuringCharacter: obscuringCharacter,
           showCursor: showCursor,
           maxLength: maxLength,
           maxLengthEnforcement: maxLengthEnforcement,
           padding: padding,
           leading: leading,
           trailing: trailing,
           mainAxisAlignment: mainAxisAlignment,
           crossAxisAlignment: crossAxisAlignment,
           alignment: alignment,
           placeholderStyle: placeholderStyle,
           placeholderAlignment: placeholderAlignment,
           inputPadding: inputPadding,
           gap: gap,
           constraints: constraints,
           groupId: groupId,
           keyboardToolbarBuilder: keyboardToolbarBuilder,
           top: top,
           bottom: bottom,
           onLineCountChange: onLineCountChange,
           editableTextSize: editableTextSize,
           useBrowserContextMenu: useBrowserContextMenu,
           onPasteFiles: onPasteFiles,
           onPasteFilesError: onPasteFilesError,
         );
       },
     );