InputField.fromFieldInfo constructor

InputField.fromFieldInfo(
  1. FieldInfo info, {
  2. double? labelFieldSpace,
  3. Color? borderColor,
  4. double? elevation,
  5. EdgeInsets? contentPadding,
  6. InputDecoration? inputDecoration,
  7. InputDecorationBuilder? inputDecorationBuilder,
  8. Color? fillColor,
  9. TextStyle? textStyle,
  10. TextStyle? allTextStyle,
  11. TextStyle? labelStyle,
  12. TextStyle? hintStyle,
  13. TextStyle? innerLabelStyle,
  14. bool? labelIsBold,
  15. BorderRadius? borderRadius,
  16. FocusNode? focusNode,
  17. TextDirection? textDirection,
})

This constructor takes a field info object for the main properties (used mostly for forms)

Implementation

factory InputField.fromFieldInfo(
  FieldInfo info, {
  double? labelFieldSpace,
  Color? borderColor,
  double? elevation,
  EdgeInsets? contentPadding,
  InputDecoration? inputDecoration,
  InputDecorationBuilder? inputDecorationBuilder,
  Color? fillColor,
  TextStyle? textStyle,
  TextStyle? allTextStyle,
  TextStyle? labelStyle,
  TextStyle? hintStyle,
  TextStyle? innerLabelStyle,
  bool? labelIsBold,
  BorderRadius? borderRadius,
  FocusNode? focusNode,
  TextDirection? textDirection,
}) =>
    InputField(
      controller: info.controller,
      hintText: info.hint,
      contentPadding: contentPadding,
      prefixIcon: info.prefixIcon,
      suffixIcon: info.suffixIcon,
      inputDecoration: inputDecoration,
      fillColor: fillColor,
      labelText: info.label == null ? null : '${info.label}${(info.required ?? false) ? (info.requiredString ?? ' (Required)') : ''}',
      inputType: info.inputType,
      isMultiline: info.multiLine,
      innerLabelText: info.innerLabel == null
          ? null
          : '${info.innerLabel}${((info.label == null && (info.required ?? false)) ? (info.requiredString ?? '*') : '')}',
      labelFieldSpace: labelFieldSpace ?? 10,
      borderColor: borderColor,
      elevation: elevation,
      onTap: info.onTap,
      onTapOutside: info.onTapOutside,
      readOnly: info.readOnly,
      isObscure: info.isObscure,
      minLines: info.minLines,
      maxLines: info.maxLines,
      hintStyle: hintStyle,
      textStyle: textStyle,
      labelStyle: labelStyle,
      allTextStyle: allTextStyle,
      innerLabelStyle: innerLabelStyle,
      labelIsBold: labelIsBold,
      onChanged: info.onChanged,
      inputDecorationBuilder: inputDecorationBuilder,
      borderRadius: borderRadius,
      focusNode: focusNode,
      textDirection: textDirection,
      inputFormatters: info.inputFormatters,
      validator: info.validator,
    );