BidiTextFormField constructor

BidiTextFormField({
  1. Key? key,
  2. Object groupId = EditableText,
  3. TextEditingController? controller,
  4. String? initialValue,
  5. FocusNode? focusNode,
  6. String? forceErrorText,
  7. InputDecoration? decoration = const InputDecoration(),
  8. TextInputType? keyboardType,
  9. TextCapitalization textCapitalization = TextCapitalization.none,
  10. TextInputAction? textInputAction,
  11. TextStyle? style,
  12. StrutStyle? strutStyle,
  13. TextDirection? textDirection,
  14. TextAlign textAlign = TextAlign.start,
  15. TextAlignVertical? textAlignVertical,
  16. bool autofocus = false,
  17. bool readOnly = false,
  18. bool? showCursor,
  19. String obscuringCharacter = '•',
  20. bool obscureText = false,
  21. bool autocorrect = true,
  22. SmartDashesType? smartDashesType,
  23. SmartQuotesType? smartQuotesType,
  24. bool enableSuggestions = true,
  25. MaxLengthEnforcement? maxLengthEnforcement,
  26. int? maxLines = 1,
  27. int? minLines,
  28. bool expands = false,
  29. int? maxLength,
  30. ValueChanged<String>? onChanged,
  31. GestureTapCallback? onTap,
  32. bool onTapAlwaysCalled = false,
  33. TapRegionCallback? onTapOutside,
  34. VoidCallback? onEditingComplete,
  35. ValueChanged<String>? onFieldSubmitted,
  36. FormFieldSetter<String>? onSaved,
  37. FormFieldValidator<String>? validator,
  38. List<TextInputFormatter>? inputFormatters,
  39. bool? enabled,
  40. bool? ignorePointers,
  41. double cursorWidth = 2.0,
  42. double? cursorHeight,
  43. Radius? cursorRadius,
  44. Color? cursorColor,
  45. Color? cursorErrorColor,
  46. Brightness? keyboardAppearance,
  47. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  48. bool? enableInteractiveSelection,
  49. TextSelectionControls? selectionControls,
  50. InputCounterWidgetBuilder? buildCounter,
  51. ScrollPhysics? scrollPhysics,
  52. Iterable<String>? autofillHints,
  53. AutovalidateMode? autovalidateMode,
  54. ScrollController? scrollController,
  55. String? restorationId,
  56. bool enableIMEPersonalizedLearning = true,
  57. MouseCursor? mouseCursor,
  58. EditableTextContextMenuBuilder? contextMenuBuilder = _defaultContextMenuBuilder,
  59. SpellCheckConfiguration? spellCheckConfiguration,
  60. TextMagnifierConfiguration? magnifierConfiguration,
  61. UndoHistoryController? undoController,
  62. AppPrivateCommandCallback? onAppPrivateCommand,
  63. bool? cursorOpacityAnimates,
  64. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  65. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  66. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  67. ContentInsertionConfiguration? contentInsertionConfiguration,
  68. WidgetStatesController? statesController,
  69. Clip clipBehavior = Clip.hardEdge,
  70. bool canRequestFocus = true,
  71. ValueChanged<TextDirection>? onDirectionChanged,
  72. int? sampleLength = 50,
})

Creates a FormField that contains a BidiTextField.

Implementation

