FieldWidgets<T> constructor

FieldWidgets<T>({
  1. Object? key,
  2. T? object,
  3. String? label,
  4. dynamic value,
  5. dynamic type,
  6. TextEditingController? controller,
  7. String? initialValue,
  8. FocusNode? focusNode,
  9. InputDecoration? inputDecoration,
  10. TextInputType? keyboardType,
  11. TextCapitalization? textCapitalization,
  12. TextInputAction? textInputAction,
  13. TextSpan? textSpan,
  14. TextStyle? style,
  15. TextAlign? textAlign,
  16. TextAlignVertical? textAlignVertical,
  17. bool? autofocus,
  18. bool? readOnly,
  19. bool? showCursor,
  20. String? obscuringCharacter,
  21. bool? obscureText,
  22. SmartDashesType? smartDashesType,
  23. SmartQuotesType? smartQuotesType,
  24. bool? enableSuggestions,
  25. TapRegionCallback? onTapOutside,
  26. double? cursorWidth,
  27. double? cursorHeight,
  28. Radius? cursorRadius,
  29. Color? cursorColor,
  30. ScrollController? scrollController,
  31. String? restorationId,
  32. bool? enableIMEPersonalizedLearning,
  33. EditableTextContextMenuBuilder? contextMenuBuilder,
  34. bool? autocorrect,
  35. MaxLengthEnforcement? maxLengthEnforcement,
  36. int? maxLines,
  37. int? minLines,
  38. bool? expands,
  39. int? maxLength,
  40. ValueChanged<String>? changed,
  41. VoidCallback? editingComplete,
  42. ValueChanged<String>? fieldSubmitted,
  43. FormFieldSetter<String>? saved,
  44. FormFieldValidator<String>? validator,
  45. List<TextInputFormatter>? inputFormatters,
  46. bool? enabled,
  47. Brightness? keyboardAppearance,
  48. bool? enableInteractiveSelection,
  49. EdgeInsets? scrollPadding,
  50. InputCounterWidgetBuilder? buildCounter,
  51. ScrollPhysics? scrollPhysics,
  52. Iterable<String>? autofillHints,
  53. AutovalidateMode? autovalidateMode,
  54. TextDirection? textDirection,
  55. Locale? locale,
  56. bool? softWrap,
  57. TextOverflow? overflow,
  58. double? textScaleFactor,
  59. String? semanticsLabel,
  60. TextWidthBasis? textWidthBasis,
  61. TextHeightBehavior? textHeightBehavior,
  62. Color? selectionColor,
  63. Widget? leading,
  64. Widget? title,
  65. Widget? subtitle,
  66. Widget? additionalInfo,
  67. Color? backgroundColorActivated,
  68. Widget? trailing,
  69. bool? isThreeLine,
  70. bool? dense,
  71. VisualDensity? visualDensity,
  72. ShapeBorder? shape,
  73. ListTileStyle? tileStyle,
  74. Color? selectedColor,
  75. Color? iconColor,
  76. Color? textColor,
  77. EdgeInsetsGeometry? contentPadding,
  78. EdgeInsetsGeometry? padding,
  79. GestureTapCallback? tap,
  80. GestureLongPressCallback? longPress,
  81. MouseCursor? mouseCursor,
  82. bool? selected,
  83. ValueChanged<bool>? onFocusChange,
  84. Color? focusColor,
  85. Color? hoverColor,
  86. Color? splashColor,
  87. Color? tileColor,
  88. Color? selectedTileColor,
  89. OutlinedBorder? checkboxShape,
  90. bool? enableFeedback,
  91. double? horizontalTitleGap,
  92. double? minVerticalPadding,
  93. double? minLeadingWidth,
  94. FutureOr<void> forTap()?,
  95. double? leadingSize,
  96. double? leadingToTitle,
  97. Widget? secondary,
  98. ListTileControlAffinity? controlAffinity,
  99. Color? backgroundColor,
  100. ImageProvider<Object>? backgroundImage,
  101. ImageProvider<Object>? foregroundImage,
  102. ImageErrorListener? onBackgroundImageError,
  103. ImageErrorListener? onForegroundImageError,
  104. Color? foregroundColor,
  105. double? radius,
  106. double? minRadius,
  107. double? maxRadius,
  108. Widget? child,
  109. Widget? background,
  110. Widget? secondaryBackground,
  111. VoidCallback? resize,
  112. DismissDirectionCallback? dismissed,
  113. DismissDirection? direction,
  114. Duration? resizeDuration,
  115. Map<DismissDirection, double>? dismissThresholds,
  116. Duration? movementDuration,
  117. double? crossAxisEndOffset,
  118. ValueChanged<bool>? toggle,
  119. Color? activeColor,
  120. MaterialStateProperty<Color?>? fillColor,
  121. Color? checkColor,
  122. bool? tristate,
  123. MaterialTapTargetSize? materialTapTargetSize,
  124. MaterialStateProperty<Color?>? overlayColor,
  125. double? splashRadius,
  126. OutlinedBorder? outlineShape,
  127. BorderSide? side,
  128. bool? isError,
})

Constructor supplies all the options depending on the field Widget.

Implementation

