buildMainFormTextField method
Widget
buildMainFormTextField({
- required FieldData fieldData,
- bool isEnable = true,
- bool obscureText = false,
- String? value,
- FormFieldValidator<
String> ? validator, - dynamic onChange(
- String value
- TextInputAction? textInputAction,
- TextInputType? textInputType,
- int? maxLength,
- Function? onPressSuffixIcon,
- dynamic onPress()?,
- TextEditingController? controller,
- List<
TextInputFormatter> ? formatters,
Implementation
Widget buildMainFormTextField({
required FieldData fieldData,
bool isEnable = true,
bool obscureText = false,
String? value,
FormFieldValidator<String>? validator,
Function(String value)? onChange,
TextInputAction? textInputAction,
TextInputType? textInputType,
int? maxLength,
Function? onPressSuffixIcon,
Function()? onPress,
TextEditingController? controller,
List<TextInputFormatter>? formatters,
}) {
return SizedBox(
child: InkWell(
onTap: onPress,
child: AppTextField(
margin: EdgeInsetsDirectional.symmetric(
horizontal: 10.sp, vertical: 5.sp),
formatters: formatters,
initialValue: value,
maxLines: 1,
maxLength: maxLength,
onChanged: onChange,
obscureText: obscureText,
textDirection: textDirection,
controller: controller,
labelKey: fieldData.lable,
enabled: isEnable,
hintKey: fieldData.hint,
fillColor: Colors.transparent,
// focusNode: fieldData.focusNode,
labelTextStyle: TextStyle(
fontFamily: FontFamily().normalFont,
color: AppColors.primary.withOpacity(0.5),
fontSize: 12.sp,
),
validator: validator,
textInputAction: textInputAction ?? TextInputAction.next,
textInputType: textInputType ?? TextInputType.text,
prefixIcon: Padding(
padding: EdgeInsetsDirectional.all(5.sp),
child: SizedBox(
width: 20.sp,
height: 20.sp,
child: SvgPicture.asset(
fieldData.prefixIconPath,
package: 'cowpay',
)),
),
suffixIcon:
(fieldData.suffixIconPath != null && onPressSuffixIcon != null)
? InkWell(
onTap: () {
onPressSuffixIcon();
},
child: Padding(
padding: EdgeInsetsDirectional.only(
start: 10.sp,
end: 15.sp,
top: 18.sp,
bottom: 10.sp),
child: SizedBox(
width: 20.sp,
height: 20.sp,
child: SvgPicture.asset(
fieldData.suffixIconPath!,
package: 'cowpay',
),
),
),
)
: null,
),
),
);
}