commonTextField static method

dynamic commonTextField({
  1. dynamic key,
  2. dynamic controller,
  3. dynamic hint,
  4. dynamic validation,
  5. dynamic inputType,
  6. dynamic maxLength,
  7. dynamic labelText,
  8. dynamic prefix,
  9. dynamic suffix,
  10. dynamic enable,
  11. dynamic readOnly,
  12. dynamic inputFormators,
  13. dynamic preText,
  14. dynamic onChanged,
  15. dynamic showFloating = false,
  16. dynamic focusNode,
  17. dynamic inputActions,
  18. dynamic maxlines,
  19. dynamic hideHelperText,
  20. dynamic isObsure,
  21. dynamic valueTextColor,
  22. dynamic floatingTextColor,
  23. dynamic helperText,
  24. dynamic enableBorderColor,
  25. dynamic disableEditBorderColor,
  26. dynamic fillColor,
  27. dynamic isFilled = false,
  28. dynamic borderRadius,
  29. dynamic labelColor,
  30. dynamic helperColor,
  31. dynamic hintColor,
  32. dynamic errorColor,
})

Implementation

static commonTextField({
  var key,
  var controller,
  var hint,
  var validation,
  var inputType,
  var maxLength,
  var labelText,
  var prefix,
  var suffix,
  var enable,
  var readOnly,
  var inputFormators,
  var preText,
  var onChanged,
  var showFloating = false,
  var focusNode,
  var inputActions,
  var maxlines,
  var hideHelperText,
  var isObsure,
  var valueTextColor,
  var floatingTextColor,
  var helperText,
  var enableBorderColor,
  var disableEditBorderColor,
  var fillColor,
  var isFilled = false,
  var borderRadius,
  var labelColor,
  var helperColor,
  var hintColor,
  var errorColor,
}) {
  return TextFormField(
       key: key,
      controller: controller,
      validator: validation,
      maxLines: maxlines ?? 1,
      enabled: enable ?? true,
      readOnly: readOnly ?? false,
      keyboardType: inputType ?? TextInputType.text,
      onChanged: onChanged,
      focusNode: focusNode,
      textInputAction: inputActions,
      obscureText: isObsure ?? false,
      style: GoogleFonts.inter(
        textStyle: TextStyle(
            color: valueTextColor ?? CommonColors.primaryColor,
            fontSize: font_16,
            fontWeight: FontWeight.w400),
      ),
      cursorColor: valueTextColor ?? CommonColors.primaryColor,
      inputFormatters: inputFormators ?? [],
      decoration: InputDecoration(
          floatingLabelBehavior: showFloating
              ? FloatingLabelBehavior.always
              : FloatingLabelBehavior.never,
          floatingLabelStyle: GoogleFonts.inter(
            textStyle: TextStyle(
                color:
                    floatingTextColor ?? CommonColors.floatingEditTextColor,
                fontSize: font_16,
                fontWeight: FontWeight.w400),
          ),
          prefixStyle: GoogleFonts.inter(
            textStyle: TextStyle(
                color: labelColor ?? CommonColors.greyTextColor,
                fontSize: font_16,
                fontWeight: FontWeight.w400),
          ),
          prefixText: preText ?? "",
          fillColor: fillColor ?? CommonColors.gradient1,
          labelText: labelText ?? "",
          helperText: helperText ?? "",
          helperStyle: GoogleFonts.inter(
            textStyle: TextStyle(
                color: helperColor ?? CommonColors.sampleIDColor,
                fontSize: font_10,
                fontWeight: FontWeight.w400),
          ),
          contentPadding: EdgeInsets.symmetric(
              vertical: margin_16, horizontal: margin_10),
          iconColor: CommonColors.black,
          prefixIcon: prefix,
          suffixIcon: suffix,
          hoverColor: CommonColors.hoverBorderColor,
          labelStyle: GoogleFonts.inter(
            textStyle: TextStyle(
                color: labelColor ?? CommonColors.greyTextColor,
                fontSize: font_16,
                fontWeight: FontWeight.w400),
          ),
          filled: isFilled ? true : false,
          enabledBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(borderRadius ?? radius_8),
            borderSide: BorderSide(
              color: enableBorderColor ?? CommonColors.circleBGColor,
              width: 1.0,
            ),
          ),
          disabledBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(borderRadius ?? radius_8),
            borderSide: BorderSide(
              color:
                  disableEditBorderColor ?? CommonColors.disableBorderColor,
              width: 1.0,
            ),
          ),
          focusedBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(borderRadius ?? radius_8),
            borderSide: const BorderSide(
              color: CommonColors.circleBGColor,
              width: 1.0,
            ),
          ),
          errorBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(borderRadius ?? radius_8),
            borderSide: BorderSide(
              color: errorColor ?? CommonColors.errorBorderColor,
              width: 1.0,
            ),
          ),
          errorStyle: TextStyle(
              color: errorColor ?? CommonColors.redColor,
              fontSize: font_12,
              fontWeight: FontWeight.w400),
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(borderRadius ?? radius_8),
            borderSide: const BorderSide(
              color: CommonColors.circleBGColor,
              width: 1.0,
            ),
          ),
          hintText: hint,
          hintStyle: TextStyle(
              color: hintColor ?? CommonColors.greyTextColor,
              fontSize: font_16,
              fontWeight: FontWeight.w400)));
}