import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:tanami_app/core/styles/app_color.dart'; import 'package:tanami_app/core/styles/app_text.dart'; import 'package:tanami_app/shared/components/password_text_form_field.dart'; import 'package:tanami_app/shared/components/text_widget.dart'; import 'text_from_field_widget.dart'; class FormLabelTextField extends StatelessWidget { const FormLabelTextField({ super.key, required this.title, required this.type, required this.textEditingController, required this.hintText, }); final String title; final String type; final String hintText; final TextEditingController textEditingController; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ TextWidget().tex14W500( title, clr: AppColor.textLabelColor, ), const Gap(10), type == "password" ? PasswordField( controller: textEditingController, ) : textFormField( validator: (value) { if (type == "phone number") { if (value != null && value.isEmpty) { return AppText.enterPhoneNo; } return null; } else if (type == "country selection") { if (textEditingController.text.isEmpty) { return AppText.chooseCountry; } return null; } else { return null; } }, texttype: type == "phone number" ? TextInputType.phone : TextInputType.none, textEditingController: textEditingController, readonly: type == "country selection" ? true : false, hintText: hintText, suffixIcon: type == "country selection" ? const Icon( Icons.arrow_forward_ios_rounded, color: Color(0xFFB4B4B4), ) : const SizedBox()) ], ); } }