commonUnderLineTextField static method

Widget commonUnderLineTextField({
  1. List<TextInputFormatter>? inputFormatters,
  2. TextInputAction? textInputAction,
  3. required String labelText,
  4. required bool useMobileLayout,
  5. bool? readOnly,
  6. String? hintText,
  7. bool? isObscure,
  8. TextEditingController? controller,
  9. dynamic onChanged(
    1. String
    )?,
  10. Widget? prefix,
  11. String? helperText = "",
  12. Widget? suffixIcon,
  13. TextInputType? keyboardType,
  14. String? validator(
    1. String?
    )?,
  15. Color? themeColor,
  16. FocusNode? focusNode,
  17. dynamic onTap()?,
  18. int? maxlength,
})

Implementation

static Widget commonUnderLineTextField(
    {List<TextInputFormatter>? inputFormatters,
      TextInputAction? textInputAction,
    required String labelText,
    required bool useMobileLayout,
    bool? readOnly,
    String? hintText,
    bool? isObscure,
    TextEditingController? controller,
    Function(String)? onChanged,
    Widget? prefix,
    String? helperText = "",
    Widget? suffixIcon,
    TextInputType? keyboardType,
    String? Function(String?)? validator,
    Color? themeColor,
    FocusNode? focusNode,
    Function()? onTap,
    int? maxlength}) {
  return Padding(
    padding: const EdgeInsets.only(bottom: 20),
    child: TextFormField(
        focusNode: focusNode,
        validator: validator ?? (p0) {},
/*
        onSaved: (newValue) {
          print("onSaved::${newValue}");
        },
        onEditingComplete: () {
          print("Editing complete");
        },
        onTapOutside: (event) {
          print("tap outside");
        },*/
        onTap: onTap,
        controller: controller,
        readOnly: readOnly ?? false,
        maxLength: maxlength,
        keyboardType: keyboardType,
        obscureText: isObscure ?? false,
        cursorColor: themeColor ?? primaryColor,
        inputFormatters: inputFormatters,
        style: TextStyle(color: Colors.black, fontSize: useMobileLayout ? 15 : 19, fontWeight: FontWeight.w400,),
        onChanged: onChanged,
        textInputAction: textInputAction??TextInputAction.next,
        decoration: InputDecoration(
            constraints: useMobileLayout ? null : const BoxConstraints(minHeight: 52),
            helperText: helperText,
            hintText: hintText,
            counterText: "",
            contentPadding: const EdgeInsets.only(bottom: 3),

            prefix: prefix,
            suffixIcon: suffixIcon ?? SizedBox(),
            suffixIconConstraints: BoxConstraints.tightFor(),
            alignLabelWithHint: true,errorStyle: TextStyle( fontSize: useMobileLayout ? 10 : 15),
            labelStyle: TextStyle(
              fontSize: useMobileLayout ? 12 : 19,
              color: const Color(0xFF000000).withOpacity(0.5),
            ),
            labelText: labelText,
            border: UnderlineInputBorder(
                borderSide: BorderSide(color: const Color(0xFF000000).withOpacity(0.3), width: 1.5)),
            errorBorder: UnderlineInputBorder(
                borderSide: BorderSide(color: const Color(0xFF000000).withOpacity(0.3), width: 1.5)),
            enabledBorder: UnderlineInputBorder(
                borderSide: BorderSide(color: const Color(0xFF000000).withOpacity(0.3), width: 1.5)),
            focusedBorder:
                UnderlineInputBorder(borderSide: BorderSide(color: themeColor ?? primaryColor, width: 1.5)),
            disabledBorder:
                UnderlineInputBorder(borderSide: BorderSide(color: const Color(0xFF000000).withOpacity(0.3))))),
  );
}