FieldWidgets({
  Object? key,
  this.object,
  String? label,
  dynamic value,
  dynamic type,
// TextFormField
  this.controller,
  this.initialValue,
  this.focusNode,
  this.inputDecoration,
  this.keyboardType,
  this.textCapitalization,
  this.textInputAction,
  this.textSpan,
  this.style,
  this.textAlign,
  this.textAlignVertical,
  this.autofocus,
  this.readOnly,
  this.showCursor,
  this.obscuringCharacter,
  this.obscureText,
  this.smartDashesType,
  this.smartQuotesType,
  this.enableSuggestions,
  this.onTapOutside,
  this.cursorWidth,
  this.cursorHeight,
  this.cursorRadius,
  this.cursorColor,
  this.scrollController,
  this.restorationId,
  this.enableIMEPersonalizedLearning,
  this.contextMenuBuilder,
  this.autocorrect,
//    this.autovalidate,
//    this.maxLengthEnforced,
  this.maxLengthEnforcement,
  this.maxLines,
  this.minLines,
  this.expands,
  this.maxLength,
  this.changed,
  this.editingComplete,
  this.fieldSubmitted,
  this.saved,
  this.validator,
  this.inputFormatters,
  this.enabled,
  this.keyboardAppearance,
  this.enableInteractiveSelection,
  this.scrollPadding,
  this.buildCounter,
  this.scrollPhysics,
  this.autofillHints,
  this.autovalidateMode,
// Text
  this.textDirection,
  this.locale,
  this.softWrap,
  this.overflow,
  this.textScaleFactor,
  this.semanticsLabel,
  this.textWidthBasis,
  this.textHeightBehavior,
  this.selectionColor,
// ListTile
  this.leading,
  this.title,
  this.subtitle,
  this.additionalInfo,
  this.backgroundColorActivated,
  this.trailing,
  this.isThreeLine,
  this.dense,
  this.visualDensity,
  this.shape,
  this.tileStyle,
  this.selectedColor,
  this.iconColor,
  this.textColor,
  this.contentPadding,
  this.padding,
  this.tap,
  this.longPress,
  this.mouseCursor,
  this.selected,
  this.onFocusChange,
  this.focusColor,
  this.hoverColor,
  this.splashColor,
  this.tileColor,
  this.selectedTileColor,
  this.checkboxShape,
  this.enableFeedback,
  this.horizontalTitleGap,
  this.minVerticalPadding,
  this.minLeadingWidth,
  this.forTap,
  this.leadingSize,
  this.leadingToTitle,
// CheckboxListTile
  this.secondary,
  this.controlAffinity,
// CircleAvatar
  this.backgroundColor,
  this.backgroundImage,
  this.foregroundImage,
  this.onBackgroundImageError,
  this.onForegroundImageError,
  this.foregroundColor,
  this.radius,
  this.minRadius,
  this.maxRadius,
// Dismissible
  this.child,
  this.background,
  this.secondaryBackground,
  this.resize,
  this.dismissed,
  this.direction,
  this.resizeDuration,
  this.dismissThresholds,
  this.movementDuration,
  this.crossAxisEndOffset,
// CheckBox
  this.toggle,
  this.activeColor,
  this.fillColor,
  this.checkColor,
  this.tristate,
  this.materialTapTargetSize,
  this.overlayColor,
  this.splashRadius,
  this.outlineShape,
  this.side,
  this.isError,
}) : super(label: label, value: value, type: type) {
  //
  _key = ObjectKey(key ?? this).toString();

  // ignore: avoid_bool_literals_in_conditional_expressions
  _checkValue = value == null
      ? false
      : value is String
          ? value.isNotEmpty
          : value is bool
              ? value
              // ignore: avoid_bool_literals_in_conditional_expressions
              : value is int
                  // ignore: avoid_bool_literals_in_conditional_expressions
                  ? value > 0
                      ? true
                      // ignore: avoid_bool_literals_in_conditional_expressions
                      : value is double
                          ? value > 0
                          : false
                  : false;

  // Record the initial value.
  if (value is! Iterable) {
    _initValue = value ?? initialValue;
  }

  // Default values
  textCapitalization ??= TextCapitalization.none;
  textInputAction ??= TextInputAction.done;
  textAlign ??= TextAlign.start;
  autofocus ??= false;
  isError ??= false;
  readOnly ??= false;
  obscureText ??= false;
  obscuringCharacter ??= '•';
  enableIMEPersonalizedLearning ??= true;
  autocorrect ??= true;
  enableSuggestions ??= true;
  cursorWidth ??= 2;
  enableInteractiveSelection ??= !obscureText! || !readOnly!;

//    autovalidate ??= false;
//    maxLengthEnforced ??= true;
  maxLengthEnforcement ??= MaxLengthEnforcement.enforced;
  maxLines ??= 1;
  expands = false;
  scrollPadding ??= const EdgeInsets.all(20);

  leadingSize = 28;
  leadingToTitle = 16;

  isThreeLine ??= false;
  enabled ??= true;
  selected ??= false;

  direction ??= DismissDirection.endToStart;
  resizeDuration ??= const Duration(milliseconds: 300);
  dismissThresholds ??= const <DismissDirection, double>{};
  movementDuration ??= const Duration(milliseconds: 200);
  crossAxisEndOffset ??= 0.0;
  dragStartBehavior ??= DragStartBehavior.start;
  behavior ??= HitTestBehavior.opaque;
}