commonTextField static method

Widget commonTextField({
  1. required String labelText,
  2. Widget? prefix,
  3. TextEditingController? controller,
  4. dynamic onChanged(
    1. String
    )?,
  5. Widget? suffixIcon,
  6. Color? themeColor,
  7. bool? obscure,
  8. bool? readOnly,
})

Implementation

static Widget commonTextField(
    {required String labelText,
    Widget? prefix,
    TextEditingController? controller,
    Function(String)? onChanged,
    Widget? suffixIcon,
    Color? themeColor,
    bool? obscure,
    bool? readOnly}) {
  return TextFormField(
      obscureText: obscure ?? false,
      cursorColor: themeColor ?? primaryColor,
      readOnly: readOnly ?? false,
      style: const TextStyle(color: Colors.black, fontSize: 15, fontWeight: FontWeight.w400),
      decoration: InputDecoration(
          helperText: "",
          contentPadding: const EdgeInsets.only(left: 12),
          alignLabelWithHint: true,
          labelStyle: TextStyle(
            color: const Color(0xFF000000).withOpacity(0.5),
          ),
          suffixIcon: suffixIcon ?? SizedBox(),
          suffixIconConstraints: BoxConstraints.tightFor(),
          labelText: labelText,
          border: OutlineInputBorder(
              borderSide: BorderSide(color: const Color(0xFFDDDDDD).withOpacity(0.3), width: 1.5),
              borderRadius: BorderRadius.circular(10)),
          errorBorder: OutlineInputBorder(
              borderSide: BorderSide(color: const Color(0xFFDDDDDD).withOpacity(0.3), width: 1.5),
              borderRadius: BorderRadius.circular(10)),
          enabledBorder: OutlineInputBorder(
              borderSide: BorderSide(color: const Color(0xFFDDDDDD).withOpacity(0.3), width: 1.5),
              borderRadius: BorderRadius.circular(10)),
          focusedBorder: OutlineInputBorder(
              borderSide: BorderSide(color: themeColor ?? primaryColor, width: 1.5),
              borderRadius: BorderRadius.circular(10)),
          disabledBorder: OutlineInputBorder(
              borderSide: BorderSide(color: const Color(0xFFDDDDDD).withOpacity(0.3)),
              borderRadius: BorderRadius.circular(10))));
}