FieldWidgets<T> constructor
FieldWidgets<T> ({
- Object? key,
- T? object,
- String? label,
- dynamic value,
- dynamic type,
- TextEditingController? controller,
- String? initialValue,
- FocusNode? focusNode,
- InputDecoration? inputDecoration,
- TextInputType? keyboardType,
- TextCapitalization? textCapitalization,
- TextInputAction? textInputAction,
- TextSpan? textSpan,
- TextStyle? style,
- TextAlign? textAlign,
- TextAlignVertical? textAlignVertical,
- bool? autofocus,
- bool? readOnly,
- bool? showCursor,
- String? obscuringCharacter,
- bool? obscureText,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- bool? enableSuggestions,
- TapRegionCallback? onTapOutside,
- double? cursorWidth,
- double? cursorHeight,
- Radius? cursorRadius,
- Color? cursorColor,
- ScrollController? scrollController,
- String? restorationId,
- bool? enableIMEPersonalizedLearning,
- EditableTextContextMenuBuilder? contextMenuBuilder,
- bool? autocorrect,
- MaxLengthEnforcement? maxLengthEnforcement,
- int? maxLines,
- int? minLines,
- bool? expands,
- int? maxLength,
- ValueChanged<
String> ? changed, - VoidCallback? editingComplete,
- ValueChanged<
String> ? fieldSubmitted, - FormFieldSetter<
String> ? saved, - FormFieldValidator<
String> ? validator, - List<
TextInputFormatter> ? inputFormatters, - bool? enabled,
- Brightness? keyboardAppearance,
- bool? enableInteractiveSelection,
- EdgeInsets? scrollPadding,
- InputCounterWidgetBuilder? buildCounter,
- ScrollPhysics? scrollPhysics,
- Iterable<
String> ? autofillHints, - AutovalidateMode? autovalidateMode,
- TextDirection? textDirection,
- Locale? locale,
- bool? softWrap,
- TextOverflow? overflow,
- double? textScaleFactor,
- String? semanticsLabel,
- TextWidthBasis? textWidthBasis,
- TextHeightBehavior? textHeightBehavior,
- Color? selectionColor,
- Widget? leading,
- Widget? title,
- Widget? subtitle,
- Widget? additionalInfo,
- Color? backgroundColorActivated,
- Widget? trailing,
- bool? isThreeLine,
- bool? dense,
- VisualDensity? visualDensity,
- ShapeBorder? shape,
- ListTileStyle? tileStyle,
- Color? selectedColor,
- Color? iconColor,
- Color? textColor,
- EdgeInsetsGeometry? contentPadding,
- EdgeInsetsGeometry? padding,
- GestureTapCallback? tap,
- GestureLongPressCallback? longPress,
- MouseCursor? mouseCursor,
- bool? selected,
- ValueChanged<
bool> ? onFocusChange, - Color? focusColor,
- Color? hoverColor,
- Color? splashColor,
- Color? tileColor,
- Color? selectedTileColor,
- OutlinedBorder? checkboxShape,
- bool? enableFeedback,
- double? horizontalTitleGap,
- double? minVerticalPadding,
- double? minLeadingWidth,
- FutureOr<
void> forTap()?, - double? leadingSize,
- double? leadingToTitle,
- Widget? secondary,
- ListTileControlAffinity? controlAffinity,
- Color? backgroundColor,
- ImageProvider<
Object> ? backgroundImage, - ImageProvider<
Object> ? foregroundImage, - ImageErrorListener? onBackgroundImageError,
- ImageErrorListener? onForegroundImageError,
- Color? foregroundColor,
- double? radius,
- double? minRadius,
- double? maxRadius,
- Widget? child,
- Widget? background,
- Widget? secondaryBackground,
- VoidCallback? resize,
- DismissDirectionCallback? dismissed,
- DismissDirection? direction,
- Duration? resizeDuration,
- Map<
DismissDirection, double> ? dismissThresholds, - Duration? movementDuration,
- double? crossAxisEndOffset,
- ValueChanged<
bool> ? toggle, - Color? activeColor,
- MaterialStateProperty<
Color?> ? fillColor, - Color? checkColor,
- bool? tristate,
- MaterialTapTargetSize? materialTapTargetSize,
- MaterialStateProperty<
Color?> ? overlayColor, - double? splashRadius,
- OutlinedBorder? outlineShape,
- BorderSide? side,
- 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;
}