materialTextFieldBuilder function

Widget materialTextFieldBuilder(
  1. FormFieldState<String> field
)

The default FastTextField Material FormFieldBuilder.

Returns a TextFormField.

Implementation

Widget materialTextFieldBuilder(FormFieldState<String> field) {
  final FastTextFieldState(
    :autovalidateMode,
    :didChange,
    :enabled,
    :focusNode,
    :widget
  ) = field as FastTextFieldState;
  final FastTextField(:prefix, :suffix) = widget;
  final InputDecoration decoration = field.decoration.copyWith(
    hintText: widget.placeholder,
    prefix: prefix != null && prefix is! Icon ? prefix : null,
    prefixIcon: prefix is Icon ? prefix : null,
    suffix: suffix != null && suffix is! Icon ? suffix : null,
    suffixIcon: suffix is Icon ? suffix : null,
  );

  return TextFormField(
    autocorrect: widget.autocorrect,
    autofillHints: widget.autofillHints,
    autofocus: widget.autofocus,
    autovalidateMode: autovalidateMode,
    buildCounter: widget.buildCounter,
    canRequestFocus: widget.canRequestFocus,
    clipBehavior: widget.clipBehavior,
    contentInsertionConfiguration: widget.contentInsertionConfiguration,
    contextMenuBuilder: widget.contextMenuBuilder,
    cursorColor: widget.cursorColor,
    cursorHeight: widget.cursorHeight,
    cursorOpacityAnimates: widget.cursorOpacityAnimates,
    cursorRadius: widget.cursorRadius,
    cursorWidth: widget.cursorWidth,
    decoration: decoration,
    enabled: enabled,
    dragStartBehavior: widget.dragStartBehavior,
    enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
    enableInteractiveSelection: widget.enableInteractiveSelection,
    enableSuggestions: widget.enableSuggestions,
    expands: widget.expands,
    focusNode: widget.focusNode ?? focusNode,
    keyboardAppearance: widget.keyboardAppearance,
    keyboardType: widget.keyboardType,
    initialValue: widget.initialValue,
    inputFormatters: widget.inputFormatters,
    maxLength: widget.maxLength,
    maxLengthEnforcement: widget.maxLengthEnforcement,
    maxLines: widget.maxLines,
    minLines: widget.minLines,
    magnifierConfiguration: widget.magnifierConfiguration,
    mouseCursor: widget.mouseCursor,
    obscureText: widget.obscureText,
    obscuringCharacter: widget.obscuringCharacter,
    onAppPrivateCommand: widget.onAppPrivateCommand,
    onChanged: enabled ? didChange : null,
    onEditingComplete: widget.onEditingComplete,
    onFieldSubmitted: widget.onFieldSubmitted,
    onSaved: widget.onSaved,
    onTap: widget.onTap,
    onTapOutside: widget.onTapOutside,
    readOnly: widget.readOnly,
    scribbleEnabled: widget.scribbleEnabled,
    scrollController: widget.scrollController,
    scrollPadding: widget.scrollPadding,
    scrollPhysics: widget.scrollPhysics,
    selectionControls: widget.selectionControls,
    selectionHeightStyle: widget.selectionHeightStyle,
    selectionWidthStyle: widget.selectionWidthStyle,
    showCursor: widget.showCursor,
    smartDashesType: widget.smartDashesType,
    smartQuotesType: widget.smartQuotesType,
    spellCheckConfiguration: widget.spellCheckConfiguration,
    strutStyle: widget.strutStyle,
    style: widget.style,
    textAlign: widget.textAlign,
    textAlignVertical: widget.textAlignVertical,
    textCapitalization: widget.textCapitalization,
    textDirection: widget.textDirection,
    textInputAction: widget.textInputAction,
    undoController: widget.undoController,
    validator: widget.validator,
  );
}