BidiTextFormField({
  super.key,
  this.groupId = EditableText,
  this.controller,
  String? initialValue,
  FocusNode? focusNode,
  super.forceErrorText,
  InputDecoration? decoration = const InputDecoration(),
  TextInputType? keyboardType,
  TextCapitalization textCapitalization = TextCapitalization.none,
  TextInputAction? textInputAction,
  TextStyle? style,
  StrutStyle? strutStyle,
  TextDirection? textDirection,
  TextAlign textAlign = TextAlign.start,
  TextAlignVertical? textAlignVertical,
  bool autofocus = false,
  bool readOnly = false,
  bool? showCursor,
  String obscuringCharacter = '•',
  bool obscureText = false,
  bool autocorrect = true,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  bool enableSuggestions = true,
  MaxLengthEnforcement? maxLengthEnforcement,
  int? maxLines = 1,
  int? minLines,
  bool expands = false,
  int? maxLength,
  this.onChanged,
  GestureTapCallback? onTap,
  bool onTapAlwaysCalled = false,
  TapRegionCallback? onTapOutside,
  VoidCallback? onEditingComplete,
  ValueChanged<String>? onFieldSubmitted,
  super.onSaved,
  super.validator,
  List<TextInputFormatter>? inputFormatters,
  bool? enabled,
  bool? ignorePointers,
  double cursorWidth = 2.0,
  double? cursorHeight,
  Radius? cursorRadius,
  Color? cursorColor,
  Color? cursorErrorColor,
  Brightness? keyboardAppearance,
  EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  bool? enableInteractiveSelection,
  TextSelectionControls? selectionControls,
  InputCounterWidgetBuilder? buildCounter,
  ScrollPhysics? scrollPhysics,
  Iterable<String>? autofillHints,
  AutovalidateMode? autovalidateMode,
  ScrollController? scrollController,
  super.restorationId,
  bool enableIMEPersonalizedLearning = true,
  MouseCursor? mouseCursor,
  EditableTextContextMenuBuilder? contextMenuBuilder =
      _defaultContextMenuBuilder,
  SpellCheckConfiguration? spellCheckConfiguration,
  TextMagnifierConfiguration? magnifierConfiguration,
  UndoHistoryController? undoController,
  AppPrivateCommandCallback? onAppPrivateCommand,
  bool? cursorOpacityAnimates,
  ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  ContentInsertionConfiguration? contentInsertionConfiguration,
  WidgetStatesController? statesController,
  Clip clipBehavior = Clip.hardEdge,
  bool canRequestFocus = true,
  this.onDirectionChanged,
  this.sampleLength = 50,
})  : assert(initialValue == null || controller == null),
      assert(obscuringCharacter.length == 1),
      assert(maxLines == null || maxLines > 0),
      assert(minLines == null || minLines > 0),
      assert(
        (maxLines == null) || (minLines == null) || (maxLines >= minLines),
        "minLines can't be greater than maxLines",
      ),
      assert(
        !expands || (maxLines == null && minLines == null),
        'minLines and maxLines must be null when expands is true.',
      ),
      assert(!obscureText || maxLines == 1,
          'Obscured fields cannot be multiline.'),
      assert(maxLength == null ||
          maxLength == TextField.noMaxLength ||
          maxLength > 0),
      super(
        initialValue:
            controller != null ? controller.text : (initialValue ?? ''),
        enabled: enabled ?? decoration?.enabled ?? true,
        autovalidateMode: autovalidateMode ?? AutovalidateMode.disabled,
        builder: (FormFieldState<String> field) {
          final _BidiTextFormFieldState state =
              field as _BidiTextFormFieldState;
          final InputDecoration effectiveDecoration = (decoration ??
                  const InputDecoration())
              .applyDefaults(Theme.of(field.context).inputDecorationTheme);
          void onChangedHandler(String value) {
            field.didChange(value);
            onChanged?.call(value);
          }

          return UnmanagedRestorationScope(
            bucket: field.bucket,
            child: BidiTextField(
              groupId: groupId,
              restorationId: restorationId,
              controller: state._effectiveController,
              focusNode: focusNode,
              decoration:
                  effectiveDecoration.copyWith(errorText: field.errorText),
              keyboardType: keyboardType,
              textInputAction: textInputAction,
              style: style,
              strutStyle: strutStyle,
              textAlign: textAlign,
              textAlignVertical: textAlignVertical,
              textDirection: textDirection,
              textCapitalization: textCapitalization,
              autofocus: autofocus,
              statesController: statesController,
              readOnly: readOnly,
              showCursor: showCursor,
              obscuringCharacter: obscuringCharacter,
              obscureText: obscureText,
              autocorrect: autocorrect,
              smartDashesType: smartDashesType ??
                  (obscureText
                      ? SmartDashesType.disabled
                      : SmartDashesType.enabled),
              smartQuotesType: smartQuotesType ??
                  (obscureText
                      ? SmartQuotesType.disabled
                      : SmartQuotesType.enabled),
              enableSuggestions: enableSuggestions,
              maxLengthEnforcement: maxLengthEnforcement,
              maxLines: maxLines,
              minLines: minLines,
              expands: expands,
              maxLength: maxLength,
              onChanged: onChangedHandler,
              onTap: onTap,
              onTapAlwaysCalled: onTapAlwaysCalled,
              onTapOutside: onTapOutside,
              onEditingComplete: onEditingComplete,
              onSubmitted: onFieldSubmitted,
              inputFormatters: inputFormatters,
              enabled: enabled ?? decoration?.enabled ?? true,
              ignorePointers: ignorePointers,
              cursorWidth: cursorWidth,
              cursorHeight: cursorHeight,
              cursorRadius: cursorRadius,
              cursorColor: cursorColor,
              cursorErrorColor: cursorErrorColor,
              scrollPadding: scrollPadding,
              scrollPhysics: scrollPhysics,
              keyboardAppearance: keyboardAppearance,
              enableInteractiveSelection:
                  enableInteractiveSelection ?? (!obscureText || !readOnly),
              selectionControls: selectionControls,
              buildCounter: buildCounter,
              autofillHints: autofillHints,
              scrollController: scrollController,
              enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
              mouseCursor: mouseCursor,
              contextMenuBuilder: contextMenuBuilder,
              spellCheckConfiguration: spellCheckConfiguration,
              magnifierConfiguration: magnifierConfiguration,
              undoController: undoController,
              onAppPrivateCommand: onAppPrivateCommand,
              cursorOpacityAnimates: cursorOpacityAnimates,
              selectionHeightStyle: selectionHeightStyle,
              selectionWidthStyle: selectionWidthStyle,
              dragStartBehavior: dragStartBehavior,
              contentInsertionConfiguration: contentInsertionConfiguration,
              clipBehavior: clipBehavior,
              canRequestFocus: canRequestFocus,
              onDirectionChanged: onDirectionChanged,
              sampleLength: sampleLength,
            ),
          );
        },
      );