register step 2 & fixes

pull/8/head
aamir-csol 2 months ago
parent ed24365eff
commit 7321da67e3

File diff suppressed because it is too large Load Diff

@ -186,7 +186,6 @@
"middleName": "اسم الأب",
"lastName": "اسم العائلة",
"female": "أنثى",
"male": "ذكر",
"preferredLanguage": "اللغة المفضلة *",
"locationsRegister": "أين ترغب في إنشاء هذا الملف؟",
"ksa": "السعودية",
@ -790,5 +789,9 @@
"notice": "إشعار",
"oR": "أو",
"sendOTPWHATSAPP": "أرسل لي OTP عبر واتساب",
"sendOTPSMS": "أرسل لي OTP عبر الرسائل القصيرة"
"sendOTPSMS": "أرسل لي OTP عبر الرسائل القصيرة",
"fullName": "الاسم الكامل",
"married": "متزوج",
"uae": "الإمارات العربية المتحدة",
"malE": "ذكر"
}

@ -186,7 +186,6 @@
"middleName": "Middle Name",
"lastName": "Last Name",
"female": "Female",
"male": "Male",
"preferredLanguage": "Preferred Language *",
"locationsRegister": "Where do you want to create this file?",
"ksa": "KSA",
@ -786,5 +785,9 @@
"notice": "Notice",
"oR": "OR",
"sendOTPWHATSAPP": "Send me OTP on Whatsapp",
"sendOTPSMS": "Send me OTP on SMS"
"sendOTPSMS": "Send me OTP on SMS",
"fullName": "Full Name",
"married": "Married",
"uae" : "United Arab Emirates",
"malE": "Male"
}

@ -0,0 +1,29 @@
import 'dart:convert';
class NationalityCountries {
String? id;
String? name;
String? nameN;
NationalityCountries({
this.id,
this.name,
this.nameN,
});
factory NationalityCountries.fromRawJson(String str) => NationalityCountries.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory NationalityCountries.fromJson(Map<String, dynamic> json) => NationalityCountries(
id: json["ID"],
name: json["Name"],
nameN: json["NameN"],
);
Map<String, dynamic> toJson() => {
"ID": id,
"Name": name,
"NameN": nameN,
};
}

@ -435,3 +435,106 @@ extension CountryExtension on CountryEnum {
}
}
extension GenderTypeExtension on GenderTypeEnum {
String get value => this == GenderTypeEnum.male ? "M" : "F";
String get type => this == GenderTypeEnum.male ? "Male" : "Female";
String get typeAr => this == GenderTypeEnum.male ? "ذكر" : "أنثى";
static GenderTypeEnum? fromValue(String? value) {
switch (value) {
case "M":
return GenderTypeEnum.male;
case "F":
return GenderTypeEnum.female;
default:
return null;
}
}
static GenderTypeEnum? fromType(String? type) {
switch (type) {
case "Male":
return GenderTypeEnum.male;
case "Female":
return GenderTypeEnum.female;
default:
return null;
}
}
}
extension MaritalStatusTypeExtension on MaritalStatusTypeEnum {
String get value {
switch (this) {
case MaritalStatusTypeEnum.single:
return "U";
case MaritalStatusTypeEnum.married:
return "M";
case MaritalStatusTypeEnum.divorced:
return "D";
case MaritalStatusTypeEnum.widowed:
return "W";
}
}
String get type {
switch (this) {
case MaritalStatusTypeEnum.single:
return "Single";
case MaritalStatusTypeEnum.married:
return "Married";
case MaritalStatusTypeEnum.divorced:
return "Divorced";
case MaritalStatusTypeEnum.widowed:
return "Widowed";
}
}
String get typeAr {
switch (this) {
case MaritalStatusTypeEnum.single:
return "أعزب";
case MaritalStatusTypeEnum.married:
return "متزوج";
case MaritalStatusTypeEnum.divorced:
return "مطلق";
case MaritalStatusTypeEnum.widowed:
return "أرمل";
}
}
static MaritalStatusTypeEnum? fromValue(String? value) {
switch (value) {
case "U":
return MaritalStatusTypeEnum.single;
case "M":
return MaritalStatusTypeEnum.married;
case "D":
return MaritalStatusTypeEnum.divorced;
case "W":
return MaritalStatusTypeEnum.widowed;
default:
return null;
}
}
static MaritalStatusTypeEnum? fromType(String? type) {
switch (type) {
case "Single":
return MaritalStatusTypeEnum.single;
case "Married":
return MaritalStatusTypeEnum.married;
case "Divorced":
return MaritalStatusTypeEnum.divorced;
case "Widowed":
return MaritalStatusTypeEnum.widowed;
default:
return null;
}
}
}

