From 0ac06092c2496f0e0305b5f4cd0bd88079d276d6 Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Tue, 15 Jul 2025 17:13:19 +0300 Subject: [PATCH] caleder changes --- lib/core/service/client/base_app_client.dart | 2 +- .../Authentication/register_user_requet.dart | 242 +++++-- .../otp/otp_validation_bootmsheet_widget.dart | 3 +- .../health_calculator/carbs/carbs.dart | 676 ++++-------------- lib/pages/login/register_new.dart | 243 +++---- lib/pages/login/register_new_step_2.dart | 241 +++++-- lib/pages/login/welcome.dart | 9 +- .../authentication/auth_provider.dart | 50 +- lib/uitl/utils.dart | 16 +- pubspec.yaml | 2 + 10 files changed, 676 insertions(+), 808 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 532a4670..53071bc8 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -206,7 +206,7 @@ class BaseAppClient { final jsonBody = json.encode(body); debugPrint(jsonBody); // } - + // return; if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; diff --git a/lib/models/Authentication/register_user_requet.dart b/lib/models/Authentication/register_user_requet.dart index e436d6ef..bb0e967e 100644 --- a/lib/models/Authentication/register_user_requet.dart +++ b/lib/models/Authentication/register_user_requet.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + class RegisterUserRequest { Patientobject? patientobject; String? patientIdentificationID; @@ -39,6 +41,11 @@ class RegisterUserRequest { // this.occupationID }); + + factory RegisterUserRequest.fromRawJson(String str) => RegisterUserRequest.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + RegisterUserRequest.fromJson(Map json) { patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null; patientIdentificationID = json['PatientIdentificationID']; @@ -90,57 +97,59 @@ class Patientobject { bool? tempValue; int? patientIdentificationType; String? patientIdentificationNo; - dynamic mobileNumber; - int? patientOutSA; - String? firstName; - String? middleName; - String? lastName; + int? mobileNumber; + int? patientOutSa; String? firstNameN; + String? firstName; String? middleNameN; + String? middleName; String? lastNameN; - dynamic strDateofBirth; + String? lastName; + String? strDateofBirth; String? dateofBirth; int? gender; - String? nationalityID; - String? eHealthIDField; + String? nationalityId; + String? eHealthIdField; String? dateofBirthN; String? emailAddress; - String? sourceType; - String? preferredLanguage; + int? sourceType; + int? preferredLanguage; String? marital; - // String? occupationID; - Patientobject( - {this.tempValue, - this.patientIdentificationType, - this.patientIdentificationNo, - this.mobileNumber, - this.patientOutSA, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.strDateofBirth, - this.dateofBirth, - this.gender, - this.nationalityID, - this.eHealthIDField, - this.dateofBirthN, - this.emailAddress, - this.sourceType, - this.preferredLanguage, - this.marital, - // this.occupationID - }); + Patientobject({ + this.tempValue, + this.patientIdentificationType, + this.patientIdentificationNo, + this.mobileNumber, + this.patientOutSa, + this.firstNameN, + this.firstName, + this.middleNameN, + this.middleName, + this.lastNameN, + this.lastName, + this.strDateofBirth, + this.dateofBirth, + this.gender, + this.nationalityId, + this.eHealthIdField, + this.dateofBirthN, + this.emailAddress, + this.sourceType, + this.preferredLanguage, + this.marital, + }); + + factory Patientobject.fromRawJson(String str) => Patientobject.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); Patientobject.fromJson(Map json) { tempValue = json['TempValue']; patientIdentificationType = json['PatientIdentificationType']; patientIdentificationNo = json['PatientIdentificationNo']; mobileNumber = json['MobileNumber']; - patientOutSA = json['PatientOutSA']; + patientOutSa = json['PatientOutSA']; firstName = json['FirstName']; middleName = json['MiddleName']; lastName = json['LastName']; @@ -150,8 +159,8 @@ class Patientobject { strDateofBirth = json['StrDateofBirth']; dateofBirth = json['DateofBirth']; gender = json['Gender']; - nationalityID = json['NationalityID']; - eHealthIDField = json['eHealthIDField']; + nationalityId = json['NationalityID']; + eHealthIdField = json['eHealthIDField']; dateofBirthN = json['DateofBirthN']; emailAddress = json['EmailAddress']; sourceType = json['SourceType']; @@ -167,7 +176,7 @@ class Patientobject { data['PatientIdentificationType'] = this.patientIdentificationType; data['PatientIdentificationNo'] = this.patientIdentificationNo; data['MobileNumber'] = this.mobileNumber; - data['PatientOutSA'] = this.patientOutSA; + data['PatientOutSA'] = this.patientOutSa; data['FirstName'] = this.firstName; data['MiddleName'] = this.middleName; data['LastName'] = this.lastName; @@ -177,8 +186,8 @@ class Patientobject { data['StrDateofBirth'] = this.strDateofBirth; data['DateofBirth'] = this.dateofBirth; data['Gender'] = this.gender; - data['NationalityID'] = this.nationalityID; - data['eHealthIDField'] = this.eHealthIDField; + data['NationalityID'] = this.nationalityId; + data['eHealthIDField'] = this.eHealthIdField; data['DateofBirthN'] = this.dateofBirthN; data['EmailAddress'] = this.emailAddress; data['SourceType'] = this.sourceType; @@ -187,4 +196,155 @@ class Patientobject { // data['OccupationID'] = this.occupationID; return data; } + + // factory Patientobject.fromJson(Map json) => Patientobject( + // tempValue: json["TempValue"], + // patientIdentificationType: json["PatientIdentificationType"], + // patientIdentificationNo: json["PatientIdentificationNo"], + // mobileNumber: json["MobileNumber"], + // patientOutSa: json["PatientOutSA"], + // firstNameN: json["FirstNameN"], + // firstName: json["FirstName"], + // middleNameN: json["MiddleNameN"], + // middleName: json["MiddleName"], + // lastNameN: json["LastNameN"], + // lastName: json["LastName"], + // strDateofBirth: json["StrDateofBirth"], + // dateofBirth: json["DateofBirth"], + // gender: json["Gender"], + // nationalityId: json["NationalityID"], + // eHealthIdField: json["eHealthIDField"], + // dateofBirthN: json["DateofBirthN"], + // emailAddress: json["EmailAddress"], + // sourceType: json["SourceType"], + // preferredLanguage: json["PreferredLanguage"], + // marital: json["Marital"], + // ); + // + // Map toJson() => { + // "TempValue": tempValue, + // "PatientIdentificationType": patientIdentificationType, + // "PatientIdentificationNo": patientIdentificationNo, + // "MobileNumber": mobileNumber, + // "PatientOutSA": patientOutSa, + // "FirstNameN": firstNameN, + // "FirstName": firstName, + // "MiddleNameN": middleNameN, + // "MiddleName": middleName, + // "LastNameN": lastNameN, + // "LastName": lastName, + // "StrDateofBirth": strDateofBirth, + // "DateofBirth": dateofBirth, + // "Gender": gender, + // "NationalityID": nationalityId, + // "eHealthIDField": eHealthIdField, + // "DateofBirthN": dateofBirthN, + // "EmailAddress": emailAddress, + // "SourceType": sourceType, + // "PreferredLanguage": preferredLanguage, + // "Marital": marital, + // }; } +// +// class Patientobject { +// bool? tempValue; +// int? patientIdentificationType; +// String? patientIdentificationNo; +// dynamic mobileNumber; +// int? patientOutSA; +// String? firstName; +// String? middleName; +// String? lastName; +// String? firstNameN; +// String? middleNameN; +// String? lastNameN; +// dynamic strDateofBirth; +// String? dateofBirth; +// int? gender; +// String? nationalityID; +// String? eHealthIDField; +// String? dateofBirthN; +// String? emailAddress; +// String? sourceType; +// String? preferredLanguage; +// String? marital; +// // String? occupationID; +// +// Patientobject( +// {this.tempValue, +// this.patientIdentificationType, +// this.patientIdentificationNo, +// this.mobileNumber, +// this.patientOutSA, +// this.firstName, +// this.middleName, +// this.lastName, +// this.firstNameN, +// this.middleNameN, +// this.lastNameN, +// this.strDateofBirth, +// this.dateofBirth, +// this.gender, +// this.nationalityID, +// this.eHealthIDField, +// this.dateofBirthN, +// this.emailAddress, +// this.sourceType, +// this.preferredLanguage, +// this.marital, +// // this.occupationID +// }); +// +// Patientobject.fromJson(Map json) { +// tempValue = json['TempValue']; +// patientIdentificationType = json['PatientIdentificationType']; +// patientIdentificationNo = json['PatientIdentificationNo']; +// mobileNumber = json['MobileNumber']; +// patientOutSA = json['PatientOutSA']; +// firstName = json['FirstName']; +// middleName = json['MiddleName']; +// lastName = json['LastName']; +// firstNameN = json['FirstNameN']; +// middleNameN = json['MiddleNameN']; +// lastNameN = json['LastNameN']; +// strDateofBirth = json['StrDateofBirth']; +// dateofBirth = json['DateofBirth']; +// gender = json['Gender']; +// nationalityID = json['NationalityID']; +// eHealthIDField = json['eHealthIDField']; +// dateofBirthN = json['DateofBirthN']; +// emailAddress = json['EmailAddress']; +// sourceType = json['SourceType']; +// +// preferredLanguage = json['PreferredLanguage']; +// marital = json['Marital']; +// // occupationID = json['OccupationID'] ?? ""; +// } +// +// Map toJson() { +// final Map data = new Map(); +// data['TempValue'] = this.tempValue; +// data['PatientIdentificationType'] = this.patientIdentificationType; +// data['PatientIdentificationNo'] = this.patientIdentificationNo; +// data['MobileNumber'] = this.mobileNumber; +// data['PatientOutSA'] = this.patientOutSA; +// data['FirstName'] = this.firstName; +// data['MiddleName'] = this.middleName; +// data['LastName'] = this.lastName; +// data['FirstNameN'] = this.firstNameN; +// data['MiddleNameN'] = this.middleNameN; +// data['LastNameN'] = this.lastNameN; +// data['StrDateofBirth'] = this.strDateofBirth; +// data['DateofBirth'] = this.dateofBirth; +// data['Gender'] = this.gender; +// data['NationalityID'] = this.nationalityID; +// data['eHealthIDField'] = this.eHealthIDField; +// data['DateofBirthN'] = this.dateofBirthN; +// data['EmailAddress'] = this.emailAddress; +// data['SourceType'] = this.sourceType; +// data['PreferredLanguage'] = this.preferredLanguage; +// data['Marital'] = this.marital; +// // data['OccupationID'] = this.occupationID; +// return data; +// } +// } diff --git a/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart b/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart index 8a0c6660..a263b51c 100644 --- a/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart +++ b/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart @@ -68,6 +68,7 @@ class _GenericBottomSheetState extends State { widget.isForEmail ? TranslationBase.of(context).email : TranslationBase.of(context).phoneNumber, widget.isForEmail ? "demo@gmail.com" : "5xxxxxxxx", widget.textController!, + keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number, onChange: (value) { widget.textController!.text = value!; }, @@ -76,7 +77,7 @@ class _GenericBottomSheetState extends State { hasSelection: false, isBorderAllowed: false, isAllowLeadingIcon: true, - leadingIcon: widget.isForEmail ? "assets/images/svg/email.svg" :"assets/images/svg/smart-phone.svg", + leadingIcon: widget.isForEmail ? "assets/images/svg/email.svg" : "assets/images/svg/smart-phone.svg", ), ), ], diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index ce2acb69..cf8961e4 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -10,6 +10,7 @@ import 'package:hmg_patient_app/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; +import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart'; import 'carbs_result_page.dart'; @@ -322,10 +323,13 @@ Widget inputWidget( String? leadingIcon, bool removePadding = false, bool isAllowRadius = true, - bool isReadOnly = false, + bool isReadOnly = false, + TextInputType keyboardType = TextInputType.number, List? dropdownItems, String? selectedValue, SelectionType? selectionType, + Function(bool)? onCalendarTypeChanged, + String lang = 'en', }) { return Builder( builder: (context) { @@ -378,116 +382,155 @@ Widget inputWidget( ), hasSelection ? GestureDetector( - onTap: isEnable && !isReadOnly - ? () async { - if (selectionType == SelectionType.dropdown) { - final renderBox = context.findRenderObject() as RenderBox; - final offset = renderBox.localToGlobal(Offset.zero); - - final selected = await showMenu( - context: context, - position: RelativeRect.fromLTRB( - offset.dx, - offset.dy + renderBox.size.height, - offset.dx + 1, - 0, - ), - items: dropdownItems - ?.map( - (e) => PopupMenuItem( - value: e, - child: Text(e), - ), - ) - .toList() ?? - [], - ); - - if (selected != null && onChange != null) { - onChange(selected); - } - } else if (selectionType == SelectionType.calendar) { - final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100)); - if (picked != null && onChange != null) { - onChange(picked.toIso8601String()); - } - } - } - : null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - (selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue, - textAlign: isRtl ? TextAlign.right : TextAlign.left, - textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - fontFamily: context.fontFamily, - color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), - letterSpacing: -0.2, - ), + onTap: isEnable && !isReadOnly + ? () async { + if (selectionType == SelectionType.dropdown) { + final renderBox = context.findRenderObject() as RenderBox; + final offset = renderBox.localToGlobal(Offset.zero); + final selected = await showMenu( + context: context, + position: RelativeRect.fromLTRB( + offset.dx, + offset.dy + renderBox.size.height, + offset.dx + renderBox.size.width, + 0, + ), + items: dropdownItems + ?.map( + (e) => + PopupMenuItem( + value: e, + child: Text(e), ), - ), - if (hasSelectionCustomIcon && selectionCustomIcon != null) - SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) - else - const Icon(Icons.keyboard_arrow_down_outlined), - ], + ) + .toList() ?? + [], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), ), - ) - : TextField( - enabled: isEnable, - scrollPadding: EdgeInsets.zero, - keyboardType: TextInputType.number, - controller: _controller, - readOnly: isReadOnly, - textAlignVertical: TextAlignVertical.top, - textAlign: isRtl ? TextAlign.right : TextAlign.left, - textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, - onChanged: onChange, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontFamily: context.fontFamily, - fontWeight: FontWeight.w500, - color: const Color(0xff2E3039), - letterSpacing: -0.2, + ); + + if (selected != null && onChange != null) { + onChange(selected); + } + } else if (selectionType == SelectionType.calendar) { + bool isGregorian = true; + // final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100)); + final picked = await showHijriGregBottomSheet( + context, + switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), + fontFamily: context.fontFamily, + language: lang, + initialDate: DateTime.now(), + okWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/confirm.svg", + width: 24, + height: 24, + ), ), - decoration: InputDecoration( - isDense: true, - hintText: _hintText, - hintStyle: TextStyle( + cancelWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), + width: 24, + height: 24, + ), + ), + onCalendarTypeChanged: (bool value) { + isGregorian = value; + }, + ); + if (picked != null && onChange != null) { + print(picked.toIso8601String()); + if (onCalendarTypeChanged != null) { + print(isGregorian.toString()); + onCalendarTypeChanged.call(isGregorian); + } + onChange(picked.toIso8601String()); + } + } + } + : null, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + (selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue, + textAlign: isRtl ? TextAlign.right : TextAlign.left, + textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, + style: TextStyle( fontSize: 14, - height: 21 / 16, - fontFamily: context.fontFamily, + height: 21 / 14, fontWeight: FontWeight.w500, - color: const Color(0xff898A8D), + fontFamily: context.fontFamily, + color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), letterSpacing: -0.2, ), - prefixIconConstraints: const BoxConstraints(minWidth: 45), - prefixIcon: prefix == null - ? null - : Text( - "+" + prefix, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontFamily: context.fontFamily, - fontWeight: FontWeight.w500, - color: const Color(0xff2E303A), - letterSpacing: -0.2, - ), - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, ), ), + if (hasSelectionCustomIcon && selectionCustomIcon != null) + SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) + else + const Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ) + : TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: keyboardType, + controller: _controller, + readOnly: isReadOnly, + textAlignVertical: TextAlignVertical.top, + textAlign: isRtl ? TextAlign.right : TextAlign.left, + textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, + onChanged: onChange, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontFamily: context.fontFamily, + fontWeight: FontWeight.w500, + color: const Color(0xff2E3039), + letterSpacing: -0.2, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 16, + fontFamily: context.fontFamily, + fontWeight: FontWeight.w500, + color: const Color(0xff898A8D), + letterSpacing: -0.2, + ), + prefixIconConstraints: const BoxConstraints(minWidth: 45), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontFamily: context.fontFamily, + fontWeight: FontWeight.w500, + color: const Color(0xff2E303A), + letterSpacing: -0.2, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), ], ), ), @@ -497,437 +540,8 @@ Widget inputWidget( ); }, ); - // return Builder( - // builder: (context) { - // return Directionality( - // textDirection:Directionality.of(context), - // child: Container( - // padding: removePadding ? const EdgeInsets.only(top: 16, bottom: 16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 15), - // alignment: Alignment.center, - // decoration: BoxDecoration( - // borderRadius: isAllowRadius ? BorderRadius.circular(15) : null, - // color: Colors.white, - // border: isBorderAllowed ? Border.all(color: const Color(0xffefefef), width: 1) : null, - // ), - // child: Row( - // children: [ - // if (isAllowLeadingIcon && leadingIcon != null) - // Container( - // height: 40, - // width: 40, - // margin: const EdgeInsets.only(right: 10), - // padding: isLeadingCountry ? null : const EdgeInsets.all(5), - // decoration: const BoxDecoration( - // color: Color(0xFFEFEFF0), - // borderRadius: BorderRadius.all(Radius.circular(10)), - // ), - // child: SvgPicture.asset(leadingIcon, width: 24, height: 24), - // ), - // Expanded( - // child: Column( - // mainAxisSize: MainAxisSize.min, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text( - // _labelText, - // style: TextStyle( - // fontSize: 12, - // fontWeight: FontWeight.w500, - // color: const Color(0xff898A8D), - // fontFamily: context.fontFamily, - // letterSpacing: -0.2, - // height: 18 / 12, - // ), - // ), - // hasSelection - // ? GestureDetector( - // onTap: isEnable - // ? () async { - // if (selectionType == SelectionType.dropdown) { - // final renderBox = context.findRenderObject() as RenderBox; - // final offset = renderBox.localToGlobal(Offset.zero); - // - // final selected = await showMenu( - // context: context, - // position: RelativeRect.fromLTRB( - // offset.dx, - // offset.dy + renderBox.size.height, - // offset.dx + 1, - // 0, - // ), - // items: dropdownItems?.map((e) { - // return PopupMenuItem( - // value: e, - // child: Text(e), - // ); - // }).toList() ?? - // [], - // ); - // - // if (selected != null && onChange != null) { - // onChange(selected); - // } - // } else if (selectionType == SelectionType.calendar) { - // final picked = await showDatePicker( - // context: context, - // - // initialDate: DateTime.now(), - // firstDate: DateTime(1900), - // lastDate: DateTime(2100), - // ); - // - // if (picked != null && onChange != null) { - // onChange(picked.toIso8601String()); - // } - // } - // } - // : null, - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Expanded( - // child: Text( - // selectedValue ?? _hintText, - // style: TextStyle( - // fontSize: 14, - // height: 21 / 14, - // fontWeight: FontWeight.w500, - // fontFamily: context.fontFamily, - // color: selectedValue != null ? const Color(0xff2E3039) : const Color(0xffB0B0B0), - // letterSpacing: -0.2, - // ), - // ), - // ), - // if (hasSelectionCustomIcon && selectionCustomIcon != null) - // SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) - // else - // const Icon(Icons.keyboard_arrow_down_outlined), - // ], - // ), - // ) - // : TextField( - // enabled: isEnable, - // scrollPadding: EdgeInsets.zero, - // keyboardType: TextInputType.number, - // controller: _controller, - // textAlignVertical: TextAlignVertical.top, - // onChanged: onChange, - // style: TextStyle( - // fontSize: 14, - // height: 21 / 14, - // fontFamily: context.fontFamily, - // fontWeight: FontWeight.w500, - // color: const Color(0xff2E3039), - // letterSpacing: -0.2, - // ), - // decoration: InputDecoration( - // isDense: true, - // hintText: _hintText, - // hintStyle: TextStyle( - // fontSize: 14, - // height: 21 / 16, - // fontFamily: context.fontFamily, - // fontWeight: FontWeight.w500, - // color: const Color(0xff898A8D), - // letterSpacing: -0.2, - // ), - // prefixIconConstraints: const BoxConstraints(minWidth: 45), - // prefixIcon: prefix == null - // ? null - // : Text( - // "+" + prefix, - // style: TextStyle( - // fontSize: 14, - // height: 21 / 14, - // fontFamily: context.fontFamily, - // fontWeight: FontWeight.w500, - // color: const Color(0xff2E303A), - // letterSpacing: -0.2, - // ), - // ), - // contentPadding: EdgeInsets.zero, - // border: InputBorder.none, - // focusedBorder: InputBorder.none, - // enabledBorder: InputBorder.none, - // ), - // ), - // ], - // ), - // ), - // ], - // ), - // ), - // ); - // }, - // ); } -// Widget inputWidget( -// String _labelText, -// String _hintText, -// TextEditingController? _controller, { -// Function(String?)? onChange, -// String? prefix, -// bool isEnable = true, -// bool hasSelection = false, -// bool hasDropDown = false, -// bool hasSelectionCustomIcon = false, -// String? selectionCustomIcon, -// bool isBorderAllowed = true, -// bool isAllowLeadingIcon = false, -// bool isLeadingCountry = false, -// String? leadingIcon, -// bool removePadding = false, -// bool isAllowRadius = true, -// List? dropdownItems, // <-- NEW -// String? selectedValue, // <-- NEW -// }) { -// return Container( -// padding: removePadding -// ? EdgeInsets.only(top: 16, bottom: 16) -// : EdgeInsets.symmetric(horizontal: 16, vertical: 15), -// alignment: Alignment.center, -// decoration: BoxDecoration( -// borderRadius: isAllowRadius ? BorderRadius.circular(15) : null, -// color: Colors.white, -// border: isBorderAllowed ? Border.all(color: Color(0xffefefef), width: 1) : null, -// ), -// child: Row( -// children: [ -// if (isAllowLeadingIcon && leadingIcon != null) -// Container( -// height: 40, -// width: 40, -// margin: EdgeInsets.only(right: 10), -// padding: isLeadingCountry ? null : EdgeInsets.all(5), -// decoration: BoxDecoration( -// color: Color(0xFFEFEFF0), -// borderRadius: BorderRadius.all(Radius.circular(10)), -// ), -// child: SvgPicture.asset(leadingIcon, width: 24, height: 24), -// ), -// Expanded( -// child: Column( -// mainAxisSize: MainAxisSize.min, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Text( -// _labelText, -// style: TextStyle( -// fontSize: 12, -// fontWeight: FontWeight.w500, -// color: Color(0xff898A8D), -// fontFamily: 'poppins', -// letterSpacing: -0.2, -// height: 18 / 12, -// ), -// ), -// hasDropDown -// ? DropdownButton( -// isExpanded: true, -// value: selectedValue, -// hint: Text(_hintText, -// style: TextStyle( -// fontSize: 14, -// height: 21 / 16, -// fontWeight: FontWeight.w500, -// color: Color(0xff2E3039), -// letterSpacing: -0.2, -// )), -// icon: SizedBox.shrink(), // hide default arrow -// underline: SizedBox.shrink(), // remove underline -// onChanged: isEnable ? onChange : null, -// items: dropdownItems?.map((String value) { -// return DropdownMenuItem( -// value: value, -// child: Text( -// value, -// style: TextStyle( -// fontSize: 14, -// height: 21 / 14, -// fontWeight: FontWeight.w500, -// color: Color(0xff2E3039), -// letterSpacing: -0.2, -// ), -// ), -// ); -// }).toList(), -// ) -// : TextField( -// enabled: isEnable, -// scrollPadding: EdgeInsets.zero, -// keyboardType: TextInputType.number, -// controller: _controller, -// textAlignVertical: TextAlignVertical.top, -// onChanged: onChange, -// style: TextStyle( -// fontSize: 14, -// height: 21 / 14, -// fontWeight: FontWeight.w500, -// color: Color(0xff2E3039), -// letterSpacing: -0.2, -// ), -// decoration: InputDecoration( -// isDense: true, -// hintText: _hintText, -// hintStyle: TextStyle( -// fontSize: 14, -// height: 21 / 16, -// fontWeight: FontWeight.w500, -// color: Color(0xff2E3039), -// letterSpacing: -0.2, -// ), -// prefixIconConstraints: BoxConstraints(minWidth: 45), -// prefixIcon: prefix == null -// ? null -// : Text( -// "+" + prefix, -// style: TextStyle( -// fontSize: 14, -// height: 21 / 14, -// fontWeight: FontWeight.w500, -// color: Color(0xff2E303A), -// letterSpacing: -0.2, -// ), -// ), -// contentPadding: EdgeInsets.zero, -// border: InputBorder.none, -// focusedBorder: InputBorder.none, -// enabledBorder: InputBorder.none, -// ), -// ), -// ], -// ), -// ), -// if (hasSelection && !hasSelectionCustomIcon) -// Icon(Icons.keyboard_arrow_down_outlined), -// if (hasSelection && hasSelectionCustomIcon) -// Container( -// height: 40, -// width: 40, -// margin: EdgeInsets.only(left: 10), -// padding: EdgeInsets.all(5), -// decoration: BoxDecoration( -// borderRadius: BorderRadius.all(Radius.circular(10)), -// ), -// child: SvgPicture.asset(selectionCustomIcon!, width: 24, height: 24), -// ), -// ], -// ), -// ); -// } - -// Widget inputWidget( -// String _labelText, -// String _hintText, -// TextEditingController? _controller, { -// Function? onChange(String? value)?, -// String? prefix, -// bool isEnable = true, -// bool hasSelection = false, -// bool hasSelectionCustomIcon = false, -// String? selectionCustomIcon, -// bool isBorderAllowed = true, -// bool isAllowLeadingIcon = false, -// bool isLeadingCountry = false, -// String? leadingIcon, -// bool removePadding = false, -// bool isAllowRadius = true, -// }) { -// return Container( -// padding: removePadding ? EdgeInsets.only(top: 16, bottom: 16) : EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), -// alignment: Alignment.center, -// decoration: BoxDecoration( -// borderRadius: isAllowRadius ? BorderRadius.circular(15) : null, -// color: Colors.white, -// border: isBorderAllowed ? Border.all(color: Color(0xffefefef), width: 1) : null, -// ), -// child: InkWell( -// onTap: hasSelection ? () {} : null, -// child: Row( -// children: [ -// if (isAllowLeadingIcon && leadingIcon != null) -// Container( -// height: 40, -// width: 40, -// margin: EdgeInsets.only(right: 10), -// padding: isLeadingCountry ? null : EdgeInsets.all(5), -// decoration: BoxDecoration( -// color: Color(0xFFEFEFF0), -// borderRadius: BorderRadius.all(Radius.circular(10)), -// ), -// child: SvgPicture.asset(leadingIcon, width: 24, height: 24), -// ), -// Expanded( -// child: Column( -// mainAxisSize: MainAxisSize.min, -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Text( -// _labelText, -// style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff898A8D), fontFamily: 'poppins', letterSpacing: -0.2, height: 18 / 12), -// ), -// // if(prefix !=null) Row( -// // children: [ -// // Text( -// // "+" + prefix, -// // style: TextStyle( -// // fontSize: 14, -// // height: 21 / 14, -// // fontWeight: FontWeight.w500, -// // color: Color(0xff2E303A), -// // letterSpacing: -0.56, -// // ), -// // ), -// // ], -// // ), -// TextField( -// enabled: isEnable, -// scrollPadding: EdgeInsets.zero, -// keyboardType: TextInputType.number, -// controller: _controller, -// textAlignVertical: TextAlignVertical.top, -// onChanged: onChange, -// style: TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w500, color: Color(0xff2E3039), letterSpacing: -0.2), -// decoration: InputDecoration( -// isDense: true, -// hintText: _hintText, -// hintStyle: TextStyle(fontSize: 14, height: 21 / 16, fontWeight: FontWeight.w500, color: Color(0xff2E3039), letterSpacing: -0.2), -// prefixIconConstraints: BoxConstraints(minWidth: 45), -// prefixIcon: prefix == null -// ? null -// : Text( -// "+" + prefix, -// style: TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w500, color: Color(0xff2E303A), letterSpacing: -0.2), -// ), -// contentPadding: EdgeInsets.zero, -// border: InputBorder.none, -// focusedBorder: InputBorder.none, -// enabledBorder: InputBorder.none, -// ), -// ), -// ], -// ), -// ), -// if (hasSelection && !hasSelectionCustomIcon) Icon(Icons.keyboard_arrow_down_outlined), -// if (hasSelection && hasSelectionCustomIcon) -// Container( -// height: 40, -// width: 40, -// margin: EdgeInsets.only(left: 10), -// padding: EdgeInsets.all(5), -// decoration: BoxDecoration( -// borderRadius: BorderRadius.all(Radius.circular(10)), -// ), -// child: SvgPicture.asset(selectionCustomIcon!, width: 24, height: 24), -// ), -// ], -// ), -// ), -// ); -// } - extension BorderedContainer on Widget { Widget get withBorderedContainer => Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), diff --git a/lib/pages/login/register_new.dart b/lib/pages/login/register_new.dart index bb527730..c9f1fdb7 100644 --- a/lib/pages/login/register_new.dart +++ b/lib/pages/login/register_new.dart @@ -1,4 +1,5 @@ import 'package:flutter/gestures.dart'; +import 'package:hmg_patient_app/config/config.dart'; import 'package:hmg_patient_app/config/shared_pref_kay.dart'; import 'package:hmg_patient_app/config/size_config.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; @@ -47,11 +48,13 @@ class _RegisterNew extends State { OTPType? otpType; bool isTermsAccepted = false; DateTime? selectedDOB; + CheckUserStatusResponse? nHICData; final int loginType = LoginType.loginType; late String mobileNo; String countryCode = '966'; var isHijri; + final util = Utils(); bool isButtonDisabled = true; final authService = new AuthProvider(); @@ -60,8 +63,9 @@ class _RegisterNew extends State { late bool isLoading; int _currentIndex = 0; String? LoginTokenID; - bool isDubai =false; + bool isDubai = false; final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); + @override void initState() { super.initState(); @@ -95,121 +99,19 @@ class _RegisterNew extends State { dropDownIndexChange: (value) { Utils.changeAppLanguage(context: context); }, - // body: SingleChildScrollView( - // child: Container( - // height: SizeConfig.realScreenHeight! * .9, - // width: SizeConfig.realScreenWidth, - // child: Column(children: [ - // Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 20, right: 20, top: 12), - // child: Row( - // children: [ - // Expanded( - // child: showProgress( - // title: TranslationBase.of(context).enterDetails, - // status: _currentIndex == 0 - // ? TranslationBase.of(context).inPrgress - // : _currentIndex > 0 - // ? TranslationBase.of(context).completed - // : TranslationBase.of(context).locked, - // color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green, - // ), - // ), - // Expanded( - // child: showProgress( - // title: TranslationBase.of(context).patientInfo, - // status: _currentIndex == 1 - // ? TranslationBase.of(context).inPrgress - // : _currentIndex > 1 - // ? TranslationBase.of(context).completed - // : TranslationBase.of(context).locked, - // color: _currentIndex == 1 - // ? CustomColors.orange - // : _currentIndex > 1 - // ? CustomColors.green - // : CustomColors.grey2, - // ), - // ), - // showProgress( - // title: TranslationBase.of(context).otherInfo, - // status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked, - // color: _currentIndex == 2 - // ? CustomColors.orange - // : _currentIndex > 3 - // ? CustomColors.green - // : CustomColors.grey2, - // isNeedBorder: false, - // ), - // ], - // ), - // ), - // Expanded( - // child: PageView( - // physics: NeverScrollableScrollPhysics(), - // controller: _controller, - // onPageChanged: (index) { - // setState(() { - // _currentIndex = index; - // }); - // }, - // scrollDirection: Axis.horizontal, - // children: [ - // Register( - // changePageViewIndex: changePageViewIndex, - // ), - // - // RegisterInfo( - // changePageViewIndex: changePageViewIndex, - // ), - // RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2), - // // NewEReferralStepOnePage( - // // changePageViewIndex: changePageViewIndex, - // // createEReferralRequestModel: createEReferralRequestModel, - // // ), - // // NewEReferralStepTowPage( - // // changePageViewIndex: changePageViewIndex, - // // createEReferralRequestModel: createEReferralRequestModel, - // // ), - // // NewEReferralStepThreePage( - // // changePageViewIndex: changePageViewIndex, - // // createEReferralRequestModel: createEReferralRequestModel, - // // ), - // ], - // ), - // ), - // ]), - // ), - // ), - body: SafeArea( child: SingleChildScrollView( reverse: false, - padding: EdgeInsets.only( - left: 24, - right: 24, - // bottom: MediaQuery.of(context).viewInsets.bottom , - ), + // physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(left: 24, right: 24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Utils.showLottie( - context: context, - assetPath: 'assets/animations/lottie/register.json', - width: 238, - repeat: true, - ), + Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/register.json', width: context.getLottieScaledWidth(238), fit: BoxFit.cover, repeat: true), SizedBox(height: 8), Text( TranslationBase.of(context).prepareToElevate, - style: TextStyle( - fontSize: 32, - fontFamily: context.fontFamily, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.4, - height: 47 / 32, - ), + style: TextStyle(fontSize: 32, fontFamily: context.fontFamily, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 47 / 35), ), SizedBox(height: 24), Directionality( @@ -269,11 +171,19 @@ class _RegisterNew extends State { selectionType: SelectionType.calendar, selectedValue: selectedDOB != null ? Utils.formatDateToDisplay(selectedDOB.toString()) : null, selectionCustomIcon: "assets/images/svg/calendar.svg", + lang: context.selectedLanguage, leadingIcon: "assets/images/svg/birthday-cake.svg", onChange: (value) { print("=========== " + value!); selectedDOB = DateTime.parse(value); - setState(() {}); + }, onCalendarTypeChanged: (bool value) { + if (value) { + print("gregorian"); + isHijri = 0; // Hijri + } else { + print("hijri"); + isHijri = 1; // Gregorian + } }), ], ), @@ -306,11 +216,7 @@ class _RegisterNew extends State { Expanded( child: Text( TranslationBase.of(context).iAcceptTermsConditions, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: Color(0xFF2E3039), - ), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xFF2E3039)), ), ), ], @@ -519,8 +425,10 @@ class _RegisterNew extends State { } else { print("OTP sent successfully to ${phoneController.text} using Whatsapp"); } + mobileNo = phoneController.text; startRegistration(value); + // Navigator.of(context).push(FadePage(page: RegisterNewStep2())); } @@ -535,7 +443,8 @@ class _RegisterNew extends State { request.patientID = 0; request.isRegister = true; request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); - request.isHijri = isHijri; + request.isHijri = isHijri ?? 0; + // request.tokenID = LoginTokenID; this.checkPatientForRegisteration(registrationData: request, type: type); // } } @@ -579,22 +488,22 @@ class _RegisterNew extends State { cancelFunction: () {}) .showAlertDialog(context); } else { - final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); - nRequest['forRegister'] = true; - nRequest['isRegister'] = true; - nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString(); - request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); - nRequest['isHijri'] = isHijri; - sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); - sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']); - if (request.patientOutSA == 0) { - this.chekUserData(response['LogInTokenID'], type); // ظ ; - } else { - //Dubai registration page should be navigate from here.. + final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); + nRequest['forRegister'] = true; + nRequest['isRegister'] = true; + nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString(); + request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); + nRequest['isHijri'] = isHijri; + sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); + sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']); + if (request.patientOutSA == 0) { + this.chekUserData(response['LogInTokenID'], type); // ظ ; + } else { + //Dubai registration page should be navigate from here.. - // Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai: true))); + // Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai: true))); + } } - } } else { // if (response['ErrorCode'] == '-986') { //AppToast.showErrorToast(message: response); @@ -620,57 +529,62 @@ class _RegisterNew extends State { // IsHijri: Number(this.dateOption) // } - GifLoaderDialogUtils.showMyDialog(context); var request = CheckUserStatusRequest(); request.patientIdentificationID = nationalIDorFile.text; - request.dOB = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); + request.dOB = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); request.isHijri = isHijri; request.patientOutSA = countryCode == '966' ? 0 : 1; + this.authService.checkUserStatus(request).then((result) { GifLoaderDialogUtils.hideDialog(context); - if (result is Map) - { - result = CheckUserStatusResponse.fromJson(result as Map); - sharedPref.setObject(NHIC_DATA, result); - // widget.changePageViewIndex!(1), - // Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))), - RegisterInfoResponse resultSet = RegisterInfoResponse.fromJson(result); - sendActivationCode(type,loginToken, resultSet); - } - else - { - AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong); - } + if (result is Map) { + CheckUserStatusResponse res = CheckUserStatusResponse.fromJson(result as Map); + nHICData = res; + sharedPref.setObject(NHIC_DATA, res.toJson()); + // widget.changePageViewIndex!(1), + // Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))), + RegisterInfoResponse resultSet = RegisterInfoResponse.fromJson(res.toJson()); + sendActivationCode(type, loginToken, resultSet); + } else { + AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong); + } }); } - sendActivationCode(type, loginTokenID, RegisterInfoResponse nHICData) async { - LoginTokenID = loginTokenID; var request = authService.getCommonRequest( registerd_data: null, - deviceToken: null, + deviceToken: DEVICE_TOKEN, mobileNumber: int.parse(mobileNo), zipCode: selectedCountry.countryCode, patientOutSA: selectedCountry.countryCode == "966" ? 0 : 1, loginTokenID: LoginTokenID, selectedOption: type, user: SelectDeviceIMEIRES()); + request.isRegister = true; + // request.searchType =1 ; + request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); request.sMSSignature = await SMSOTP.getSignature(); + // selectedOption = type; GifLoaderDialogUtils.showMyDialog(context); // if (healthId != null || isDubai) { - if (!isDubai) { - // request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); - request.dob = nHICData.isHijri ==true ? nHICData.dateOfBirth: dateFormat.format(dateFormat.parse(nHICData.dateOfBirth!)); - } + // if (!isDubai) { + // // request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); + // request.dob = nHICData.isHijri == true ? nHICData.dateOfBirth : dateFormat.format(dateFormat.parse(nHICData.dateOfBirth!)); + // } request.healthId = nHICData.healthId; - request.isHijri = isHijri; + request.isHijri = isHijri ?? 0; + request.nationalID = nHICData.idNumber; + request.patientIdentificationID = nHICData.idNumber; + request.oTPSendType = type; await this.authService.sendActivationCodeRegister(request).then((result) { GifLoaderDialogUtils.hideDialog(context); if (result != null && result['isSMSSent'] == true) { + print(result); + // LoginTokenID = result["LogInTokenID"]; startSMSService(type); } }).catchError((r) { @@ -679,37 +593,42 @@ class _RegisterNew extends State { }); } - checkActivationCode({value}) async { + checkActivationCode({value, type}) async { // Navigator.pop(context); GifLoaderDialogUtils.showMyDialog(context); var request = authService.getCommonRequest( registerd_data: null, - deviceToken: null, - mobileNumber: mobileNo, + deviceToken: DEVICE_TOKEN, + mobileNumber: int.parse(mobileNo), zipCode: selectedCountry.countryCode, patientOutSA: selectedCountry.countryCode == "966" ? 0 : 1, loginTokenID: LoginTokenID, - selectedOption: value, + selectedOption: type, user: SelectDeviceIMEIRES()); dynamic res; // if (healthId != null || isDubai) { // if (isDubai) { // request['DOB'] = dob; // } - // request['HealthId'] = healthId; - // request['IsHijri'] = isHijri; + request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); + request.healthId = nHICData!.healthId!; + request.isHijri = isHijri ?? 0; + request.nationalID = nHICData!.idNumber; + request.patientIdentificationID = nHICData!.idNumber; + request.isRegister = true; authService - .checkActivationCodeRegister(request, value) + .checkActivationCodeRegister(request.toJson(), value) .then((result) => { res = result, if (result is Map) { result = CheckActivationCode.fromJson(result as Map), - //next registration page navigate from here. - Navigator.of(context).push(FadePage(page: RegisterNewStep2())) + Navigator.of(context).push( + FadePage(page: RegisterNewStep2(nHICData!, request)), + ) // // if(widget.isDubai ==false){ // // widget.changePageViewIndex!(1), @@ -723,7 +642,7 @@ class _RegisterNew extends State { Navigator.of(context).pop(), GifLoaderDialogUtils.hideDialog(context), Future.delayed(Duration(seconds: 1), () { - AppToast.showErrorToast(message: result); + AppToast.showErrorToast(message: result, localContext: context); }), // projectViewModel.analytics.loginRegistration.login_fail(error: result), // projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result), @@ -745,7 +664,7 @@ class _RegisterNew extends State { type, phoneController.text, (value) { - this.checkActivationCode(value: value); + this.checkActivationCode(value: value, type: type); }, () => { Navigator.pop(context), diff --git a/lib/pages/login/register_new_step_2.dart b/lib/pages/login/register_new_step_2.dart index bf301285..1ea719a2 100644 --- a/lib/pages/login/register_new_step_2.dart +++ b/lib/pages/login/register_new_step_2.dart @@ -1,6 +1,15 @@ import 'package:flutter/gestures.dart'; +import 'package:hmg_patient_app/config/shared_pref_kay.dart'; import 'package:hmg_patient_app/config/size_config.dart'; +import 'package:hmg_patient_app/core/service/AuthenticatedUserObject.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; +import 'package:hmg_patient_app/extensions/string_extensions.dart'; +import 'package:hmg_patient_app/locator.dart'; +import 'package:hmg_patient_app/models/Appointments/toDoCountProviderModel.dart'; +import 'package:hmg_patient_app/models/Authentication/check_activation_code_response.dart'; +import 'package:hmg_patient_app/models/Authentication/check_user_status_reponse.dart'; +import 'package:hmg_patient_app/models/Authentication/register_info_response.dart'; +import 'package:hmg_patient_app/models/Authentication/send_activation_request.dart'; import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart'; import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; import 'package:hmg_patient_app/pages/login/login-type.dart'; @@ -9,6 +18,9 @@ import 'package:hmg_patient_app/pages/login/register.dart'; import 'package:hmg_patient_app/services/authentication/auth_provider.dart'; import 'package:hmg_patient_app/theme/colors.dart'; import 'package:hmg_patient_app/uitl/app_shared_preferences.dart'; +import 'package:hmg_patient_app/uitl/app_toast.dart'; +import 'package:hmg_patient_app/uitl/date_uitl.dart'; +import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart'; import 'package:hmg_patient_app/uitl/translations_delegate_base.dart'; import 'package:hmg_patient_app/uitl/utils.dart'; import 'package:hmg_patient_app/uitl/utils_new.dart'; @@ -17,46 +29,39 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart'; import 'package:provider/provider.dart'; +import '../../widgets/dialogs/confirm_dialog.dart'; +import 'package:hijri/hijri_calendar.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; + class RegisterNewStep2 extends StatefulWidget { + CheckUserStatusResponse nHICData; + SendActivationRequest payload; + + RegisterNewStep2(this.nHICData, this.payload, {Key? key}) : super(key: key); + @override _RegisterNew createState() => _RegisterNew(); } class _RegisterNew extends State { - final nationalIDorFile = TextEditingController(); final emailAddress = TextEditingController(); - DateTime? selectedDOB; - final int loginType = LoginType.loginType; late String mobileNo; String countryCode = '966'; - var isHijri; - final util = Utils(); - late String dob; - bool isButtonDisabled = true; final authService = new AuthProvider(); final sharedPref = new AppSharedPreferences(); - late PageController _controller; - late bool isLoading; - int _currentIndex = 0; + AuthenticatedUserObject authenticatedUserObject = locator(); + late ProjectViewModel projectViewModel; @override void initState() { super.initState(); - _controller = new PageController(); - } - - @override - void dispose() { - super.dispose(); - } - - changePageViewIndex(pageIndex) { - _controller.jumpToPage(pageIndex); } @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: "Personal Details Verification", isShowDecPage: false, @@ -87,7 +92,7 @@ class _RegisterNew extends State { padding: EdgeInsets.only(left: 16, right: 16), child: Column( children: [ - inputWidget(TranslationBase.of(context).name, "Mohammad Hussain Abdul Ghaffar", nationalIDorFile, + inputWidget(TranslationBase.of(context).name, (widget.nHICData.firstNameEn!.toUpperCase() + " " + widget.nHICData.lastNameEn!.toUpperCase()), null, isEnable: true, prefix: null, removePadding: true, @@ -99,7 +104,7 @@ class _RegisterNew extends State { leadingIcon: "assets/images/svg/user-circle.svg", onChange: (value) {}), Divider(height: 1), - inputWidget(TranslationBase.of(context).nationalIdNumber, "25293444933", nationalIDorFile, + inputWidget(TranslationBase.of(context).nationalIdNumber, (widget.nHICData.idNumber ?? ""), null, isEnable: true, prefix: null, removePadding: true, @@ -111,7 +116,7 @@ class _RegisterNew extends State { leadingIcon: "assets/images/svg/student-card.svg", onChange: (value) {}), Divider(height: 1), - inputWidget(TranslationBase.of(context).gender, "Male", nationalIDorFile, + inputWidget(TranslationBase.of(context).gender, (widget.nHICData.gender ?? ""), null, isEnable: true, prefix: null, removePadding: true, @@ -123,7 +128,7 @@ class _RegisterNew extends State { leadingIcon: "assets/images/svg/user-full.svg", onChange: (value) {}), Divider(height: 1), - inputWidget(TranslationBase.of(context).maritalStatus, "Married", nationalIDorFile, + inputWidget(TranslationBase.of(context).maritalStatus, (widget.nHICData.maritalStatus ?? ""), null, isEnable: true, prefix: null, removePadding: true, @@ -135,7 +140,7 @@ class _RegisterNew extends State { leadingIcon: "assets/images/svg/smart-phone.svg", onChange: (value) {}), Divider(height: 1), - inputWidget(TranslationBase.of(context).nationality, "Pakistani", nationalIDorFile, + inputWidget(TranslationBase.of(context).nationality, (widget.nHICData.nationality ?? ""), null, isEnable: true, prefix: null, removePadding: true, @@ -147,7 +152,7 @@ class _RegisterNew extends State { leadingIcon: "assets/images/svg/globe.svg", onChange: (value) {}), Divider(height: 1), - inputWidget(TranslationBase.of(context).mobileNumber, "234567876543", nationalIDorFile, + inputWidget(TranslationBase.of(context).mobileNumber, (widget.payload.mobileNo ?? ""), null, isEnable: true, prefix: null, removePadding: true, @@ -159,7 +164,7 @@ class _RegisterNew extends State { leadingIcon: "assets/images/svg/call.svg", onChange: (value) {}), Divider(height: 1), - inputWidget(TranslationBase.of(context).dob, "11 July, 1994", nationalIDorFile, + inputWidget(TranslationBase.of(context).dob, (widget.nHICData.dateOfBirth ?? ""), null, isEnable: true, prefix: null, hasSelection: false, @@ -169,7 +174,7 @@ class _RegisterNew extends State { hasSelectionCustomIcon: false, isReadOnly: true, selectionType: SelectionType.calendar, - selectedValue: selectedDOB != null ? Utils.formatDateToDisplay(selectedDOB.toString()) : null, + selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null, selectionCustomIcon: "assets/images/svg/calendar.svg", leadingIcon: "assets/images/svg/birthday-cake.svg", onChange: (value) {}), @@ -185,15 +190,7 @@ class _RegisterNew extends State { text: TranslationBase.of(context).cancel, icon: "assets/images/svg/cancel.svg", onPressed: () { - if (nationalIDorFile == null) { - Utils.showErrorToast("Please enter your national id."); - return; - } - - if (selectedDOB == null) { - Utils.showErrorToast("Please enter your date of birth."); - return; - } + Navigator.of(context).pop(); }, fontFamily: context.fontFamily, backgroundColor: Color(0xFFFEE9EA), @@ -209,16 +206,6 @@ class _RegisterNew extends State { text: TranslationBase.of(context).confirm, icon: "assets/images/svg/confirm.svg", onPressed: () { - // // bool isValid = Utils.validateIqama(nationalIDorFile.text); - // if (nationalIDorFile == null) { - // Utils.showErrorToast("Please enter your national id."); - // return; - // } - // if (selectedDOB == null) { - // Utils.showErrorToast("Please enter your date of birth."); - // return; - // } - showModalBottomSheet( context: context, isScrollControlled: true, @@ -233,7 +220,20 @@ class _RegisterNew extends State { buttons: [ Padding( padding: const EdgeInsets.only(bottom: 10), - child: CustomButton(text: "Submit", onPressed: () {}, backgroundColor: Colors.red, borderColor: Colors.red, textColor: Colors.white), + child: CustomButton( + text: "Submit", + onPressed: () { + if (emailAddress.text.isEmpty) { + Utils.showErrorToast("Please enter your email address."); + return; + } else { + Navigator.of(context).pop(); + registerNow(); + } + }, + backgroundColor: Colors.red, + borderColor: Colors.red, + textColor: Colors.white), ), ], ), @@ -309,5 +309,148 @@ class _RegisterNew extends State { ); } - void registerUser(int? value) {} + registerNow() { + dynamic request; + if (!widget.payload.zipCode!.contains("966")) + request = getTempUserRequestDubai(); + else + request = getTempUserRequest(); + + GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: true); + dynamic res; + + authService + .registerUser(request) + .then((result) async => { + if (result is String) + { + GifLoaderDialogUtils.hideDialog(context), + new ConfirmDialog( + context: context, + confirmMessage: result, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {ConfirmDialog.closeAlertDialog(context)}, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}).showAlertDialog(context) + } + else + { + res = result, + result = CheckActivationCode.fromJson(result), + // result.list.isFamily = false, + // sharedPref.setObject(USER_PROFILE, result.list), + // this.sharedPref.setObject(MAIN_USER, result.list), + // sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + // sharedPref.setString(TOKEN, result.authenticationTokenID), + // this.setUser(result), + sharedPref.remove(FAMILY_FILE), + result.list.isFamily = false, + + await sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? ""), + authenticatedUserObject.user = result.list, + projectViewModel.setPrivilege(privilegeList: res), + await sharedPref.setObject(MAIN_USER, result.list), + await sharedPref.setObject(USER_PROFILE, result.list), + + await sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + await sharedPref.setString(TOKEN, result.authenticationTokenID), + AppToast.showSuccessToast(message: TranslationBase.of(context).successRegister), + projectViewModel.analytics.loginRegistration.registration_confirmation() + } + }) + .catchError((err) { + // GifLoaderDialogUtils.hideDialog(context); + ConfirmDialog dialog = ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {ConfirmDialog.closeAlertDialog(context)}, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + projectViewModel.analytics.loginRegistration.registration_fail(errorType: ""); + }); + } + + getTempUserRequest() { + DateFormat dateFormat = DateFormat("mm/dd/yyyy"); + print(dateFormat.parse(widget.nHICData.dateOfBirth!)); + var hDate = new HijriCalendar.fromDate(dateFormat.parse(widget.nHICData.dateOfBirth!)); + var date = hDate.toString(); + return { + "Patientobject": { + "TempValue": true, + "PatientIdentificationType": widget.nHICData.idNumber!.substring(0, 1) == "1" ? 1 : 2, + "PatientIdentificationNo": widget.nHICData.idNumber, + "MobileNumber": int.parse(widget.payload.mobileNo!), + "PatientOutSA": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 0 : 1, + "FirstNameN": widget.nHICData.firstNameAr, + "FirstName": widget.nHICData.firstNameEn, + "MiddleNameN": widget.nHICData.secondNameAr, + "MiddleName": widget.nHICData.secondNameEn, + "LastNameN": widget.nHICData.lastNameAr, + "LastName": widget.nHICData.lastNameEn, + "StrDateofBirth": widget.nHICData.dateOfBirth, + "DateofBirth": DateUtil.convertISODateToJsonDate(widget.nHICData.dateOfBirth!.replaceAll('/', '-')), + "Gender": widget.nHICData.gender == 'M' ? 1 : 2, + "NationalityID": widget.nHICData.nationalityCode, + "eHealthIDField": widget.nHICData.healthId, + "DateofBirthN": date, + "EmailAddress": emailAddress.text, + "SourceType": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 1 : 2, + "PreferredLanguage": context.selectedLanguage == "ar" ? 1 : 2, + // "OccupationID": registerInfo.occupationID, + "Marital": widget.nHICData.maritalStatusCode == 'U' + ? '0' + : widget.nHICData.maritalStatusCode == 'M' + ? '1' + : '2', + }, + "PatientIdentificationID": widget.nHICData.idNumber, + "PatientMobileNumber": widget.payload.mobileNo.toString()[0] == '0' ? widget.payload.mobileNo : '0' + widget.payload.mobileNo.toString() + }; + } + + getTempUserRequestDubai() { + DateFormat dateFormat = DateFormat("mm/dd/yyyy"); + // print(dateFormat.parse(registerd_data.dob!)); + var hDate = new HijriCalendar.fromDate(dateFormat.parse(widget.nHICData.dateOfBirth!)); + var date = hDate.toString(); + final DateFormat dateFormat1 = DateFormat('MM/dd/yyyy'); + final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); + + return { + "Patientobject": { + "TempValue": true, + "PatientIdentificationType": widget.nHICData.idNumber!.substring(0, 1) == "1" ? "1" : "2", + "PatientIdentificationNo": widget.nHICData.idNumber, + "MobileNumber": int.parse(widget.payload.mobileNo ?? ""), + "PatientOutSA": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 0 : 1, + "FirstNameN": widget.nHICData.firstNameAr ?? "", + "FirstName": widget.nHICData.firstNameEn ?? "", + "MiddleNameN": widget.nHICData.secondNameAr ?? ".", + "MiddleName": widget.nHICData.secondNameEn ?? ".", + "LastNameN": widget.nHICData.lastNameAr ?? "", + "LastName": widget.nHICData.lastNameEn ?? "", + "StrDateofBirth": dateFormat1.format(dateFormat2.parse(widget.nHICData.dateOfBirth!)), + "DateofBirth": DateUtil.convertISODateToJsonDate(widget.nHICData.dateOfBirth!.replaceAll('/', '-')), + "Gender": widget.nHICData.gender == 'M' ? 1 : 2, + "NationalityID": widget.nHICData.nationalityCode, + "eHealthIDField": null, + "DateofBirthN": date, + "EmailAddress": emailAddress.text, + "SourceType": (widget.payload.zipCode == '966' || widget.payload.zipCode == '+966') ? 1 : 2, + "PreferredLanguage": context.selectedLanguage == "ar" ? 1 : 2, + "Marital": widget.nHICData.maritalStatusCode == 'U' + ? '0' + : widget.nHICData.maritalStatusCode == 'M' + ? '1' + : '2', + }, + "PatientIdentificationID": widget.nHICData.idNumber, + "PatientMobileNumber": widget.payload.mobileNo.toString()[0] == '0' ? widget.payload.mobileNo : '0' + widget.payload.mobileNo.toString(), + "DOB": widget.nHICData.dateOfBirth, + "IsHijri": widget.payload.isHijri + }; + } } diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 9e35cb03..cf3d9ef0 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -114,6 +114,7 @@ class _WelcomeLogin extends State { body: SafeArea( child: SingleChildScrollView( reverse: true, + physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only( left: 24, right: 24, @@ -125,10 +126,11 @@ class _WelcomeLogin extends State { Utils.showLottie( context: context, assetPath: 'assets/animations/lottie/login.json', - width: 238, + width: context.getLottieScaledWidth(238), repeat: true, + fit: BoxFit.cover, ), - SizedBox(height: 150), + SizedBox(height: 140), Text( TranslationBase.of(context).welcomeToDrSulaiman, style: TextStyle( @@ -209,7 +211,6 @@ class _WelcomeLogin extends State { padding: const EdgeInsets.only(bottom: 10), child: CustomButton( text: "Send me OTP on WhatsApp", - onPressed: () { int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, phoneController); if (val != null) checkUserAuthentication(val); @@ -226,7 +227,6 @@ class _WelcomeLogin extends State { ), ); } else { - Utils.showErrorToast("Please enter a valid Iqama number.", context); } }, @@ -576,7 +576,6 @@ class _WelcomeLogin extends State { authenticatedUserObject: authenticatedUserObject, appointmentRateViewModel: appointmentRateViewModel, selectedOption: selectedOption, - isArabic: projectViewModel.isArabic, ), ), diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 8e338426..1a5da8ab 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:io'; import 'package:hmg_patient_app/config/config.dart'; @@ -23,6 +24,7 @@ import 'package:hmg_patient_app/models/Request.dart'; import 'package:hmg_patient_app/routes.dart'; import 'package:hmg_patient_app/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; +import 'package:hmg_patient_app/uitl/date_uitl.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; @@ -395,14 +397,37 @@ class AuthProvider with ChangeNotifier { request['LanguageID'] = (languageID == 'ar' ? 1 : 2); request['LogInTokenID'] = await sharedPref.getString(LOGIN_TOKEN_ID); var nhic = await sharedPref.getObject(NHIC_DATA); - var requestN = RegisterUserRequest.fromJson(request); - requestN.patientOutSA = requestN.patientobject!.patientOutSA!; - final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); - final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); + + Map requestData; + if (request is String) { + requestData = jsonDecode(request) as Map; + } else if (request is Map) { + requestData = Map.from(request); + } else { + print("Error: Request is not in the expected format."); + throw ArgumentError("Request data is not a valid Map or JSON String."); + } + + print(jsonEncode(requestData)); + + RegisterUserRequest requestN = RegisterUserRequest(patientobject: Patientobject.fromJson(request["Patientobject"])); + // var requestN = RegisterUserRequest.fromJson(request); + requestN.patientOutSA = requestN.patientobject!.patientOutSa!; + if (nhic != null) { - requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth'])); + // requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth'])); + // requestN.isHijri = nhic['IsHijri'] ? 1 : 0; + // requestN.healthId = requestN.patientobject!.eHealthIDField!; + // } + final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); + final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); + + requestN.dob = nhic['IsHijri'] ? requestN.patientobject!.dateofBirth :dateFormat2.format(dateFormat.parse(requestN.patientobject!.strDateofBirth!)); requestN.isHijri = nhic['IsHijri'] ? 1 : 0; - requestN.healthId = requestN.patientobject!.eHealthIDField!; + requestN.healthId = requestN.patientobject!.eHealthIdField; + requestN.patientIdentificationID = requestN.patientobject!.patientIdentificationNo; + requestN.patientMobileNumber = requestN.patientobject!.mobileNumber.toString(); + requestN.logInTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); } requestN.zipCode = requestN.patientOutSA == 1 ? '971' : '966'; @@ -1687,6 +1712,8 @@ class AuthProvider with ChangeNotifier { // "message": "Patient Registered Successfully", // "statusCode": 1 // }; + // print(requestN.toRawJson()); + // return; await new BaseAppClient().post(REGISTER_USER, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { @@ -1939,7 +1966,16 @@ class AuthProvider with ChangeNotifier { Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } - SendActivationRequest getCommonRequest({type, required registerd_data,required deviceToken,required mobileNumber,required zipCode,required patientOutSA, required loginTokenID, required selectedOption, required SelectDeviceIMEIRES user} ) { + SendActivationRequest getCommonRequest( + {type, + required registerd_data, + required deviceToken, + required mobileNumber, + required zipCode, + required patientOutSA, + required loginTokenID, + required selectedOption, + required SelectDeviceIMEIRES user}) { var request = SendActivationRequest(); request.patientMobileNumber = mobileNumber; request.mobileNo = '0' + mobileNumber.toString(); diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 19e9131f..954a91aa 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -120,19 +120,14 @@ class Utils { } } - - - static String formatDateToDisplay(String isoDateString) { + static String formatDateToDisplay(String isoDateString) { try { final dateTime = DateTime.parse(isoDateString); final day = dateTime.day.toString().padLeft(2, '0'); final year = dateTime.year.toString(); // Map month number to short month name - const monthNames = [ - 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' - ]; + const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; final month = monthNames[dateTime.month - 1]; return '$day $month, $year'; @@ -143,7 +138,7 @@ class Utils { } } - static String formatDateToUsage(String isoDateString) { + static String formatDateToUsage(String isoDateString) { try { final dateTime = DateTime.parse(isoDateString); final day = dateTime.day.toString().padLeft(2, '0'); @@ -157,7 +152,6 @@ class Utils { } } - static Widget showLottie({ required BuildContext context, String assetPath = 'assets/icons/no_property.json', @@ -1244,7 +1238,6 @@ extension CountryExtension on Country { } } - extension FontFamilyExtension on BuildContext { String get fontFamily { final language = read().currentLanguage; @@ -1257,8 +1250,9 @@ extension SelectedLanguageExtension on BuildContext { final language = read().currentLanguage; return language; } -} + double getLottieScaledWidth(double value) => MediaQuery.of(this).size.width * (value / MediaQuery.of(this).size.width); +} /* userBoard.asMap().map((i, element) => MapEntry(i, Stack( diff --git a/pubspec.yaml b/pubspec.yaml index e5e4d524..f4f16275 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -63,6 +63,8 @@ dependencies: url: https://github.com/crasowas/hms-flutter-plugin.git path: flutter-hms-push # huawei_push: ^6.12.0+303 + hijri_gregorian_calendar: + path: /Users/aamir/StudioProjects/hijri_gregorian_calendar # Qr code Scanner location: ^8.0.1