commonTextField static method
dynamic
commonTextField({
- dynamic key,
- dynamic controller,
- dynamic hint,
- dynamic validation,
- dynamic inputType,
- dynamic maxLength,
- dynamic labelText,
- dynamic prefix,
- dynamic suffix,
- dynamic enable,
- dynamic readOnly,
- dynamic inputFormators,
- dynamic preText,
- dynamic onChanged,
- dynamic showFloating = false,
- dynamic focusNode,
- dynamic inputActions,
- dynamic maxlines,
- dynamic hideHelperText,
- dynamic isObsure,
- dynamic valueTextColor,
- dynamic floatingTextColor,
- dynamic helperText,
- dynamic enableBorderColor,
- dynamic disableEditBorderColor,
- dynamic fillColor,
- dynamic isFilled = false,
- dynamic borderRadius,
- dynamic labelColor,
- dynamic helperColor,
- dynamic hintColor,
- 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)));
}