@ -789,5 +789,9 @@ abstract class LocaleKeys {
static const oR = 'oR';
static const sendOTPWHATSAPP = 'sendOTPWHATSAPP';
static const sendOTPSMS = 'sendOTPSMS';
static const fullName = 'fullName';
static const married = 'married';
static const uae = 'uae';
static const malE = 'malE';
}

@ -229,29 +229,30 @@ class _RegisterNew extends State<RegisterNew> {
MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567',)));
// 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(1);
// }
// 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(1);
// }
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567')));
},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedBorderColor,

@ -0,0 +1,311 @@
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/context_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/generated/locale_keys.g.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/bottomsheet/generic_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
class RegisterNewStep2 extends StatefulWidget {
var nHICData;
var payload;
RegisterNewStep2(this.nHICData, this.payload, {Key? key}) : super(key: key);
@override
_RegisterNew createState() => _RegisterNew();
}
class _RegisterNew extends State<RegisterNewStep2> {
bool isFromDubai = true;
List<NationalityCountries> countriesList = [];
AppState? appState;
GenderTypeEnum? selectedGenderType;
MaritalStatusTypeEnum? selectedMaritalStatusType;
CountryEnum? selectedCountry;
@override
void initState() {
super.initState();
// isFromDubai = widget.payload.zipCode!.contains("971") || widget.payload.zipCode!.contains("+971");
loadCountriesList();
}
loadCountriesList() async {
appState = getIt.get<AppState>();
final String response = await DefaultAssetBundle.of(context).loadString('assets/json/countriesList.json');
final List<dynamic> data = json.decode(response);
countriesList = data.map((e) => NationalityCountries.fromJson(e)).toList();
}
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(onBackPressed: () {}, onLanguageChanged: (lang) {}, hideLogoAndLang: true,),
body: SingleChildScrollView(
reverse: false,
padding: EdgeInsets.only(left: 24.h, right: 24.h, top: 24.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Directionality(
textDirection: Directionality.of(context),
child: Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
padding: EdgeInsets.only(left: 16.h, right: 16.h),
child: Column(
children: [
TextInputWidget(
labelText: isFromDubai ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(),
hintText: isFromDubai ? "name" ?? "" : (widget.nHICData!.firstNameEn!.toUpperCase() + " " + widget.nHICData!.lastNameEn!.toUpperCase()),
controller: null,
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
keyboardType: TextInputType.text,
isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true,
leadingIcon: AppAssets.user_circle),
Divider(height: 1),
TextInputWidget(
labelText: LocaleKeys.nationalIdNumber.tr(),
hintText: isFromDubai ? "widget.payload.nationalID!" : (widget.nHICData!.idNumber ?? ""),
controller: null,
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: AppAssets.student_card),
Divider(height: 1),
isFromDubai
? DropdownWidget(
labelText: LocaleKeys.gender.tr(),
hintText: LocaleKeys.malE.tr(),
isEnable: true,
dropdownItems: GenderTypeEnum.values.map((e) => appState!.isArabic() ? e.typeAr : e.type).toList(),
selectedValue: appState!.isArabic() ? selectedGenderType!.typeAr : selectedGenderType?.type,
// selectionType: SelectionType.dropdown,
onChange: (val) {
if (val != null) {}
},
isBorderAllowed: false,
hasSelectionCustomIcon: true,
isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down,
// leadingIcon: 'assets/images/svg/user-full.svg',
).withVerticalPadding(8)
: TextInputWidget(
labelText: LocaleKeys.gender.tr(),
hintText: (widget.nHICData!.gender ?? ""),
controller: null,
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true,
leadingIcon: AppAssets.user_full,
onChange: (value) {}),
Divider(height: 1),
isFromDubai
? DropdownWidget(
labelText: LocaleKeys.maritalStatus.tr(),
hintText: LocaleKeys.married.tr(),
isEnable: true,
dropdownItems: MaritalStatusTypeEnum.values.map((e) => appState!.isArabic() ? e.typeAr : e.type).toList(),
selectedValue: appState!.isArabic() ? selectedMaritalStatusType!.typeAr : selectedMaritalStatusType?.type,
onChange: (val) {},
isBorderAllowed: false,
hasSelectionCustomIcon: true,
isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down,
// leadingIcon: 'assets/images/svg/smart-phone.svg',
).withVerticalPadding(8)
: TextInputWidget(
labelText: LocaleKeys.maritalStatus.tr(),
hintText: appState!.isArabic()
? (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.typeAr)
: (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.type),
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: AppAssets.smart_phone,
onChange: (value) {}),
Divider(height: 1),
isFromDubai
? DropdownWidget(
labelText: LocaleKeys.country.tr(),
hintText: LocaleKeys.uae.tr(),
isEnable: true,
dropdownItems: countriesList.map((e) => appState!.isArabic() ? e.nameN ?? "" : e.name ?? "").toList(),
selectedValue: appState!.isArabic() ? selectedCountry!.nameArabic ?? "" : selectedCountry?.name ?? "",
onChange: (val) {},
isBorderAllowed: false,
hasSelectionCustomIcon: true,
isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down,
// leadingIcon: 'assets/images/svg/globe.svg',
).withVerticalPadding(8)
: TextInputWidget(
labelText: LocaleKeys.nationality.tr(),
hintText: appState!.isArabic()
? (countriesList.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "")
: (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) {}),
Divider(height: 1),
TextInputWidget(
labelText: LocaleKeys.mobileNumber.tr(),
hintText: ("widget.payload.mobileNo" ?? ""),
controller: null,
isEnable: true,
prefix: null,
isAllowRadius: false,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
leadingIcon: AppAssets.call,
onChange: (value) {}),
Divider(height: 1),
TextInputWidget(
labelText: LocaleKeys.dob.tr(),
hintText: isFromDubai ? "widget.payload.dob!" : (widget.nHICData!.dateOfBirth ?? ""),
controller: null,
isEnable: true,
prefix: null,
isBorderAllowed: false,
isAllowLeadingIcon: true,
isReadOnly: true,
// selectionType: SelectionType.calendar,
// selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null,
// selectionCustomIcon: AppAssets.calendar,
// leadingIcon: AppAssets.birthday_cake,
onChange: (value) {}),
],
),
),
),
SizedBox(height: 50.h),
Row(
children: [
Expanded(
child: CustomButton(
text: LocaleKeys.cancel,
icon: AppAssets.cancel,
onPressed: () {
Navigator.of(context).pop();
},
// fontFamily: context.fontFamily,
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
iconColor: AppColors.primaryRedColor,
),
),
SizedBox(
width: 16,
),
Expanded(
child: CustomButton(
backgroundColor: AppColors.lightGreenColor,
borderColor: AppColors.lightGreenColor,
textColor: AppColors.textGreenColor,
text: LocaleKeys.confirm.tr(),
icon: AppAssets.confirm,
iconColor: AppColors.textGreenColor,
onPressed: () {
// if (isFromDubai) {
// if (name == null) {
// AppToast.showErrorToast(message: LocaleKeys.enterFullName);
// return;
// }
// if (!name!.contains(" ")) if (selectedGenderType == null) {
// AppToast.showErrorToast(message: TranslationBase.of(context).enterFullName);
// return;
// }
// if (selectedMaritalStatusType == null) {
// AppToast.showErrorToast(message: TranslationBase.of(context).chooseMaritalStatus);
// return;
// }
// if (selectedCountry == null) {
// AppToast.showErrorToast(message: TranslationBase.of(context).chooseCountry);
// return;
// }
// }
showModel(context: context);
},
),
)
],
),
],
),
),
);
}
void showModel({required BuildContext context}) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
isDismissible: false,
backgroundColor: Colors.transparent,
builder: (bottomSheetContext) => Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
child: SingleChildScrollView(
child: GenericBottomSheet(
textController: TextEditingController(),
isForEmail: true,
buttons: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: LocaleKeys.submit,
onPressed: () {
// if (emailAddress.text.isEmpty) {
// Utils.showErrorToast(TranslationBase.of(context).enterEmailAddress);
// return;
// } else {
// Navigator.of(context).pop();
// registerNow();
// }
},
backgroundColor: AppColors.bgGreenColor,
borderColor: AppColors.bgGreenColor,
textColor: AppColors.whiteColor),
),
],
),
),
),
);
}
}

@ -49,7 +49,8 @@ class _LandingPageState extends State<LandingPage> {
CustomButton(
text: LocaleKeys.loginOrRegister.tr(context: context),
onPressed: () async {
await authenticationViewModel.selectDeviceImei();
// await authenticationViewModel.selectDeviceImei();
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => LoginScreen()));
},
backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),

@ -35,6 +35,10 @@ class AppColors {
static const blackColor = textColor;
static const inputLabelTextColor = Color(0xff898A8D);
static const lightGreenColor = Color(0xFF0ccedde);
static const textGreenColor = Color(0xFF18C273);
//Chips
static const Color successColor = Color(0xff18C273);
static const Color errorColor = Color(0xFFED1C2B);

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/presentation/authentication/register_step2.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
@ -208,6 +209,8 @@ class _OTPVerificationPageState extends State<OTPVerificationPage> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Verifying OTP: $otp')),
);
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => RegisterNewStep2(null, {"nationalID": "12345678654321"})));
}
/// Auto fill OTP into text fields

@ -81,6 +81,7 @@ flutter:
- assets/
- assets/fonts/
- assets/langs/
- assets/json/
- assets/images/
- assets/images/svg/
- assets/images/png/

Loading…
Cancel
Save