import 'package:flutter/material.dart'; import '../../../utils/text_style.dart'; class CustomTextField extends StatelessWidget { final TextEditingController? controller; final String hintText; final String? displayText; final bool readOnly; final TextInputType? keyboardType; final bool obscureText; final Widget? suffixIcon; final double? tm; const CustomTextField({ Key? key, this.controller, required this.hintText, this.displayText, this.readOnly = false, this.keyboardType, this.obscureText = false, this.suffixIcon, this.tm, }) : super(key: key); @override Widget build(BuildContext context) { final wm = MediaQuery.of(context).size.width / 100; final hm = MediaQuery.of(context).size.height / 100; return Container( margin: EdgeInsets.symmetric(horizontal: wm * 5, vertical: hm * 1), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), border: Border.all( color: readOnly ? Colors.grey.withOpacity(0.3) : Colors.grey.withOpacity(0.2), width: 1, ), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.05), blurRadius: 6, offset: const Offset(0, 2), ), ], ), child: TextField( controller: controller, readOnly: readOnly, keyboardType: keyboardType, obscureText: obscureText, style: tS('Inter', 16, FontWeight.w500, Colors.black87), decoration: InputDecoration( hintText: displayText ?? hintText, hintStyle: displayText != null ? tS('Inter', 16, FontWeight.w500, Colors.black87) : tS('Inter', 16, FontWeight.w400, Colors.grey.shade600), contentPadding: EdgeInsets.symmetric( horizontal: wm * 4, vertical: hm * 2.2, ), border: InputBorder.none, suffixIcon: suffixIcon, ), ), ); } }