pull/8/head
aamir-csol 2 months ago
parent 0309299f44
commit e41ffd583d

@ -23,13 +23,28 @@ class AuthenticationViewModel extends ChangeNotifier {
final TextEditingController nationalIdController = TextEditingController(); final TextEditingController nationalIdController = TextEditingController();
final TextEditingController phoneNumberController = TextEditingController(); final TextEditingController phoneNumberController = TextEditingController();
CountryEnum selectedCountry = CountryEnum.saudiArabia;
bool isTermsAccepted = false;
void login() { void login() {
if (ValidationUtils.isValidatePhoneAndId(nationalId: nationalIdController.text, phoneNumber: phoneNumberController.text)) { if (ValidationUtils.isValidatePhoneAndId(nationalId: nationalIdController.text, phoneNumber: phoneNumberController.text)) {
} else {} } else {}
} }
void onCountryChange(CountryEnum country) {
selectedCountry = country;
notifyListeners();
}
void onPhoneNumberChange(String? phoneNumber) {
phoneNumberController.text = phoneNumber!;
}
void onTermAccepted() {
isTermsAccepted = !isTermsAccepted;
notifyListeners();
}
Future<void> selectDeviceImei({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> selectDeviceImei({Function(dynamic)? onSuccess, Function(String)? onError}) async {
String firebaseToken = "dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc"; String firebaseToken = "dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc";
final result = await authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken); final result = await authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);

@ -83,7 +83,7 @@ class _LoginScreen extends State<LoginScreen> {
icon: AppAssets.login1, icon: AppAssets.login1,
iconColor: Colors.white, iconColor: Colors.white,
onPressed: () { onPressed: () {
showLoginModel(context: context, textController: authVm.phoneNumberController); showLoginModel(context: context, authVM: authVm);
// if (nationIdController.text.isNotEmpty) { // if (nationIdController.text.isNotEmpty) {
// } else { // } else {
@ -140,7 +140,7 @@ class _LoginScreen extends State<LoginScreen> {
); );
} }
void showLoginModel({required BuildContext context, TextEditingController? textController}) { void showLoginModel({required BuildContext context, required AuthenticationViewModel authVM}) {
context.showBottomSheet( context.showBottomSheet(
isScrollControlled: true, isScrollControlled: true,
isDismissible: false, isDismissible: false,
@ -151,12 +151,12 @@ class _LoginScreen extends State<LoginScreen> {
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: SingleChildScrollView( child: SingleChildScrollView(
child: GenericBottomSheet( child: GenericBottomSheet(
countryCode: "966", countryCode: authVM.selectedCountry.countryCode,
initialPhoneNumber: "", initialPhoneNumber: "",
textController: textController, textController: authVM.phoneNumberController,
isEnableCountryDropdown: true, isEnableCountryDropdown: true,
onCountryChange: (value) {}, onCountryChange: authVM.onCountryChange,
onChange: (String? value) {}, onChange: authVM.onPhoneNumberChange,
buttons: [ buttons: [
Padding( Padding(
padding: EdgeInsets.only(bottom: 10.h), padding: EdgeInsets.only(bottom: 10.h),

@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
@ -18,6 +19,7 @@ import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dar
import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart'; import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart';
import 'package:hmg_patient_app_new/widgets/otp/otp.dart'; import 'package:hmg_patient_app_new/widgets/otp/otp.dart';
import 'package:provider/provider.dart';
class RegisterNew extends StatefulWidget { class RegisterNew extends StatefulWidget {
@override @override
@ -25,8 +27,6 @@ class RegisterNew extends StatefulWidget {
} }
class _RegisterNew extends State<RegisterNew> { class _RegisterNew extends State<RegisterNew> {
bool isTermsAccepted = true;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -40,6 +40,8 @@ class _RegisterNew extends State<RegisterNew> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
AuthenticationViewModel authVm = context.read<AuthenticationViewModel>();
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
appBar: CustomAppBar( appBar: CustomAppBar(
@ -68,12 +70,7 @@ class _RegisterNew extends State<RegisterNew> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Utils.showLottie(context: context, Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/register.json', width: 200.h, height: 200.h, fit: BoxFit.cover, repeat: true),
assetPath: 'assets/animations/lottie/register.json',
width: 200.h,
height: 200.h,
fit: BoxFit.cover,
repeat: true),
SizedBox(height: 16.h), SizedBox(height: 16.h),
LocaleKeys.prepareToElevate.tr().toText32(isBold: true), LocaleKeys.prepareToElevate.tr().toText32(isBold: true),
SizedBox(height: 24.h), SizedBox(height: 24.h),
@ -125,22 +122,25 @@ class _RegisterNew extends State<RegisterNew> {
), ),
SizedBox(height: 25.h), SizedBox(height: 25.h),
GestureDetector( GestureDetector(
onTap: () {}, onTap: authVm.onTermAccepted,
child: Row( child: Row(
children: [ children: [
AnimatedContainer( Selector<AuthenticationViewModel, bool>(
duration: const Duration(milliseconds: 200), selector: (_, viewModel) => viewModel.isTermsAccepted,
height: 24.h, shouldRebuild: (previous, next) => previous != next,
width: 24.h, builder: (context, isTermsAccepted, child) {
decoration: BoxDecoration( return AnimatedContainer(
color: isTermsAccepted ? const Color(0xFFE92227) : Colors.transparent, duration: const Duration(milliseconds: 200),
borderRadius: BorderRadius.circular(6), height: 24.h,
border: Border.all( width: 24.h,
color: isTermsAccepted ? const Color(0xFFE92227) : Colors.grey, decoration: BoxDecoration(
width: 2.h, color: isTermsAccepted ? AppColors.primaryRedColor : Colors.transparent,
), borderRadius: BorderRadius.circular(6),
), border: Border.all(color: isTermsAccepted ? AppColors.primaryRedBorderColor : AppColors.greyColor, width: 2.h),
child: isTermsAccepted ? Icon(Icons.check, size: 16.fSize, color: Colors.white) : null, ),
child: isTermsAccepted ? Icon(Icons.check, size: 16.fSize, color: Colors.white) : null,
);
},
), ),
SizedBox(width: 12.h), SizedBox(width: 12.h),
Expanded( Expanded(
@ -157,7 +157,7 @@ class _RegisterNew extends State<RegisterNew> {
text: "Register", text: "Register",
icon: AppAssets.note_edit, icon: AppAssets.note_edit,
onPressed: () { onPressed: () {
showRegisterModel(context: context); showRegisterModel(context: context, authVM: authVm);
}, },
), ),
SizedBox(height: 14), SizedBox(height: 14),
@ -200,118 +200,116 @@ class _RegisterNew extends State<RegisterNew> {
)); ));
} }
void showRegisterModel({required BuildContext context, TextEditingController? textController}) { void showRegisterModel({required BuildContext context, required AuthenticationViewModel authVM}) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
isDismissible: false, isDismissible: false,
useSafeArea: true, useSafeArea: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (bottomSheetContext) => builder: (bottomSheetContext) => Padding(
Padding( padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
padding: EdgeInsets.only(bottom: MediaQuery child: SingleChildScrollView(
.of(bottomSheetContext) child: GenericBottomSheet(
.viewInsets countryCode: authVM.selectedCountry.countryCode,
.bottom), initialPhoneNumber: "",
child: SingleChildScrollView( textController: authVM.phoneNumberController,
child: GenericBottomSheet( isEnableCountryDropdown: true,
countryCode: "966", onCountryChange: authVM.onCountryChange,
initialPhoneNumber: "", onChange: authVM.onPhoneNumberChange,
textController: TextEditingController(), buttons: [
isEnableCountryDropdown: true, Padding(
onChange: (String? value) {}, padding: const EdgeInsets.only(bottom: 10),
buttons: [ child: CustomButton(
Padding( text: LocaleKeys.sendOTPSMS.tr(),
padding: const EdgeInsets.only(bottom: 10), onPressed: () {
child: CustomButton( Navigator.of(context).push(MaterialPageRoute(
text: LocaleKeys.sendOTPSMS.tr(), builder: (BuildContext context) => OTPVerificationPage(
onPressed: () { phoneNumber: '12234567',
Navigator.of(context).push( )));
MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567',)));
// if (mobileNo.isEmpty) { // if (mobileNo.isEmpty) {
// context.showBottomSheet( // context.showBottomSheet(
// child: ExceptionBottomSheet( // child: ExceptionBottomSheet(
// message: TranslationBase.of(context).pleaseEnterMobile, // message: TranslationBase.of(context).pleaseEnterMobile,
// showCancel: false, // showCancel: false,
// onOkPressed: () { // onOkPressed: () {
// Navigator.of(context).pop(); // Navigator.of(context).pop();
// }, // },
// ), // ),
// ); // );
// } else if (!Utils.validateMobileNumber(mobileNo)) { // } else if (!Utils.validateMobileNumber(mobileNo)) {
// context.showBottomSheet( // context.showBottomSheet(
// child: ExceptionBottomSheet( // child: ExceptionBottomSheet(
// message: TranslationBase.of(context).pleaseEnterValidMobile, // message: TranslationBase.of(context).pleaseEnterValidMobile,
// showCancel: false, // showCancel: false,
// onOkPressed: () { // onOkPressed: () {
// Navigator.of(context).pop(); // Navigator.of(context).pop();
// }, // },
// ), // ),
// ); // );
// } else { // } else {
// registerUser(1); // registerUser(1);
// } // }
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567'))); Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567')));
}, },
backgroundColor: AppColors.primaryRedColor, backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedBorderColor, borderColor: AppColors.primaryRedBorderColor,
textColor: AppColors.whiteColor, textColor: AppColors.whiteColor,
icon: AppAssets.message, icon: AppAssets.message,
), ),
), ),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.h),
child: LocaleKeys.oR.tr().toText16(color: AppColors.textColor),
),
],
),
Padding( Padding(
padding: EdgeInsets.only(bottom: 10.h, top: 10.h), padding: EdgeInsets.symmetric(horizontal: 8.h),
child: CustomButton( child: LocaleKeys.oR.tr().toText16(color: AppColors.textColor),
text: LocaleKeys.sendOTPWHATSAPP.tr(),
onPressed: () {
// if (mobileNo.isEmpty) {
// context.showBottomSheet(
// child: ExceptionBottomSheet(
// message: TranslationBase.of(context).pleaseEnterMobile,
// showCancel: false,
// onOkPressed: () {
// Navigator.of(context).pop();
// },
// ),
// );
// } else if (!Utils.validateMobileNumber(mobileNo)) {
// context.showBottomSheet(
// child: ExceptionBottomSheet(
// message: TranslationBase.of(context).pleaseEnterValidMobile,
// showCancel: false,
// onOkPressed: () {
// Navigator.of(context).pop();
// },
// ),
// );
// } else {
// registerUser(4);
// }
// int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
// registerUser(val);
},
backgroundColor: AppColors.whiteColor,
borderColor: AppColors.borderOnlyColor,
textColor: AppColors.textColor,
icon: AppAssets.whatsapp,
),
), ),
], ],
), ),
), Padding(
padding: EdgeInsets.only(bottom: 10.h, top: 10.h),
child: CustomButton(
text: LocaleKeys.sendOTPWHATSAPP.tr(),
onPressed: () {
// if (mobileNo.isEmpty) {
// context.showBottomSheet(
// child: ExceptionBottomSheet(
// message: TranslationBase.of(context).pleaseEnterMobile,
// showCancel: false,
// onOkPressed: () {
// Navigator.of(context).pop();
// },
// ),
// );
// } else if (!Utils.validateMobileNumber(mobileNo)) {
// context.showBottomSheet(
// child: ExceptionBottomSheet(
// message: TranslationBase.of(context).pleaseEnterValidMobile,
// showCancel: false,
// onOkPressed: () {
// Navigator.of(context).pop();
// },
// ),
// );
// } else {
// registerUser(4);
// }
// int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
// registerUser(val);
},
backgroundColor: AppColors.whiteColor,
borderColor: AppColors.borderOnlyColor,
textColor: AppColors.textColor,
icon: AppAssets.whatsapp,
),
),
],
), ),
),
),
); );
} }
} }

@ -53,8 +53,11 @@ class _RegisterNew extends State<RegisterNewStep2> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar(
appBar: CustomAppBar(onBackPressed: () {}, onLanguageChanged: (lang) {}, hideLogoAndLang: true,), onBackPressed: () {},
onLanguageChanged: (lang) {},
hideLogoAndLang: true,
),
body: SingleChildScrollView( body: SingleChildScrollView(
reverse: false, reverse: false,
padding: EdgeInsets.only(left: 24.h, right: 24.h, top: 24.h), padding: EdgeInsets.only(left: 24.h, right: 24.h, top: 24.h),
@ -69,30 +72,38 @@ class _RegisterNew extends State<RegisterNewStep2> {
child: Column( child: Column(
children: [ children: [
TextInputWidget( TextInputWidget(
labelText: isFromDubai ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(), labelText: isFromDubai ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(),
hintText: isFromDubai ? "name" ?? "" : (widget.nHICData!.firstNameEn!.toUpperCase() + " " + widget.nHICData!.lastNameEn!.toUpperCase()), hintText: isFromDubai ? "name" ?? "" : (widget.nHICData!.firstNameEn!.toUpperCase() + " " + widget.nHICData!.lastNameEn!.toUpperCase()),
controller: null, controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true, isReadOnly: isFromDubai ? false : true,
leadingIcon: AppAssets.user_circle).paddingSymmetrical(0.h,16.h), leadingIcon: AppAssets.user_circle)
Divider(height: 1, color: AppColors.greyColor,), .paddingSymmetrical(0.h, 16.h),
Divider(
height: 1,
color: AppColors.greyColor,
),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.nationalIdNumber.tr(), labelText: LocaleKeys.nationalIdNumber.tr(),
hintText: isFromDubai ? "widget.payload.nationalID!" : (widget.nHICData!.idNumber ?? ""), hintText: isFromDubai ? "widget.payload.nationalID!" : (widget.nHICData!.idNumber ?? ""),
controller: null, controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.student_card).paddingSymmetrical(0.h,16.h), leadingIcon: AppAssets.student_card)
Divider(height: 1, color: AppColors.greyColor,), .paddingSymmetrical(0.h, 16.h),
Divider(
height: 1,
color: AppColors.greyColor,
),
isFromDubai isFromDubai
? DropdownWidget( ? DropdownWidget(
labelText: LocaleKeys.gender.tr(), labelText: LocaleKeys.gender.tr(),
@ -109,22 +120,25 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowRadius: false, isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down, selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.user_full, leadingIcon: AppAssets.user_full,
).withVerticalPadding(8) ).withVerticalPadding(8)
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.gender.tr(), labelText: LocaleKeys.gender.tr(),
hintText: (widget.nHICData!.gender ?? ""), hintText: (widget.nHICData!.gender ?? ""),
controller: null, controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true, isReadOnly: isFromDubai ? false : true,
leadingIcon: AppAssets.user_full, leadingIcon: AppAssets.user_full,
onChange: (value) {})
onChange: (value) {}).paddingSymmetrical(0.h,16.h), .paddingSymmetrical(0.h, 16.h),
Divider(height: 1, color: AppColors.greyColor,), Divider(
height: 1,
color: AppColors.greyColor,
),
isFromDubai isFromDubai
? DropdownWidget( ? DropdownWidget(
labelText: LocaleKeys.maritalStatus.tr(), labelText: LocaleKeys.maritalStatus.tr(),
@ -138,22 +152,26 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowRadius: false, isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down, selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.smart_phone, leadingIcon: AppAssets.smart_phone,
).withVerticalPadding(8) ).withVerticalPadding(8)
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.maritalStatus.tr(), labelText: LocaleKeys.maritalStatus.tr(),
hintText: appState!.isArabic() hintText: appState!.isArabic()
? (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.typeAr) ? (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.typeAr)
: (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.type), : (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.type),
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.smart_phone, leadingIcon: AppAssets.smart_phone,
onChange: (value) {}).paddingSymmetrical(0.h,16.h), onChange: (value) {})
Divider(height: 1, color: AppColors.greyColor,), .paddingSymmetrical(0.h, 16.h),
Divider(
height: 1,
color: AppColors.greyColor,
),
isFromDubai isFromDubai
? DropdownWidget( ? DropdownWidget(
labelText: LocaleKeys.country.tr(), labelText: LocaleKeys.country.tr(),
@ -170,46 +188,55 @@ class _RegisterNew extends State<RegisterNewStep2> {
leadingIcon: AppAssets.globe, leadingIcon: AppAssets.globe,
).withVerticalPadding(8) ).withVerticalPadding(8)
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.nationality.tr(), labelText: LocaleKeys.nationality.tr(),
hintText: appState!.isArabic() hintText: appState!.isArabic()
? (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "") ? (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "")
: (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""), : (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""),
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: AppAssets.globe,
onChange: (value) {})
.paddingSymmetrical(0.h, 16.h),
Divider(
height: 1,
color: AppColors.greyColor,
),
TextInputWidget(
labelText: LocaleKeys.mobileNumber.tr(),
hintText: ("widget.payload.mobileNo" ?? ""),
controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.globe, leadingIcon: AppAssets.call,
onChange: (value) {}).paddingSymmetrical(0.h,16.h), onChange: (value) {})
Divider(height: 1, color: AppColors.greyColor,), .paddingSymmetrical(0.h, 16.h),
TextInputWidget( Divider(
labelText: LocaleKeys.mobileNumber.tr(), height: 1,
hintText: ("widget.payload.mobileNo" ?? ""), color: AppColors.greyColor,
controller: null, ),
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: AppAssets.call,
onChange: (value) {}).paddingSymmetrical(0.h,16.h),
Divider(height: 1, color: AppColors.greyColor,),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.dob.tr(), labelText: LocaleKeys.dob.tr(),
hintText: isFromDubai ? "widget.payload.dob!" : (widget.nHICData!.dateOfBirth ?? ""), hintText: isFromDubai ? "widget.payload.dob!" : (widget.nHICData!.dateOfBirth ?? ""),
controller: null, controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
// : SelectionType.calendar, // : SelectionType.calendar,
// selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null, // selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null,
// selectionCustomIcon: AppAssets.calendar, // selectionCustomIcon: AppAssets.calendar,
leadingIcon: AppAssets.birthday_cake, leadingIcon: AppAssets.birthday_cake,
onChange: (value) {}).paddingSymmetrical(0.h,16.h), onChange: (value) {})
.paddingSymmetrical(0.h, 16.h),
], ],
), ),
), ),

