|
|
|
|
@ -42,15 +42,12 @@ class _RegisterNew extends State<RegisterNewStep2> {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
authVM?.clearAllStep2FieldErrors();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Call insurance API to fetch data
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
debugPrint("Registration Step 2: Calling insurance API");
|
|
|
|
|
// Reset the flag to ensure API gets called
|
|
|
|
|
insuranceVM?.setIsInsuranceDataToBeLoaded(true);
|
|
|
|
|
insuranceVM?.initInsuranceProvider();
|
|
|
|
|
debugPrint("Registration Step 2: Insurance API call initiated");
|
|
|
|
|
});
|
|
|
|
|
if (!authVM!.isUserFromUAE()) {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
insuranceVM?.setIsInsuranceDataToBeLoaded(true);
|
|
|
|
|
insuranceVM?.initInsuranceProvider();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -188,254 +185,256 @@ class _RegisterNew extends State<RegisterNewStep2> {
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(left: 16.h, right: 16.h),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: authVM!.isUserFromUAE() ? LocaleKeys.fullName.tr(context: context) : LocaleKeys.name.tr(context: context),
|
|
|
|
|
hintText: authVM!.isUserFromUAE() ? LocaleKeys.enterNameHere.tr(context: context) : (name),
|
|
|
|
|
controller: authVM!.isUserFromUAE() ? authVM!.nameController : null,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
// textInputAction: TextInputAction.done,
|
|
|
|
|
onSubmitted: (value) {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
},
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
// Clear error when user starts typing
|
|
|
|
|
authVM!.clearNameError();
|
|
|
|
|
},
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: authVM!.isUserFromUAE() ? false : true,
|
|
|
|
|
leadingIcon: AppAssets.user_circle,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
).paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show error message if exists
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.nameError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 52.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.nameError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: authVM!.isUserFromUAE() ? LocaleKeys.fullName.tr(context: context) : LocaleKeys.name.tr(context: context),
|
|
|
|
|
hintText: authVM!.isUserFromUAE() ? LocaleKeys.enterNameHere.tr(context: context) : (name),
|
|
|
|
|
controller: authVM!.isUserFromUAE() ? authVM!.nameController : null,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
// hintColor: Color(0xff898A8D),
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
onSubmitted: (value) {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
},
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
authVM!.clearNameError();
|
|
|
|
|
},
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: authVM!.isUserFromUAE() ? false : true,
|
|
|
|
|
leadingIcon: AppAssets.user_circle,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
).paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show error message if exists
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.nameError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 0.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.nameError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1.h, color: AppColors.greyColor),
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.nationalIdNumber.tr(context: context),
|
|
|
|
|
hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : (appState.getNHICUserData.idNumber ?? ""),
|
|
|
|
|
controller: null,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.student_card)
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
Divider(height: 1, color: AppColors.greyColor),
|
|
|
|
|
authVM!.isUserFromUAE()
|
|
|
|
|
? Selector<AuthenticationViewModel, GenderTypeEnum?>(
|
|
|
|
|
selector: (_, authViewModel) => authViewModel.genderType,
|
|
|
|
|
shouldRebuild: (previous, next) => previous != next,
|
|
|
|
|
builder: (context, genderType, child) {
|
|
|
|
|
final authVM = context.read<AuthenticationViewModel>();
|
|
|
|
|
return DropdownWidget(
|
|
|
|
|
labelText: LocaleKeys.gender.tr(context: context),
|
|
|
|
|
hintText: LocaleKeys.malE.tr(context: context),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
dropdownItems: GenderTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(),
|
|
|
|
|
selectedValue: genderType != null ? (appState.isArabic() ? genderType.typeAr : genderType.type) : "",
|
|
|
|
|
onChange: authVM.onGenderChange,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
hasSelectionCustomIcon: true,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0),
|
|
|
|
|
selectionCustomIcon: AppAssets.arrow_down,
|
|
|
|
|
leadingIcon: AppAssets.user_full,
|
|
|
|
|
).withVerticalPadding(8);
|
|
|
|
|
})
|
|
|
|
|
: TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.gender.tr(context: context),
|
|
|
|
|
hintText: (appState.getNHICUserData.gender ?? ""),
|
|
|
|
|
Divider(height: 1.h, color: AppColors.greyColor),
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.nationalIdNumber.tr(context: context),
|
|
|
|
|
hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : (appState.getNHICUserData.idNumber ?? ""),
|
|
|
|
|
controller: null,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: authVM!.isUserFromUAE() ? false : true,
|
|
|
|
|
leadingIcon: AppAssets.user_full,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
onChange: (value) {})
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show gender error message if exists (for UAE users)
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.genderError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 52.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.genderError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1, color: AppColors.greyColor),
|
|
|
|
|
authVM!.isUserFromUAE()
|
|
|
|
|
? Selector<AuthenticationViewModel, MaritalStatusTypeEnum?>(
|
|
|
|
|
selector: (_, authViewModel) => authViewModel.maritalStatus,
|
|
|
|
|
shouldRebuild: (previous, next) => previous != next,
|
|
|
|
|
builder: (context, maritalStatus, child) {
|
|
|
|
|
final authVM = context.read<AuthenticationViewModel>(); // For onChange
|
|
|
|
|
return DropdownWidget(
|
|
|
|
|
labelText: LocaleKeys.maritalStatus.tr(context: context),
|
|
|
|
|
hintText: LocaleKeys.married.tr(context: context),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
dropdownItems: MaritalStatusTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(),
|
|
|
|
|
selectedValue: maritalStatus != null ? (appState.isArabic() ? maritalStatus.typeAr : maritalStatus.type) : "",
|
|
|
|
|
onChange: authVM.onMaritalStatusChange,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
hasSelectionCustomIcon: true,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0),
|
|
|
|
|
selectionCustomIcon: AppAssets.arrow_down,
|
|
|
|
|
leadingIcon: AppAssets.smart_phone,
|
|
|
|
|
).withVerticalPadding(8);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.maritalStatus.tr(context: context),
|
|
|
|
|
hintText: appState.isArabic()
|
|
|
|
|
? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)?.typeAr ?? '')
|
|
|
|
|
: (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)?.type ?? ''),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.smart_phone,
|
|
|
|
|
onChange: (value) {})
|
|
|
|
|
leadingIcon: AppAssets.student_card)
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show marital status error message if exists (for UAE users)
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.maritalStatusError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 52.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.maritalStatusError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
Divider(height: 1, color: AppColors.greyColor),
|
|
|
|
|
authVM!.isUserFromUAE()
|
|
|
|
|
? Selector<AuthenticationViewModel, GenderTypeEnum?>(
|
|
|
|
|
selector: (_, authViewModel) => authViewModel.genderType,
|
|
|
|
|
shouldRebuild: (previous, next) => previous != next,
|
|
|
|
|
builder: (context, genderType, child) {
|
|
|
|
|
final authVM = context.read<AuthenticationViewModel>();
|
|
|
|
|
return DropdownWidget(
|
|
|
|
|
labelText: LocaleKeys.gender.tr(context: context),
|
|
|
|
|
hintText: LocaleKeys.malE.tr(context: context),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
dropdownItems: GenderTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(),
|
|
|
|
|
selectedValue: genderType != null ? (appState.isArabic() ? genderType.typeAr : genderType.type) : "",
|
|
|
|
|
onChange: authVM.onGenderChange,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
hasSelectionCustomIcon: true,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0),
|
|
|
|
|
selectionCustomIcon: AppAssets.arrow_down,
|
|
|
|
|
leadingIcon: AppAssets.user_full,
|
|
|
|
|
).withVerticalPadding(8);
|
|
|
|
|
})
|
|
|
|
|
: TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.gender.tr(context: context),
|
|
|
|
|
hintText: (appState.getNHICUserData.gender ?? ""),
|
|
|
|
|
controller: null,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: authVM!.isUserFromUAE() ? false : true,
|
|
|
|
|
leadingIcon: AppAssets.user_full,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
onChange: (value) {})
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show gender error message if exists (for UAE users)
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.genderError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 0.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.genderError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1, color: AppColors.greyColor),
|
|
|
|
|
authVM!.isUserFromUAE()
|
|
|
|
|
? Selector<AuthenticationViewModel, MaritalStatusTypeEnum?>(
|
|
|
|
|
selector: (_, authViewModel) => authViewModel.maritalStatus,
|
|
|
|
|
shouldRebuild: (previous, next) => previous != next,
|
|
|
|
|
builder: (context, maritalStatus, child) {
|
|
|
|
|
final authVM = context.read<AuthenticationViewModel>(); // For onChange
|
|
|
|
|
return DropdownWidget(
|
|
|
|
|
labelText: LocaleKeys.maritalStatus.tr(context: context),
|
|
|
|
|
hintText: LocaleKeys.married.tr(context: context),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
dropdownItems: MaritalStatusTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(),
|
|
|
|
|
selectedValue: maritalStatus != null ? (appState.isArabic() ? maritalStatus.typeAr : maritalStatus.type) : "",
|
|
|
|
|
onChange: authVM.onMaritalStatusChange,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
hasSelectionCustomIcon: true,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0),
|
|
|
|
|
selectionCustomIcon: AppAssets.arrow_down,
|
|
|
|
|
leadingIcon: AppAssets.smart_phone,
|
|
|
|
|
).withVerticalPadding(8);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.maritalStatus.tr(context: context),
|
|
|
|
|
hintText: appState.isArabic()
|
|
|
|
|
? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)?.typeAr ?? '')
|
|
|
|
|
: (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)?.type ?? ''),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.smart_phone,
|
|
|
|
|
onChange: (value) {})
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show marital status error message if exists (for UAE users)
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.maritalStatusError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 0.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.maritalStatusError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1.h, color: AppColors.greyColor),
|
|
|
|
|
authVM!.isUserFromUAE()
|
|
|
|
|
? Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
|
|
|
|
|
selector: (context, authViewModel) {
|
|
|
|
|
final appState = getIt.get<AppState>();
|
|
|
|
|
return (
|
|
|
|
|
countriesList: authViewModel.countriesList,
|
|
|
|
|
selectedCountry: authViewModel.pickedCountryByUAEUser,
|
|
|
|
|
isArabic: appState.isArabic(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
shouldRebuild: (previous, next) =>
|
|
|
|
|
previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
|
|
|
|
|
builder: (context, data, child) {
|
|
|
|
|
final authVM = context.read<AuthenticationViewModel>();
|
|
|
|
|
return DropdownWidget(
|
|
|
|
|
labelText: LocaleKeys.country.tr(context: context),
|
|
|
|
|
hintText: LocaleKeys.uae.tr(context: context),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
|
|
|
|
|
selectedValue: data.selectedCountry != null
|
|
|
|
|
? data.isArabic
|
|
|
|
|
? data.selectedCountry!.nameN ?? ""
|
|
|
|
|
: data.selectedCountry!.name ?? ""
|
|
|
|
|
: "",
|
|
|
|
|
onChange: authVM.onUAEUserCountrySelection,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
hasSelectionCustomIcon: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0),
|
|
|
|
|
selectionCustomIcon: AppAssets.arrow_down,
|
|
|
|
|
leadingIcon: AppAssets.globe,
|
|
|
|
|
).withVerticalPadding(8.h);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.nationality.tr(context: context),
|
|
|
|
|
hintText: appState.isArabic()
|
|
|
|
|
? (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "")
|
|
|
|
|
: (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.globe,
|
|
|
|
|
onChange: (value) {})
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show country error message if exists (for UAE users)
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.countryError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 0.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.countryError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
color: AppColors.greyColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1.h, color: AppColors.greyColor),
|
|
|
|
|
authVM!.isUserFromUAE()
|
|
|
|
|
? Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
|
|
|
|
|
selector: (context, authViewModel) {
|
|
|
|
|
final appState = getIt.get<AppState>();
|
|
|
|
|
return (
|
|
|
|
|
countriesList: authViewModel.countriesList,
|
|
|
|
|
selectedCountry: authViewModel.pickedCountryByUAEUser,
|
|
|
|
|
isArabic: appState.isArabic(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
|
|
|
|
|
builder: (context, data, child) {
|
|
|
|
|
final authVM = context.read<AuthenticationViewModel>();
|
|
|
|
|
return DropdownWidget(
|
|
|
|
|
labelText: LocaleKeys.country.tr(context: context),
|
|
|
|
|
hintText: LocaleKeys.uae.tr(context: context),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
|
|
|
|
|
selectedValue: data.selectedCountry != null
|
|
|
|
|
? data.isArabic
|
|
|
|
|
? data.selectedCountry!.nameN ?? ""
|
|
|
|
|
: data.selectedCountry!.name ?? ""
|
|
|
|
|
: "",
|
|
|
|
|
onChange: authVM.onUAEUserCountrySelection,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
hasSelectionCustomIcon: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0),
|
|
|
|
|
selectionCustomIcon: AppAssets.arrow_down,
|
|
|
|
|
leadingIcon: AppAssets.globe,
|
|
|
|
|
).withVerticalPadding(8.h);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.nationality.tr(context: context),
|
|
|
|
|
hintText: appState.isArabic()
|
|
|
|
|
? (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "")
|
|
|
|
|
: (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""),
|
|
|
|
|
isEnable: true,
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.mobileNumber.tr(context: context),
|
|
|
|
|
hintText: appState.getUserRegistrationPayload.patientMobileNumber.toString(),
|
|
|
|
|
controller: null,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.globe,
|
|
|
|
|
onChange: (value) {})
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
leadingIcon: AppAssets.call)
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
// Show country error message if exists (for UAE users)
|
|
|
|
|
if (authVM!.isUserFromUAE() && authVM!.countryError != null)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 52.w, top: 4.h, bottom: 4.h, right: 16.w),
|
|
|
|
|
child: Text(
|
|
|
|
|
authVM!.countryError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
height: 1.h,
|
|
|
|
|
color: AppColors.greyColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
color: AppColors.greyColor,
|
|
|
|
|
),
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.mobileNumber.tr(context: context),
|
|
|
|
|
hintText: appState.getUserRegistrationPayload.patientMobileNumber.toString(),
|
|
|
|
|
controller: null,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isAllowRadius: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
leadingIcon: AppAssets.call)
|
|
|
|
|
.paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
Divider(
|
|
|
|
|
height: 1.h,
|
|
|
|
|
color: AppColors.greyColor,
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.dob.tr(context: context),
|
|
|
|
|
hintText: authVM!.isUserFromUAE() ? (appState.getUserRegistrationPayload.dob ?? '') : (appState.getNHICUserData.dateOfBirth ?? ""),
|
|
|
|
|
controller: authVM!.isUserFromUAE() ? authVM!.dobController : null,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.birthday_cake,
|
|
|
|
|
selectionType: null,
|
|
|
|
|
).paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.dob.tr(context: context),
|
|
|
|
|
hintText: authVM!.isUserFromUAE() ? (appState.getUserRegistrationPayload.dob ?? '') : (appState.getNHICUserData.dateOfBirth ?? ""),
|
|
|
|
|
controller: authVM!.isUserFromUAE() ? authVM!.dobController : null,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
isReadOnly: true,
|
|
|
|
|
labelColor: AppColors.textColor,
|
|
|
|
|
leadingIcon: AppAssets.birthday_cake,
|
|
|
|
|
selectionType: null,
|
|
|
|
|
).paddingSymmetrical(0.h, 8.h),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 50.h),
|
|
|
|
|
|