2025-08-27 16:19:54 +07:00
|
|
|
part of 'field.dart';
|
|
|
|
|
|
|
|
|
|
class AppTextFormField extends StatelessWidget {
|
|
|
|
|
const AppTextFormField({
|
|
|
|
|
super.key,
|
|
|
|
|
this.hintText,
|
|
|
|
|
required this.title,
|
|
|
|
|
this.controller,
|
|
|
|
|
this.focusNode,
|
|
|
|
|
this.prefixIcon,
|
|
|
|
|
this.suffixIcon,
|
|
|
|
|
this.keyboardType,
|
|
|
|
|
this.onChanged,
|
2025-09-18 08:01:49 +07:00
|
|
|
this.validator,
|
2025-08-27 16:19:54 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
final String? hintText;
|
|
|
|
|
final String title;
|
|
|
|
|
final TextEditingController? controller;
|
|
|
|
|
final FocusNode? focusNode;
|
|
|
|
|
final Widget? prefixIcon;
|
|
|
|
|
final Widget? suffixIcon;
|
|
|
|
|
final TextInputType? keyboardType;
|
|
|
|
|
final ValueChanged<String>? onChanged;
|
2025-09-18 08:01:49 +07:00
|
|
|
final String? Function(String?)? validator;
|
2025-08-27 16:19:54 +07:00
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(title, style: AppStyle.lg.copyWith(fontWeight: FontWeight.w600)),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
TextFormField(
|
|
|
|
|
controller: controller,
|
|
|
|
|
focusNode: focusNode,
|
|
|
|
|
keyboardType: keyboardType,
|
|
|
|
|
onChanged: onChanged,
|
|
|
|
|
cursorColor: AppColor.primary,
|
|
|
|
|
style: AppStyle.md.copyWith(
|
|
|
|
|
color: AppColor.textPrimary,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
2025-09-18 08:01:49 +07:00
|
|
|
validator: validator,
|
2025-08-27 16:19:54 +07:00
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: hintText,
|
|
|
|
|
prefixIcon: prefixIcon,
|
|
|
|
|
suffixIcon: suffixIcon,
|
|
|
|
|
prefixIconConstraints: const BoxConstraints(
|
|
|
|
|
minWidth: 0,
|
|
|
|
|
minHeight: 0,
|
|
|
|
|
),
|
|
|
|
|
suffixIconConstraints: const BoxConstraints(
|
|
|
|
|
minWidth: 0,
|
|
|
|
|
minHeight: 0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|