@ -46,8 +46,8 @@ class _GenericBottomSheetState extends State<GenericBottomSheet> {
void initState() { void initState() {
super.initState(); super.initState();
if (!widget.isForEmail) { if (!widget.isForEmail && widget.textController != null) {
widget.textController = TextEditingController(text: widget.initialPhoneNumber); widget.textController!.text = widget.initialPhoneNumber!;
} }
} }
@ -116,13 +116,16 @@ class _GenericBottomSheetState extends State<GenericBottomSheet> {
padding: EdgeInsets.all(8.h), padding: EdgeInsets.all(8.h),
keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number, keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number,
onChange: (value) { onChange: (value) {
widget.textController!.text = value!;
if (widget.onChange != null) { if (widget.onChange != null) {
widget.onChange!(value); widget.onChange!(value);
} }
}, },
onCountryChange: (value) {
if (widget.onCountryChange != null) {
widget.onCountryChange!(value);
}
},
isEnable: true, isEnable: true,
// focusNode: widget.myFocusNode,
isReadOnly: widget.isFromSavedLogin, isReadOnly: widget.isFromSavedLogin,
prefix: widget.isForEmail ? null : widget.countryCode, prefix: widget.isForEmail ? null : widget.countryCode,
isBorderAllowed: false, isBorderAllowed: false,

@ -28,11 +28,12 @@ class TextInputWidget extends StatelessWidget {
final bool isCountryDropDown; final bool isCountryDropDown;
final bool hasError; final bool hasError;
final String? errorMessage; final String? errorMessage;
Function(CountryEnum)? onCountryChange;
// final List<Country> countryList; // final List<Country> countryList;
// final Function(Country)? onCountryChange; // final Function(Country)? onCountryChange;
const TextInputWidget({ TextInputWidget({
Key? key, Key? key,
required this.labelText, required this.labelText,
required this.hintText, required this.hintText,
@ -52,6 +53,7 @@ class TextInputWidget extends StatelessWidget {
this.isCountryDropDown = false, this.isCountryDropDown = false,
this.hasError = false, this.hasError = false,
this.errorMessage, this.errorMessage,
this.onCountryChange,
// this.countryList = const [], // this.countryList = const [],
// this.onCountryChange, // this.onCountryChange,
}) : super(key: key); }) : super(key: key);
@ -74,32 +76,27 @@ class TextInputWidget extends StatelessWidget {
child: Row( child: Row(
textDirection: Directionality.of(context), textDirection: Directionality.of(context),
children: [ children: [
if (isAllowLeadingIcon && leadingIcon != null && !isCountryDropDown) if (isAllowLeadingIcon && leadingIcon != null && !isCountryDropDown) _buildLeadingIcon(context),
_buildLeadingIcon(context), isCountryDropDown
isCountryDropDown ? CustomCountryDropdown(
? CustomCountryDropdown( countryList: CountryEnum.values,
countryList: CountryEnum.values, onCountryChange: onCountryChange,
onCountryChange: (CountryEnum? value) { isRtl: Directionality.of(context) == TextDirection.rtl,
print(value); isFromBottomSheet: isCountryDropDown,
}, isEnableTextField: true,
isRtl: Directionality.of(context) == TextDirection.rtl, onPhoneNumberChanged: onChange,
isFromBottomSheet: isCountryDropDown, // textField: _buildTextField(context),
isEnableTextField: true, )
onPhoneNumberChanged: (value) { : Expanded(
print(value); child: Column(
}, mainAxisSize: MainAxisSize.min,
textField: _buildTextField(context), crossAxisAlignment: CrossAxisAlignment.start,
) children: [
: Expanded( _buildLabelText(),
child: Column( _buildTextField(context),
mainAxisSize: MainAxisSize.min, ],
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildLabelText(),
_buildTextField(context),
],
),
), ),
),
], ],
), ),
), ),

Loading…
Cancel
Save