From 6e30df2a293f19af4217c30bacbe490a032b0d56 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 May 2024 12:36:01 +0300 Subject: [PATCH 1/6] WeCare service added --- lib/config/config.dart | 2 + lib/config/localized_values.dart | 1 + .../medical/medical_profile_page_new.dart | 70 ++++++++++++++++++- .../clinic_services/get_clinic_service.dart | 12 ++++ lib/uitl/translations_delegate_base.dart | 2 + lib/uitl/utils.dart | 14 +++- .../dialogs/radio_selection_dialog.dart | 7 +- 7 files changed, 103 insertions(+), 5 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index edb81d78..996b3e65 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -629,6 +629,8 @@ var GET_BLOOD_DONATION_PROJECTS_LIST = 'Services/OUTPs.svc/REST/BD_getProjectsHa var GET_BLOOD_DONATION_FREE_SLOTS = 'Services/OUTPs.svc/REST/BD_GetFreeSlots'; +var GET_WE_CARE_TOUR_URL = 'Services/Consent.svc/Rest/Consent_VirtualJurny_Url_GetByProjectID'; + //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b5e1f0d2..6910f8de 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1933,4 +1933,5 @@ const Map localizedValues = { "locationTimeoutError": {"en": "Unable to fetch your location, Please try again.", "ar": "غير قادر على جلب موقعك، يرجى المحاولة مرة أخرى."}, "loadMore": {"en": "Load More", "ar": "تحميل المزيد"}, "selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"}, + "wecare": {"en": "We Care", "ar": "نحن نهتم"}, }; diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index f8f6499e..55ba30d4 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -1,21 +1,29 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_new_widget.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class MedicalProfilePageNew extends StatefulWidget { Function onTap; String a; + MedicalProfilePageNew({this.onTap}); + @override _MedicalProfilePageState createState() => _MedicalProfilePageState(); } @@ -25,11 +33,15 @@ class _MedicalProfilePageState extends State { List medical = List(); ProjectViewModel projectViewModel; + List projectsList = []; + HospitalsModel _selectedHospital; + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); - List myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); + List myMedicalList = + Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin, onWeCareClick: openWeCareProjectSelection); return BaseView( onModelReady: (model) => model.getAppointmentHistory(isForTimeLine: true), builder: (_, model, widget1) => AppScaffold( @@ -99,6 +111,62 @@ class _MedicalProfilePageState extends State { ), ); } + + openWeCareProjectSelection() { + int _selectedHospitalIndex = -1; + int languageID = projectViewModel.isArabic ? 1 : 2; + GifLoaderDialogUtils.showMyDialog(context); + ClinicListService service = new ClinicListService(); + List projectsListLocal = []; + service.getProjectsList(languageID, context).then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + res['ListProject'].forEach((v) { + projectsListLocal.add(new HospitalsModel.fromJson(v)); + }); + projectsList = projectsListLocal; + }); + GifLoaderDialogUtils.hideDialog(context); + List list = [ + for (int i = 0; i < projectsList.length; i++) RadioSelectionDialogModel(projectsList[i].name + ' ${projectsList[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + ]; + showDialog( + context: context, + builder: (cxt) => RadioSelectionDialog( + buttonText: TranslationBase.of(context).confirm, + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = projectsList[index]; + openWeCareURL(_selectedHospital.iD); + // setState(() {}); + }, + ), + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + print(err); + }); + } + + openWeCareURL(int projectID) { + GifLoaderDialogUtils.showMyDialog(context); + ClinicListService service = new ClinicListService(); + service.getWeCareURL(projectID).then((res) { + print(res["Consent_VirtualJurny_Url_GetByProjectIDList"][0]["Url"]); + Uri uri = Uri.parse(res["Consent_VirtualJurny_Url_GetByProjectIDList"][0]["Url"]); + GifLoaderDialogUtils.hideDialog(context); + launchUrl(uri, mode: LaunchMode.inAppWebView); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err.toString()); + }); + } } class Medical { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 1d848616..41c0b081 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -153,4 +153,16 @@ class ClinicListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future getWeCareURL(int projectID) async { + Map request = {"ProjectID": projectID}; + dynamic localRes; + await baseAppClient.post(GET_WE_CARE_TOUR_URL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 61009cb4..3d0eb100 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2918,6 +2918,8 @@ class TranslationBase { String get locationTimeoutError => localizedValues["locationTimeoutError"][locale.languageCode]; String get loadMore => localizedValues["loadMore"][locale.languageCode]; String get selectHospitalBloodDonation => localizedValues["selectHospitalBloodDonation"][locale.languageCode]; + String get wecare => localizedValues["wecare"][locale.languageCode]; + } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index d93cec9b..a77579e2 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -222,7 +222,7 @@ class Utils { return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email); } - static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count, Function onWeCareClick}) { List medical = List(); medical.add(InkWell( @@ -381,6 +381,18 @@ class Utils { ), )); + medical.add(InkWell( + // onTap: () => projectViewModel.havePrivilege(85) ? Navigator.push(context, FadePage(page: AnicllaryOrders())) : null, + onTap: () => onWeCareClick(), + child: MedicalProfileItem( + title: TranslationBase.of(context).wecare, + imagePath: 'assets/images/new-design/virtual_tour_icon.png', + isPngImage: true, + subTitle: TranslationBase.of(context).service, + isEnable: projectViewModel.havePrivilege(85), + ), + )); + medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, child: MedicalProfileItem( diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index dc460009..3a79bf47 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -15,11 +15,12 @@ class RadioSelectionDialog extends StatefulWidget { final int selectedIndex; final bool isScrollable; final bool isShowSearch; - - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false}) : super(key: key); + final String buttonText; @override State createState() => new RadioSelectionDialogState(); + + const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false, this.buttonText = ""}) : super(key: key); } class RadioSelectionDialogState extends State { @@ -163,7 +164,7 @@ class RadioSelectionDialogState extends State { children: [ Expanded( child: DefaultButton( - TranslationBase.of(context).save, + widget.buttonText.isNotEmpty ? widget.buttonText : TranslationBase.of(context).save, () { Navigator.pop(context); widget.onValueSelected(selectedIndex); From 5f90435442f703b248a9946ba522f2328eca3e27 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 May 2024 16:09:14 +0300 Subject: [PATCH 2/6] National ID input validation added --- lib/pages/login/login.dart | 32 +++++++++++++++++--------------- lib/uitl/utils.dart | 3 ++- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index d55c4017..bf32c40f 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -126,11 +126,13 @@ class _Login extends State { ), DefaultButton( TranslationBase.of(context).login, - isButtonDisabled - ? null - : () { - this.startLogin(); - }, + () { + if (isButtonDisabled) { + AppToast.showErrorToast(message: "National ID can only contain numbers"); + } else { + this.startLogin(); + } + }, disabledColor: Color(0xff575757), ), ]), @@ -227,7 +229,7 @@ class _Login extends State { } void validateForm() { - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && (countryCode == "971" ? true : util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true)) { setState(() { isButtonDisabled = false; }); @@ -257,16 +259,16 @@ class _Login extends State { GifLoaderDialogUtils.showMyDialog(context); authService.checkPatientAuthentication(request).then((value) { // if (value['UserAccountIsActivated']) { - if (value['isSMSSent']) { - sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); - sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request); - GifLoaderDialogUtils.hideDialog(context); - Navigator.of(context).push(FadePage(page: ConfirmLogin())); - } else { - if (value['IsAuthenticated']) { - this.checkActivationCode(); - } + if (value['isSMSSent']) { + sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); + sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request); + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).push(FadePage(page: ConfirmLogin())); + } else { + if (value['IsAuthenticated']) { + this.checkActivationCode(); } + } // } else { // ConfirmDialog activationDialog = new ConfirmDialog( // context: context, diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index a77579e2..960ae8a2 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -166,12 +166,13 @@ class Utils { Pattern pattern = loginIDPattern(type); //r'^\d+(?:\.\d+)?$'; RegExp regex = new RegExp(pattern); + print(regex.hasMatch(value)); return regex.hasMatch(value); } String loginIDPattern(loginType) { var length = loginType == 1 ? 10 : 1; - return "([0-9]{" + length.toString() + "})"; + return "([0-9]{" + length.toString() + "}\$)"; } static showProgressDialog(context, [String message = "Loading..."]) async { From 96d5c3ce1d982346ca50a42a954f8fbf2f614463 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 14 May 2024 10:45:49 +0300 Subject: [PATCH 3/6] My Instructions added --- lib/config/config.dart | 2 + lib/config/localized_values.dart | 1 + lib/core/service/client/base_app_client.dart | 2 +- ...et_dental_instructions_response_model.dart | 77 +++++++++++++++++ .../medical/dental_instructions_page.dart | 85 +++++++++++++++++++ .../clinic_services/get_clinic_service.dart | 11 +++ lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 15 +++- 8 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 lib/models/get_dental_instructions_response_model.dart create mode 100644 lib/pages/medical/dental_instructions_page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 996b3e65..c5562fed 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -631,6 +631,8 @@ var GET_BLOOD_DONATION_FREE_SLOTS = 'Services/OUTPs.svc/REST/BD_GetFreeSlots'; var GET_WE_CARE_TOUR_URL = 'Services/Consent.svc/Rest/Consent_VirtualJurny_Url_GetByProjectID'; +var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification'; + //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 6910f8de..fbc54c13 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1934,4 +1934,5 @@ const Map localizedValues = { "loadMore": {"en": "Load More", "ar": "تحميل المزيد"}, "selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"}, "wecare": {"en": "We Care", "ar": "نحن نهتم"}, + "myinstructions": {"en": "My Instructions", "ar": "تعليماتي"}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 10d18e3a..4bc52b94 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 3300938; //4609100 + // body['PatientID'] = 4767804; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/models/get_dental_instructions_response_model.dart b/lib/models/get_dental_instructions_response_model.dart new file mode 100644 index 00000000..6f2f8621 --- /dev/null +++ b/lib/models/get_dental_instructions_response_model.dart @@ -0,0 +1,77 @@ +class GetDentalInstructionsResponseModel { + List data; + dynamic message; + int status; + + GetDentalInstructionsResponseModel({this.data, this.message, this.status}); + + GetDentalInstructionsResponseModel.fromJson(Map json) { + if (json['Data'] != null) { + data = []; + json['Data'].forEach((v) { + data.add(new Data.fromJson(v)); + }); + } + message = json['message']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + if (this.data != null) { + data['Data'] = this.data.map((v) => v.toJson()).toList(); + } + data['message'] = this.message; + data['status'] = this.status; + return data; + } +} + +class Data { + String createdOn; + String mobileNo; + int patientId; + int procedureId; + int projectId; + String setupId; + String smsContent; + int sourceReferenceNo; + String sourceType; + + Data( + {this.createdOn, + this.mobileNo, + this.patientId, + this.procedureId, + this.projectId, + this.setupId, + this.smsContent, + this.sourceReferenceNo, + this.sourceType}); + + Data.fromJson(Map json) { + createdOn = json['createdOn']; + mobileNo = json['mobileNo']; + patientId = json['patientId']; + procedureId = json['procedureId']; + projectId = json['projectId']; + setupId = json['setupId']; + smsContent = json['smsContent']; + sourceReferenceNo = json['sourceReferenceNo']; + sourceType = json['sourceType']; + } + + Map toJson() { + final Map data = new Map(); + data['createdOn'] = this.createdOn; + data['mobileNo'] = this.mobileNo; + data['patientId'] = this.patientId; + data['procedureId'] = this.procedureId; + data['projectId'] = this.projectId; + data['setupId'] = this.setupId; + data['smsContent'] = this.smsContent; + data['sourceReferenceNo'] = this.sourceReferenceNo; + data['sourceType'] = this.sourceType; + return data; + } +} diff --git a/lib/pages/medical/dental_instructions_page.dart b/lib/pages/medical/dental_instructions_page.dart new file mode 100644 index 00000000..a704d620 --- /dev/null +++ b/lib/pages/medical/dental_instructions_page.dart @@ -0,0 +1,85 @@ +import 'package:diplomaticquarterapp/models/get_dental_instructions_response_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class DentalInstructionsPage extends StatefulWidget { + const DentalInstructionsPage(); + + @override + State createState() => _DentalInstructionsPageState(); +} + +class _DentalInstructionsPageState extends State { + GetDentalInstructionsResponseModel getDentalInstructionsResponseModel; + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) { + getDentalInstructions(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).myinstructions, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Container( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + getDentalInstructionsResponseModel != null && getDentalInstructionsResponseModel.data.isNotEmpty + ? ListView.builder( + itemCount: getDentalInstructionsResponseModel.data.length, + shrinkWrap: true, + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(top: 16.0, bottom: 16.0), + child: Text( + getDentalInstructionsResponseModel.data[index].smsContent, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), + ), + ); + }, + ) + : Center(child: getNoDataWidget(context)), + ], + ), + ), + ), + ), + ); + } + + getDentalInstructions() { + GifLoaderDialogUtils.showMyDialog(context); + ClinicListService service = new ClinicListService(); + service.getDentalInstructions().then((res) { + print(res["ProcedureNotificationResponse"]); + getDentalInstructionsResponseModel = GetDentalInstructionsResponseModel.fromJson(res["ProcedureNotificationResponse"]); + GifLoaderDialogUtils.hideDialog(context); + setState(() {}); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err.toString()); + }); + } +} diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 41c0b081..d8ca8857 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -165,4 +165,15 @@ class ClinicListService extends BaseService { return Future.value(localRes); } + Future getDentalInstructions() async { + Map request = {}; + dynamic localRes; + await baseAppClient.post(GET_DENTAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 3d0eb100..48d1ce7b 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2919,6 +2919,7 @@ class TranslationBase { String get loadMore => localizedValues["loadMore"][locale.languageCode]; String get selectHospitalBloodDonation => localizedValues["selectHospitalBloodDonation"][locale.languageCode]; String get wecare => localizedValues["wecare"][locale.languageCode]; + String get myinstructions => localizedValues["myinstructions"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 960ae8a2..bda6fae3 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -25,6 +25,7 @@ import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedi import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart'; import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/dental_instructions_page.dart'; import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; @@ -383,7 +384,6 @@ class Utils { )); medical.add(InkWell( - // onTap: () => projectViewModel.havePrivilege(85) ? Navigator.push(context, FadePage(page: AnicllaryOrders())) : null, onTap: () => onWeCareClick(), child: MedicalProfileItem( title: TranslationBase.of(context).wecare, @@ -394,6 +394,19 @@ class Utils { ), )); + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: DentalInstructionsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myinstructions, + imagePath: 'medical_instructions.svg', + isPngImage: false, + subTitle: TranslationBase.of(context).service, + isEnable: projectViewModel.havePrivilege(85), + ), + )); + medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, child: MedicalProfileItem( From 9a102be7c7c2e4b161f9c63d660927e13667d847 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 14 May 2024 15:27:54 +0300 Subject: [PATCH 4/6] PatientID QR image added --- lib/widgets/drawer/app_drawer_widget.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index f16e3cbc..9320182d 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -157,6 +157,10 @@ class _AppDrawerState extends State { height: 1, ), ), + mHeight(20.0), + (user != null && projectProvider.isLogin) + ? Image.network("https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${user.patientID.toString()}", fit: BoxFit.fill, height: 73.5, width: 73.5) + : Container(), ], ), ), @@ -222,7 +226,7 @@ class _AppDrawerState extends State { builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return Padding(padding: EdgeInsets.all(10), child:CircularProgressIndicator()); + return Padding(padding: EdgeInsets.all(10), child: CircularProgressIndicator()); default: if (snapshot.hasError) return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error)); From 0588e68c67015e4801fc797dba82709b7701ead7 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Wed, 15 May 2024 10:36:08 +0300 Subject: [PATCH 5/6] local Auth fix --- lib/pages/login/confirm-login.dart | 477 ++++++++++++++++------------- pubspec.yaml | 2 +- 2 files changed, 260 insertions(+), 219 deletions(-) diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index e773957a..d9f2d614 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -40,18 +40,17 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -import 'package:local_auth_ios/local_auth_ios.dart'; +import 'package:local_auth_darwin/types/auth_messages_ios.dart'; class ConfirmLogin extends StatefulWidget { final Function? changePageViewIndex; final fromRegistration; final bool isDubai; - const ConfirmLogin( - {Key? key, - this.changePageViewIndex, - this.fromRegistration = false, - this.isDubai = false}) + const ConfirmLogin({Key? key, + this.changePageViewIndex, + this.fromRegistration = false, + this.isDubai = false}) : super(key: key); @override @@ -65,7 +64,7 @@ class _ConfirmLogin extends State { bool authenticated = false; final authService = AuthProvider(); PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + locator(); late int mobileNumber; String errorMsg = ''; SelectDeviceIMEIRES? user; @@ -96,9 +95,9 @@ class _ConfirmLogin extends State { int fingrePrintBefore = 0; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); AppointmentRateViewModel appointmentRateViewModel = - locator(); + locator(); late ProjectViewModel projectViewModel; late ToDoCountProviderModel toDoProvider; @@ -145,7 +144,9 @@ class _ConfirmLogin extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).welcomeBack, + TranslationBase + .of(context) + .welcomeBack, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, @@ -163,7 +164,9 @@ class _ConfirmLogin extends State { ), SizedBox(height: 10), Text( - TranslationBase.of(context).accountInfo, + TranslationBase + .of(context) + .accountInfo, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -189,11 +192,12 @@ class _ConfirmLogin extends State { children: [ Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - TranslationBase.of(context) + TranslationBase + .of(context) .lastLoginAt .toCamelCase, style: TextStyle( @@ -208,8 +212,8 @@ class _ConfirmLogin extends State { // : user!.createdOn != null ? DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - user!.createdOn!)) + DateUtil.convertStringToDate( + user!.createdOn!)) : '--', style: TextStyle( fontSize: 12, @@ -221,11 +225,12 @@ class _ConfirmLogin extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - TranslationBase.of(context) + TranslationBase + .of(context) .lastLoginWith .toCamelCase, style: TextStyle( @@ -252,9 +257,9 @@ class _ConfirmLogin extends State { // : user!.createdOn != null ? DateUtil.formatDateToTimeLang( - DateUtil.convertStringToDate( - user!.createdOn!), - false) + DateUtil.convertStringToDate( + user!.createdOn!), + false) : '--', style: TextStyle( fontSize: 12, @@ -268,7 +273,9 @@ class _ConfirmLogin extends State { ), ), Text( - TranslationBase.of(context).pleaseVerify, + TranslationBase + .of(context) + .pleaseVerify, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -277,10 +284,10 @@ class _ConfirmLogin extends State { ), GridView( gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 13, - mainAxisSpacing: 9), + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 13, + mainAxisSpacing: 9), physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(top: 9), shrinkWrap: true, @@ -306,27 +313,32 @@ class _ConfirmLogin extends State { SizedBox(height: 23), this.onlySMSBox == false ? Text( - TranslationBase.of(context).verifyLoginWith, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.64, - height: 25 / 16), - ) + TranslationBase + .of(context) + .verifyLoginWith, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 25 / 16), + ) : Text( - TranslationBase.of(context) - .verifyFingerprint2, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.64, - height: 25 / 16), - ), + TranslationBase + .of(context) + .verifyFingerprint2, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 25 / 16), + ), SizedBox(height: 23), Text( - TranslationBase.of(context).pleaseVerify, + TranslationBase + .of(context) + .pleaseVerify, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -335,10 +347,10 @@ class _ConfirmLogin extends State { ), GridView( gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 13, - mainAxisSpacing: 9), + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 13, + mainAxisSpacing: 9), physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(top: 9), shrinkWrap: true, @@ -357,8 +369,10 @@ class _ConfirmLogin extends State { height: 12, ), DefaultButton( - TranslationBase.of(context).useAnotherAccount, - () { + TranslationBase + .of(context) + .useAnotherAccount, + () { Navigator.of(context).pushNamed(LOGIN_TYPE); projectViewModel.analytics.loginRegistration .login_with_other_account(); @@ -450,22 +464,23 @@ class _ConfirmLogin extends State { sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); authService .checkPatientAuthentication(request) - .then((value) => { - GifLoaderDialogUtils.hideDialog(context), - if (value['isSMSSent']) - { - sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), - this.loginTokenID = value['LogInTokenID'], - sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), - // Future.delayed(Duration(seconds: 1), () { - this.sendActivationCode(type) - // }) - } - else - { - if (value['IsAuthenticated']) {this.checkActivationCode()} - } - }) + .then((value) => + { + GifLoaderDialogUtils.hideDialog(context), + if (value['isSMSSent']) + { + sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), + this.loginTokenID = value['LogInTokenID'], + sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), + // Future.delayed(Duration(seconds: 1), () { + this.sendActivationCode(type) + // }) + } + else + { + if (value['IsAuthenticated']) {this.checkActivationCode()} + } + }) .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); @@ -516,10 +531,11 @@ class _ConfirmLogin extends State { context, type, this.mobileNumber, - (value) { + (value) { this.checkActivationCode(value: value); }, - () => { + () => + { Navigator.pop(context), }, ).displayDialog(context); @@ -611,12 +627,12 @@ class _ConfirmLogin extends State { this.zipCode = this.registerd_data != null ? this.registerd_data.zipCode : this.user!.outSA == true - ? "971" - : "966"; + ? "971" + : "966"; this.patientOutSA = this.registerd_data != null ? this.registerd_data.zipCode == "966" - ? 0 - : 1 + ? 0 + : 1 : this.user!.outSA; if (this.registerd_data != null) { this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); @@ -637,8 +653,8 @@ class _ConfirmLogin extends State { this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : user != null - ? user!.logInType - : null; + ? user!.logInType + : null; showLoader(false); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); @@ -652,7 +668,7 @@ class _ConfirmLogin extends State { request.projectOutSA = this.patientOutSA == true ? true : false; request.loginType = this.selectedOption; request.oTPSendType = - type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; + type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; request.zipCode = this.zipCode; request.logInTokenID = this.loginTokenID ?? ""; @@ -665,17 +681,17 @@ class _ConfirmLogin extends State { ? this.registerd_data.patientID : 0; request.patientIdentificationID = request.nationalID = - this.registerd_data.patientIdentificationID != null - ? this.registerd_data.patientIdentificationID - : '0'; + this.registerd_data.patientIdentificationID != null + ? this.registerd_data.patientIdentificationID + : '0'; request.dob = this.registerd_data.dob; request.isRegister = this.registerd_data.isRegister; } else { request.searchType = request.searchType != null ? request.searchType : 2; request.patientID = - this.user!.patientID != null ? this.user!.patientID : 0; + this.user!.patientID != null ? this.user!.patientID : 0; request.nationalID = - request.nationalID != null ? request.nationalID : '0'; + request.nationalID != null ? request.nationalID : '0'; request.patientIdentificationID = request.patientIdentificationID != null ? request.patientIdentificationID : '0'; @@ -699,39 +715,40 @@ class _ConfirmLogin extends State { authService .checkActivationCodeRegister(request, value) - .then((result) => { - res = result, - if (result is Map) - { - result = CheckActivationCode.fromJson( - result as Map), - if (this.registerd_data != null && - this.registerd_data.isRegister == true) - { - // if(widget.isDubai ==false){ - widget.changePageViewIndex!(1), - // if(widget.isDubai ==false){ - - Navigator.popUntil( - context, - (route) => - Utils.route(route, equalsTo: RegisterNew)), - } - } - else - { - // Navigator.of(context).pop(), - GifLoaderDialogUtils.hideDialog(context), - Future.delayed(Duration(seconds: 1), () { - AppToast.showErrorToast(message: result); - }), - projectViewModel.analytics.loginRegistration - .login_fail(error: result), - projectViewModel.analytics.errorTracking.log( - 'otp_verification_at_confirm_login', - error: result), - } - }) + .then((result) => + { + res = result, + if (result is Map) + { + result = CheckActivationCode.fromJson( + result as Map), + if (this.registerd_data != null && + this.registerd_data.isRegister == true) + { + // if(widget.isDubai ==false){ + widget.changePageViewIndex!(1), + // if(widget.isDubai ==false){ + + Navigator.popUntil( + context, + (route) => + Utils.route(route, equalsTo: RegisterNew)), + } + } + else + { + // Navigator.of(context).pop(), + GifLoaderDialogUtils.hideDialog(context), + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: result); + }), + projectViewModel.analytics.loginRegistration + .login_fail(error: result), + projectViewModel.analytics.errorTracking.log( + 'otp_verification_at_confirm_login', + error: result), + } + }) .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); @@ -743,58 +760,59 @@ class _ConfirmLogin extends State { } else { authService .checkActivationCode(request, value) - .then((result) => { - res = result, - if (result is Map) - { - result = CheckActivationCode.fromJson( - result as Map), - if (this.registerd_data != null && - this.registerd_data.isRegister == true) - { - widget.changePageViewIndex!(1), - Navigator.popUntil( - context, - (route) => - Utils.route(route, equalsTo: RegisterNew)), - } - else - { - sharedPref.remove(FAMILY_FILE), - result.list.isFamily = false, - userData = result.list, - sharedPref.setString( - BLOOD_TYPE, result.patientBloodType ?? "O+"), - //Remove o+ from here Added by Aamir - authenticatedUserObject.user = result.list, - projectViewModel.setPrivilege(privilegeList: res), - sharedPref.setObject(MAIN_USER, result.list), - sharedPref.setObject(USER_PROFILE, result.list), - loginTokenID = result.logInTokenID, - sharedPref.setObject( - LOGIN_TOKEN_ID, result.logInTokenID), - sharedPref.setString( - TOKEN, result.authenticationTokenID), - projectViewModel.analytics.loginRegistration - .login_successful(), - checkIfUserAgreedBefore(result), - } - } - else - { - // Navigator.of(context).pop(), - GifLoaderDialogUtils.hideDialog(context), - Future.delayed(Duration(seconds: 1), () { - AppToast.showErrorToast(message: result); - startSMSService(tempType); - }), - - projectViewModel.analytics.loginRegistration - .login_fail(error: result), - projectViewModel.analytics.errorTracking - .log('otp_verification_at_confirm_login', error: result) - } - }) + .then((result) => + { + res = result, + if (result is Map) + { + result = CheckActivationCode.fromJson( + result as Map), + if (this.registerd_data != null && + this.registerd_data.isRegister == true) + { + widget.changePageViewIndex!(1), + Navigator.popUntil( + context, + (route) => + Utils.route(route, equalsTo: RegisterNew)), + } + else + { + sharedPref.remove(FAMILY_FILE), + result.list.isFamily = false, + userData = result.list, + sharedPref.setString( + BLOOD_TYPE, result.patientBloodType ?? "O+"), + //Remove o+ from here Added by Aamir + authenticatedUserObject.user = result.list, + projectViewModel.setPrivilege(privilegeList: res), + sharedPref.setObject(MAIN_USER, result.list), + sharedPref.setObject(USER_PROFILE, result.list), + loginTokenID = result.logInTokenID, + sharedPref.setObject( + LOGIN_TOKEN_ID, result.logInTokenID), + sharedPref.setString( + TOKEN, result.authenticationTokenID), + projectViewModel.analytics.loginRegistration + .login_successful(), + checkIfUserAgreedBefore(result), + } + } + else + { + // Navigator.of(context).pop(), + GifLoaderDialogUtils.hideDialog(context), + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: result); + startSMSService(tempType); + }), + + projectViewModel.analytics.loginRegistration + .login_fail(error: result), + projectViewModel.analytics.errorTracking + .log('otp_verification_at_confirm_login', error: result) + } + }) .catchError((err) { GifLoaderDialogUtils.hideDialog(context); Future.delayed(Duration(seconds: 1), () { @@ -888,28 +906,29 @@ class _ConfirmLogin extends State { getToDoCount(); appointmentRateViewModel .getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2) - .then((value) => { - GifLoaderDialogUtils.hideDialog(AppGlobal.context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - (r) => false) - } - else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - }, - insertIMEI() - }) + .then((value) => + { + GifLoaderDialogUtils.hideDialog(AppGlobal.context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + }, + insertIMEI() + }) .catchError((err) { print(err); }); @@ -931,28 +950,27 @@ class _ConfirmLogin extends State { }); } - Widget _loginOptionButton( - String _title, String _icon, int _flag, int? _loginIndex) { + Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { bool isDisable = - (_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) || + (_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) || + _flag == 2 && + !checkIfBiometricAvailable(BiometricType.fingerprint) && _flag == 2 && - !checkIfBiometricAvailable(BiometricType.fingerprint) && - _flag == 2 && - !checkIfBiometricAvailable(BiometricType.strong)); + !checkIfBiometricAvailable(BiometricType.strong)); return InkWell( onTap: isDisable ? null : () { - if (_flag == 0) { - setState(() { - isMoreOption = true; - }); - } else { - authenticateUser(_flag, isActive: _loginIndex); - projectViewModel.analytics.loginRegistration.verify_otp_method( - forRegistration: widget.fromRegistration); - } - }, + if (_flag == 0) { + setState(() { + isMoreOption = true; + }); + } else { + authenticateUser(_flag, isActive: _loginIndex); + projectViewModel.analytics.loginRegistration.verify_otp_method( + forRegistration: widget.fromRegistration); + } + }, child: Container( padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), decoration: BoxDecoration( @@ -974,7 +992,9 @@ class _ConfirmLogin extends State { color: isDisable ? Color(0xff2B353E).withOpacity(0.7) : null, ), Text( - TranslationBase.of(context).verifyThrough + " " + _title, + TranslationBase + .of(context) + .verifyThrough + " " + _title, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -994,23 +1014,31 @@ class _ConfirmLogin extends State { Widget getButton(int flag) { switch (flag) { case 4: - return _loginOptionButton(TranslationBase.of(context).verifyWhatsApp, + return _loginOptionButton(TranslationBase + .of(context) + .verifyWhatsApp, 'assets/images/new/verify_whatsapp.svg', flag, null); break; case 1: - return _loginOptionButton(TranslationBase.of(context).verifySMS, + return _loginOptionButton(TranslationBase + .of(context) + .verifySMS, 'assets/images/new/verify_sms.svg', flag, null); break; case 2: return _loginOptionButton( - TranslationBase.of(context).verifyFingerprint, + TranslationBase + .of(context) + .verifyFingerprint, 'assets/images/new/verify_thumb.svg', flag, BiometricType.fingerprint.index); break; case 3: return _loginOptionButton( - TranslationBase.of(context).verifyFaceID, + TranslationBase + .of(context) + .verifyFaceID, 'assets/images/new/verify_face.svg', flag, BiometricType.face.index); @@ -1018,7 +1046,8 @@ class _ConfirmLogin extends State { default: return InkWell( - onTap: () => { + onTap: () => + { setState(() { isMoreOption = true; }) @@ -1041,12 +1070,14 @@ class _ConfirmLogin extends State { ), projectViewModel.isArabic ? SizedBox( - height: 15, - ) + height: 15, + ) : SizedBox( - height: 20, - ), - Texts(TranslationBase.of(context).moreVerification, + height: 20, + ), + Texts(TranslationBase + .of(context) + .moreVerification, fontSize: SizeConfig.textMultiplier! * 1.8, textAlign: TextAlign.center, color: Colors.black) @@ -1061,19 +1092,29 @@ class _ConfirmLogin extends State { getType(type, context) { switch (type) { case 1: - return TranslationBase.of(context).verifySMS; + return TranslationBase + .of(context) + .verifySMS; break; case 2: - return TranslationBase.of(context).verifyFingerprint; + return TranslationBase + .of(context) + .verifyFingerprint; break; case 3: - return TranslationBase.of(context).verifyFaceID; + return TranslationBase + .of(context) + .verifyFaceID; break; case 4: - return TranslationBase.of(context).verifyWhatsApp; + return TranslationBase + .of(context) + .verifyWhatsApp; break; default: - return TranslationBase.of(context).verifySMS; + return TranslationBase + .of(context) + .verifySMS; break; } } diff --git a/pubspec.yaml b/pubspec.yaml index 8dfd227a..1c48b1f5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,7 +51,7 @@ dependencies: pull_to_refresh: ^2.0.0 # Native - local_auth: ^2.1.7 + local_auth: ^2.2.0 localstorage: ^4.0.0+1 maps_launcher: ^2.0.1 url_launcher: ^6.0.15 From 29c2fd067ee10942b2ddbc3ee8c070d62a98d434 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Wed, 15 May 2024 10:55:13 +0300 Subject: [PATCH 6/6] Null fixes after merge from 3.13 --- ...et_dental_instructions_response_model.dart | 26 +++++++++---------- .../medical/dental_instructions_page.dart | 8 +++--- .../medical/medical_profile_page_new.dart | 10 +++---- lib/uitl/utils.dart | 10 +++---- .../dialogs/radio_selection_dialog.dart | 4 +-- lib/widgets/drawer/app_drawer_widget.dart | 4 +-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/models/get_dental_instructions_response_model.dart b/lib/models/get_dental_instructions_response_model.dart index 6f2f8621..97ed424c 100644 --- a/lib/models/get_dental_instructions_response_model.dart +++ b/lib/models/get_dental_instructions_response_model.dart @@ -1,7 +1,7 @@ class GetDentalInstructionsResponseModel { - List data; + List? data; dynamic message; - int status; + int? status; GetDentalInstructionsResponseModel({this.data, this.message, this.status}); @@ -9,7 +9,7 @@ class GetDentalInstructionsResponseModel { if (json['Data'] != null) { data = []; json['Data'].forEach((v) { - data.add(new Data.fromJson(v)); + data!.add(new Data.fromJson(v)); }); } message = json['message']; @@ -19,7 +19,7 @@ class GetDentalInstructionsResponseModel { Map toJson() { final Map data = new Map(); if (this.data != null) { - data['Data'] = this.data.map((v) => v.toJson()).toList(); + data['Data'] = this.data!.map((v) => v.toJson()).toList(); } data['message'] = this.message; data['status'] = this.status; @@ -28,15 +28,15 @@ class GetDentalInstructionsResponseModel { } class Data { - String createdOn; - String mobileNo; - int patientId; - int procedureId; - int projectId; - String setupId; - String smsContent; - int sourceReferenceNo; - String sourceType; + String? createdOn; + String? mobileNo; + int? patientId; + int? procedureId; + int? projectId; + String? setupId; + String? smsContent; + int? sourceReferenceNo; + String? sourceType; Data( {this.createdOn, diff --git a/lib/pages/medical/dental_instructions_page.dart b/lib/pages/medical/dental_instructions_page.dart index a704d620..133165d7 100644 --- a/lib/pages/medical/dental_instructions_page.dart +++ b/lib/pages/medical/dental_instructions_page.dart @@ -16,7 +16,7 @@ class DentalInstructionsPage extends StatefulWidget { } class _DentalInstructionsPageState extends State { - GetDentalInstructionsResponseModel getDentalInstructionsResponseModel; + GetDentalInstructionsResponseModel? getDentalInstructionsResponseModel; @override void initState() { @@ -41,15 +41,15 @@ class _DentalInstructionsPageState extends State { padding: const EdgeInsets.all(16.0), child: Column( children: [ - getDentalInstructionsResponseModel != null && getDentalInstructionsResponseModel.data.isNotEmpty + getDentalInstructionsResponseModel != null && getDentalInstructionsResponseModel!.data!.isNotEmpty ? ListView.builder( - itemCount: getDentalInstructionsResponseModel.data.length, + itemCount: getDentalInstructionsResponseModel!.data!.length, shrinkWrap: true, itemBuilder: (context, index) { return Padding( padding: EdgeInsets.only(top: 16.0, bottom: 16.0), child: Text( - getDentalInstructionsResponseModel.data[index].smsContent, + getDentalInstructionsResponseModel!.data![index].smsContent!, style: TextStyle( fontSize: 14.0, letterSpacing: -0.56, diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index 376c924a..55b6a4c6 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -33,14 +33,14 @@ class _MedicalProfilePageState extends State { ProjectViewModel? projectViewModel; List projectsList = []; - HospitalsModel _selectedHospital; + HospitalsModel? _selectedHospital; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); List myMedicalList = - Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin, onWeCareClick: openWeCareProjectSelection); + Utils.myMedicalList(projectViewModel: projectViewModel!, context: context, count: appoCountProvider.count, isLogin: projectViewModel!.isLogin, onWeCareClick: openWeCareProjectSelection); return BaseView( onModelReady: (model) => model.getAppointmentHistory(isForTimeLine: true), builder: (_, model, widget1) => AppScaffold( @@ -113,7 +113,7 @@ class _MedicalProfilePageState extends State { openWeCareProjectSelection() { int _selectedHospitalIndex = -1; - int languageID = projectViewModel.isArabic ? 1 : 2; + int languageID = projectViewModel!.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); List projectsListLocal = []; @@ -127,7 +127,7 @@ class _MedicalProfilePageState extends State { }); GifLoaderDialogUtils.hideDialog(context); List list = [ - for (int i = 0; i < projectsList.length; i++) RadioSelectionDialogModel(projectsList[i].name + ' ${projectsList[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + for (int i = 0; i < projectsList.length; i++) RadioSelectionDialogModel(projectsList[i].name! + ' ${projectsList[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), ]; showDialog( context: context, @@ -139,7 +139,7 @@ class _MedicalProfilePageState extends State { onValueSelected: (index) { _selectedHospitalIndex = index; _selectedHospital = projectsList[index]; - openWeCareURL(_selectedHospital.iD); + openWeCareURL(_selectedHospital!.iD); // setState(() {}); }, ), diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 55431476..8d4eaf50 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -222,11 +222,11 @@ class Utils { return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email); } - static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count, Function onWeCareClick}) { + static List myMedicalList({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count, Function? onWeCareClick}) { List medical = []; medical.add(InkWell( - onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null, + onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null, child: isLogin! ? Stack(children: [ Container( @@ -235,12 +235,12 @@ class Utils { child: MedicalProfileItem( title: TranslationBase.of(context!).myAppointments, imagePath: 'appointment_list.svg', - subTitle: TranslationBase.of(context!).myAppointmentsList, + subTitle: TranslationBase.of(context).myAppointmentsList, hasBadge: true, isEnable: projectViewModel!.havePrivilege(5)), ), projectViewModel.isArabic - ? !projectViewModel.user!.isFamily + ? !projectViewModel.user.isFamily ? Positioned( left: 8, top: 4, @@ -384,7 +384,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => onWeCareClick(), + onTap: () => onWeCareClick!(), child: MedicalProfileItem( title: TranslationBase.of(context).wecare, imagePath: 'assets/images/new-design/virtual_tour_icon.png', diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 2a4178b7..7776425b 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -17,7 +17,7 @@ class RadioSelectionDialog extends StatefulWidget { final bool? isShowSearch; final String? buttonText; - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false, this.buttonText = ""}) : super(key: key); + const RadioSelectionDialog({Key? key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false, this.buttonText = ""}) : super(key: key); @override State createState() => new RadioSelectionDialogState(); @@ -165,7 +165,7 @@ class RadioSelectionDialogState extends State { children: [ Expanded( child: DefaultButton( - widget.buttonText.isNotEmpty ? widget.buttonText : TranslationBase.of(context).save, + widget.buttonText!.isNotEmpty ? widget.buttonText! : TranslationBase.of(context).save, () { Navigator.pop(context); widget.onValueSelected!(selectedIndex); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index f75517bd..84fdb2bf 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -156,8 +156,8 @@ class _AppDrawerState extends State { ), ), mHeight(20.0), - (user != null && projectProvider.isLogin) - ? Image.network("https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${user.patientID.toString()}", fit: BoxFit.fill, height: 73.5, width: 73.5) + (user != null && projectProvider!.isLogin) + ? Image.network("https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${user!.patientID.toString()}", fit: BoxFit.fill, height: 73.5, width: 73.5) : Container(), ], ),