commonUnderLineTextField static method
Widget
commonUnderLineTextField({
- List<
TextInputFormatter> ? inputFormatters, - TextInputAction? textInputAction,
- required String labelText,
- required bool useMobileLayout,
- bool? readOnly,
- String? hintText,
- bool? isObscure,
- TextEditingController? controller,
- dynamic onChanged()?,
- Widget? prefix,
- String? helperText = "",
- Widget? suffixIcon,
- TextInputType? keyboardType,
- String? validator()?,
- Color? themeColor,
- FocusNode? focusNode,
- dynamic onTap()?,
- 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))))),
);
}