import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:onufitness/constants/color_constant.dart'; import 'package:onufitness/utils/helper_function.dart'; class CustomAuthTextfield extends StatelessWidget { final String hintText; final TextEditingController? controller; final TextInputType keyboardType; final bool obscureText; final Color fillColor; final Color borderColor; final double? borderRadius; final double? fontSize; final Color hintTextColor; final Color textColor; final EdgeInsetsGeometry? contentPadding; final BorderSide borderSide; final TextStyle? hintStyle; final TextStyle? textStyle; final Widget? prefixIcon; final bool enabled; final VoidCallback? onSuffixIconTap; final bool showSuffixIcon; final bool readOnly; final ValueChanged? onChanged; // Added onChange property const CustomAuthTextfield({ super.key, required this.hintText, this.controller, this.keyboardType = TextInputType.text, this.obscureText = false, this.fillColor = Colors.white, this.borderColor = textfieldBorderColorSky, this.borderRadius, this.fontSize, this.hintTextColor = Colors.black54, this.textColor = Colors.black, this.contentPadding, this.borderSide = const BorderSide(color: textfieldBorderColorSky), this.hintStyle, this.textStyle, this.prefixIcon, this.enabled = true, this.onSuffixIconTap, this.showSuffixIcon = false, this.readOnly = false, this.onChanged, }); @override Widget build(BuildContext context) { return TextField( controller: controller, readOnly: readOnly, keyboardType: keyboardType, obscureText: obscureText, enabled: enabled, onChanged: onChanged, style: textStyle ?? TextStyle( fontSize: (fontSize ?? (isTablet ? 20.sp : 14.sp)), color: textColor, ), decoration: InputDecoration( hintText: hintText, hintStyle: hintStyle ?? TextStyle( fontSize: (fontSize ?? (isTablet ? 20.sp : 14.sp)), color: hintTextColor, ), filled: true, fillColor: fillColor, contentPadding: contentPadding ?? EdgeInsets.symmetric( horizontal: isTablet ? 22.w : 20.w, vertical: isTablet ? 15.h : 14.h, ), border: OutlineInputBorder( borderRadius: BorderRadius.circular( (borderRadius ?? (isTablet ? 40.r : 30.r)), ), borderSide: borderSide, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular( (borderRadius ?? (isTablet ? 40.r : 30.r)), ), borderSide: borderSide, ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular( (borderRadius ?? (isTablet ? 40.r : 30.r)), ), borderSide: const BorderSide(color: Colors.black), ), prefixIcon: prefixIcon, suffixIcon: showSuffixIcon ? IconButton( icon: Icon( obscureText ? Icons.visibility_off : Icons.visibility, color: Colors.black, size: isTablet ? 20.sp : null, ), onPressed: onSuffixIconTap, ) : null, ), ); } }