diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index fc5a17ed..c3b69282 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -173,7 +173,7 @@ class BaseAppClient { onFailure!('Error While Fetching data', statusCode); logApiEndpointError(endPoint, 'Error While Fetching data', statusCode); } else { - var decoded = utf8.decode(response.bodyBytes); + // var decoded = utf8.decode(response.bodyBytes); var parsed = json.decode(utf8.decode(response.bodyBytes)); // print("Response: $parsed"); diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index 56056216..eeaab422 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -20,25 +20,21 @@ class AmRequestViewModel extends BaseViewModel { HospitalService _hospitalService = locator(); MedicalService _medicalService = locator(); - List get amRequestModeList => - _amService.amModelList; + List get amRequestModeList => _amService.amModelList; - List get patientAllPresOrdersList => - _amService.patientAllPresOrdersList; + List get patientAllPresOrdersList => _amService.patientAllPresOrdersList; - List get appoitmentAllHistoryResultList => - _medicalService.appoitmentAllHistoryResultList; + List get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList; - List get patientAmbulanceRequestOrdersList => - _amService.patientAmbulanceRequestOrdersList; + List get patientAmbulanceRequestOrdersList => _amService.patientAmbulanceRequestOrdersList; List get hospitals => _hospitalService.hospitals; - bool get hasPendingOrder =>_amService.hasPendingOrder; + bool get hasPendingOrder => _amService.hasPendingOrder; - PickUpRequestPresOrder get pickUpRequestPresOrder =>_amService.pickUpRequestPresOrder!; + PickUpRequestPresOrder? get pickUpRequestPresOrder => _amService.pickUpRequestPresOrder; - AmbulanceRequestOrdersModel get pendingAmbulanceRequestOrder =>_amService.pendingAmbulanceRequestOrder!; + AmbulanceRequestOrdersModel? get pendingAmbulanceRequestOrder => _amService.pendingAmbulanceRequestOrder; Future getAppointmentHistory() async { setState(ViewState.BusyLocal); @@ -114,7 +110,7 @@ class AmRequestViewModel extends BaseViewModel { getPatientAllPresOrdersListRC(); } - Future insertERPressOrder({required PatientER_RC patientER}) async { + Future insertERPressOrder({required PatientER_RC patientER}) async { setState(ViewState.Busy); await _amService.insertERPressOrder(patientER: patientER); if (_amService.hasError) { diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index bd3f4f93..e936ae71 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -17,31 +17,24 @@ class PharmacyCategoriseViewModel extends BaseViewModel { int inPatientPageSize = 20; int lastSubsetIndex = 20; - List filteredInPatientItems =[]; - List filteredMyInPatientItems =[]; + List filteredInPatientItems = []; + List filteredMyInPatientItems = []; - PharmacyCategoriseService _pharmacyCategoriseService = - locator(); + PharmacyCategoriseService _pharmacyCategoriseService = locator(); - List get categorise => - _pharmacyCategoriseService.categoriseList; + List get categorise => _pharmacyCategoriseService.categoriseList; - List get categoriseParent => - _pharmacyCategoriseService.parentCategoriseList; + List get categoriseParent => _pharmacyCategoriseService.parentCategoriseList; - List get parentProducts => - _pharmacyCategoriseService.parentProductsList; + List get parentProducts => _pharmacyCategoriseService.parentProductsList; - List get subCategorise => - _pharmacyCategoriseService.subCategoriseList; + List get subCategorise => _pharmacyCategoriseService.subCategoriseList; - List get subProducts => - _pharmacyCategoriseService.subProductsList; + List get subProducts => _pharmacyCategoriseService.subProductsList; - List get finalProducts => - _pharmacyCategoriseService.finalProducts; - List get brandsList => - _pharmacyCategoriseService.brandsList; + List get finalProducts => _pharmacyCategoriseService.finalProducts; + + List get brandsList => _pharmacyCategoriseService.brandsList; List get searchList => _pharmacyCategoriseService.searchList; @@ -99,8 +92,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getCategoriseParent( - {String? i, int? pageIndex, bool? isLoading, BuildContext? context}) async { + Future getCategoriseParent({String? i, int? pageIndex, bool? isLoading, BuildContext? context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -111,19 +103,16 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else await getBrands(id: i); - await getParentProducts( - i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); + await getParentProducts(i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); // GifLoaderDialogUtils.showMyDialog(context); } - Future getParentProducts( - {String? i, int? pageIndex, bool? isLoading, BuildContext? context}) async { + Future getParentProducts({String? i, int? pageIndex, bool? isLoading, BuildContext? context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.BusyLocal); GifLoaderDialogUtils.showMyDialog(context!); - await _pharmacyCategoriseService.getParentProducts( - id: i, pageNumber: pageIndex, isLoading: isLoading!); + await _pharmacyCategoriseService.getParentProducts(id: i, pageNumber: pageIndex, isLoading: isLoading!); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error!; setState(ViewState.ErrorLocal); @@ -132,11 +121,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel { GifLoaderDialogUtils.hideDialog(context); } - Future getSubCategorise( - {String? i, - int? pageIndex, - bool isLoading = false, - BuildContext? context}) async { + Future getSubCategorise({String? i, int? pageIndex, bool isLoading = false, BuildContext? context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -147,21 +132,15 @@ class PharmacyCategoriseViewModel extends BaseViewModel { error = _pharmacyCategoriseService.error!; setState(ViewState.ErrorLocal); } else - getSubProducts( - i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); + getSubProducts(i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); } - Future getSubProducts( - {String? i, - int? pageIndex, - bool isLoading = false, - BuildContext? context}) async { + Future getSubProducts({String? i, int? pageIndex, bool isLoading = false, BuildContext? context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.BusyLocal); GifLoaderDialogUtils.showMyDialog(context!); - await _pharmacyCategoriseService.getSubProducts( - id: i, pageIndex: pageIndex, isLoading: isLoading); + await _pharmacyCategoriseService.getSubProducts(id: i, pageIndex: pageIndex, isLoading: isLoading); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error!; setState(ViewState.ErrorLocal); @@ -182,13 +161,11 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getFilteredProducts( - {String? categoryId, String? brandId, String? min, String? max}) async { + Future getFilteredProducts({String? categoryId, String? brandId, String? min, String? max}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _pharmacyCategoriseService.getFilteredProducts( - categoryId: categoryId, brandId: brandId, max: max, min: min); + await _pharmacyCategoriseService.getFilteredProducts(categoryId: categoryId, brandId: brandId, max: max, min: min); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error!; setState(ViewState.ErrorLocal); @@ -196,13 +173,11 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getFilteredSubProducts( - {String? categoryId, String? brandId, String? min, String? max}) async { + Future getFilteredSubProducts({String? categoryId, String? brandId, String? min, String? max}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _pharmacyCategoriseService.getFilteredSubProducts( - categoryId: categoryId, brandId: brandId, max: max, min: min); + await _pharmacyCategoriseService.getFilteredSubProducts(categoryId: categoryId, brandId: brandId, max: max, min: min); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error!; setState(ViewState.ErrorLocal); @@ -267,16 +242,9 @@ class PharmacyCategoriseViewModel extends BaseViewModel { addOnFilteredList() { if (lastSubsetIndex < parentProducts.length) { - firstSubsetIndex = firstSubsetIndex + - (parentProducts.length - lastSubsetIndex < inPatientPageSize - 1 - ? parentProducts.length - lastSubsetIndex - : inPatientPageSize - 1); - lastSubsetIndex = lastSubsetIndex + - (parentProducts.length - lastSubsetIndex < inPatientPageSize - 1 - ? parentProducts.length - lastSubsetIndex - : inPatientPageSize - 1); - filteredInPatientItems - .addAll(parentProducts.sublist(firstSubsetIndex, lastSubsetIndex)); + firstSubsetIndex = firstSubsetIndex + (parentProducts.length - lastSubsetIndex < inPatientPageSize - 1 ? parentProducts.length - lastSubsetIndex : inPatientPageSize - 1); + lastSubsetIndex = lastSubsetIndex + (parentProducts.length - lastSubsetIndex < inPatientPageSize - 1 ? parentProducts.length - lastSubsetIndex : inPatientPageSize - 1); + filteredInPatientItems.addAll(parentProducts.sublist(firstSubsetIndex, lastSubsetIndex)); setState(ViewState.Idle); } } diff --git a/lib/models/Authentication/select_device_imei_res.dart b/lib/models/Authentication/select_device_imei_res.dart index 41734165..4b6ae33e 100644 --- a/lib/models/Authentication/select_device_imei_res.dart +++ b/lib/models/Authentication/select_device_imei_res.dart @@ -48,7 +48,7 @@ class SelectDeviceIMEIRES { } Map toJson() { - final Map data = new Map(); + final Map data = Map(); data['BiometricEnabled'] = this.biometricEnabled; data['CreatedOn'] = this.createdOn; data['EditedOn'] = this.editedOn; diff --git a/lib/models/ambulanceRequest/locationDetails.dart b/lib/models/ambulanceRequest/locationDetails.dart index 6ed86ca3..6971da33 100644 --- a/lib/models/ambulanceRequest/locationDetails.dart +++ b/lib/models/ambulanceRequest/locationDetails.dart @@ -15,9 +15,9 @@ class LocationDetails { _long = long; } - String get formattedAddress => _formattedAddress!; + String? get formattedAddress => _formattedAddress; - set formattedAddress(String formattedAddress) { + set formattedAddress(String? formattedAddress) { _formattedAddress = formattedAddress; } } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 09170c2c..ebc290ce 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; @@ -213,7 +214,7 @@ class _BookConfirmState extends State { elevation: 0, onPressed: () async { bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false; - if (isLiveCareSchedule != null && isLiveCareSchedule) { + if (isLiveCareSchedule) { insertLiveCareScheduledAppointment(context, widget.doctor); } else { insertAppointment(context, widget.doctor, widget.initialSlotDuration); @@ -273,7 +274,7 @@ class _BookConfirmState extends State { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { - print(err); + logger.d(err); GifLoaderDialogUtils.hideDialog(context); }); } @@ -372,9 +373,9 @@ class _BookConfirmState extends State { dialog.showAlertDialog(context); } }).catchError((err) { + logger.d(err); GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); - print(err); }); projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot!, doctor: widget.doctor); } diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index ccbe023a..6fdbc954 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -336,6 +336,7 @@ class _DoctorProfileState extends State with TickerProviderStateM child: RatingBar( itemSize: 20.0, allowHalfRating: true, + ignoreGestures: true, initialRating: this.widget.doctor.actualDoctorRate!.toDouble(), ratingWidget: RatingWidget( full: Icon( diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index b3e41923..b69a746a 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -40,9 +40,9 @@ class SearchByClinic extends StatefulWidget { class _SearchByClinicState extends State { bool nearestAppo = false; - String dropdownValue = ""; + String? dropdownValue; String dropdownTitle = ""; - String projectDropdownValue = ""; + String? projectDropdownValue; // var event = RobotProvider(); List clinicsList = []; @@ -51,8 +51,8 @@ class _SearchByClinicState extends State { bool isLoaded = false; bool isProjectLoaded = false; - ListClinicCentralized selectedClinic = ListClinicCentralized(); - HospitalsModel selectedHospital = HospitalsModel(); + ListClinicCentralized? selectedClinic; + HospitalsModel? selectedHospital; AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); @@ -78,7 +78,7 @@ class _SearchByClinicState extends State { projectViewModel = Provider.of(context); if (projectViewModel.isLogin) { if (radioValue == null) { - if (projectViewModel.user!.gender == 1) { + if (projectViewModel.user.gender == 1) { radioValue = TranslationBase.of(context).male; } else { radioValue = TranslationBase.of(context).female; @@ -317,26 +317,26 @@ class _SearchByClinicState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( key: projectDropdownKey, - hint: new Text(TranslationBase.of(context).selectHospital), + hint: Text(TranslationBase.of(context).selectHospital), value: selectedHospital, iconSize: 0, isExpanded: true, style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), - items: projectsList.map((item) { - return DropdownMenuItem( + items: projectsList.map((HospitalsModel item) { + return DropdownMenuItem( value: item, - child: Text(item.name!), + child: Text('${item.name!}'), ); }).toList(), - onChanged: (newValue) async { + onChanged: (HospitalsModel? newValue) async { setState(() { - selectedHospital = HospitalsModel.fromJson(newValue!.toJson()); + HospitalsModel tempselectedHospital = new HospitalsModel.fromJson(newValue!.toJson()); projectDropdownValue = newValue.mainProjectID.toString(); - if (dropdownValue.split("-")[0] == "253") { + if (dropdownValue!.split("-")[0] == "253") { Navigator.push( context, FadePage( - page: LaserClinic(selectedHospital: selectedHospital), + page: LaserClinic(selectedHospital: tempselectedHospital!), ), ); } else { @@ -489,7 +489,7 @@ class _SearchByClinicState extends State { bool isDentalSelectedAndSupported() { if (dropdownValue != null) - return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" || dropdownValue.split("-")[0] == "253") && isMobileAppDentalAllow; + return dropdownValue != "" && (dropdownValue!.split("-")[0] == "17" || dropdownValue!.split("-")[0] == "253") && isMobileAppDentalAllow; else return false; } @@ -555,15 +555,15 @@ class _SearchByClinicState extends State { // TODO Mosa_REMARk to come back later getDoctorsList(BuildContext context) { SearchInfo searchInfo = new SearchInfo(); - if (dropdownValue != null) if (dropdownValue.split("-")[0] == "17") { - searchInfo.ProjectID = int.parse(projectDropdownValue); - searchInfo.ClinicID = int.parse(dropdownValue.split("-")[0]); + if (dropdownValue != null) if (dropdownValue!.split("-")[0] == "17") { + searchInfo.ProjectID = int.parse(projectDropdownValue!); + searchInfo.ClinicID = int.parse(dropdownValue!.split("-")[0]); searchInfo.hospital = selectedHospital; searchInfo.clinic = selectedClinic; searchInfo.date = DateTime.now(); if (projectViewModel.isLogin) { - if (projectViewModel.user!.age! > 12) { + if (projectViewModel.user.age! > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); @@ -571,17 +571,17 @@ class _SearchByClinicState extends State { } else { navigateToDentalComplaints(context, searchInfo); } - } else if (dropdownValue.split("-")[0] == "253") { + } else if (dropdownValue!.split("-")[0] == "253") { navigateToLaserClinic(context); // callDoctorsSearchAPI(); - } else if (dropdownValue.split("-")[1] == "true" + } else if (dropdownValue!.split("-")[1] == "true" // && authProvider.isLogin && // authUser.patientType == 1 ) { Navigator.push( context, FadePage( - page: LiveCareBookAppointment(clinicName: dropdownTitle, liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]), + page: LiveCareBookAppointment(clinicName: dropdownTitle, liveCareClinicID: dropdownValue!.split("-")[2], liveCareServiceID: dropdownValue!.split("-")[3]), ), ).then((value) { setState(() { @@ -591,11 +591,11 @@ class _SearchByClinicState extends State { Navigator.push(context, FadePage(page: LiveCareHome())); } if (value == "schedule") { - callDoctorsSearchAPI(int.parse(dropdownValue.split("-")[0])); + callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); } }); } else { - callDoctorsSearchAPI(int.parse(dropdownValue.split("-")[0])); + callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); } } @@ -609,7 +609,7 @@ class _SearchByClinicState extends State { List _patientDoctorAppointmentListHospital = []; DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(clinicID, projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, nearestAppo, context).then((res) { + service.getDoctorsList(clinicID, projectDropdownValue != "" ? int.parse(projectDropdownValue!) : 0, nearestAppo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index a7fe8a4d..f64c44f3 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -87,8 +87,13 @@ class DoctorView extends StatelessWidget { style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), - doctor.date ==null ? SizedBox() : Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), + + // doctor.date ==null ? SizedBox() : Text( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), + + Text( + doctor.date != null ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date )) : DateTime.now().toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ) , ], diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 22368acf..bde7da6d 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -62,7 +62,7 @@ class _AmbulanceRequestIndexPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - AmbulanceRequestOrdersModel order = widget.amRequestViewModel.pendingAmbulanceRequestOrder; + AmbulanceRequestOrdersModel order = widget.amRequestViewModel.pendingAmbulanceRequestOrder ?? AmbulanceRequestOrdersModel(); if(widget.amRequestViewModel.pendingAmbulanceRequestOrder != null) { int status = order.statusId!; diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index e61eb922..47ca16b6 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -44,17 +44,17 @@ class _PickupLocationState extends State { // double _latitude; // double _longitude; - late AppoitmentAllHistoryResultList myAppointment; - late HospitalsModel _selectedHospital; - late LocationDetails _result; - late LocationUtils locationUtils; + AppoitmentAllHistoryResultList? myAppointment; + HospitalsModel? _selectedHospital; + LocationDetails? _result ; + LocationUtils? locationUtils; late ProjectViewModel projectViewModel; @override void initState() { super.initState(); locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils!.getCurrentLocation()); setState(() {}); } @@ -117,7 +117,7 @@ class _PickupLocationState extends State { )), ); } else { - locationUtils.getCurrentLocation(); + locationUtils!.getCurrentLocation(); } }, child: Row( @@ -289,17 +289,17 @@ class _PickupLocationState extends State { height: 12, ), DoctorCard( - isInOutPatient: myAppointment.isInOutPatient, - name: myAppointment.doctorTitle! + " " + myAppointment.doctorNameObj!, - profileUrl: myAppointment.doctorImageURL, - subName: myAppointment.clinicName, - isLiveCareAppointment: myAppointment.isLiveCareAppointment, - date: DateUtil.convertStringToDate(myAppointment.appointmentDate!), + isInOutPatient: myAppointment!.isInOutPatient, + name: myAppointment!.doctorTitle! + " " + myAppointment!.doctorNameObj!, + profileUrl: myAppointment!.doctorImageURL, + subName: myAppointment!.clinicName, + isLiveCareAppointment: myAppointment!.isLiveCareAppointment, + date: DateUtil.convertStringToDate(myAppointment!.appointmentDate!), isSortByClinic: false, - rating: myAppointment.actualDoctorRate! + 0.0, - appointmentTime: myAppointment.isLiveCareAppointment! - ? DateUtil.convertStringToDate(myAppointment.appointmentDate!).toString().split(" ")[1].substring(0, 5) - : myAppointment.startTime!.substring(0, 5), + rating: myAppointment!.actualDoctorRate! + 0.0, + appointmentTime: myAppointment!.isLiveCareAppointment! + ? DateUtil.convertStringToDate(myAppointment!.appointmentDate!).toString().split(" ")[1].substring(0, 5) + : myAppointment!.startTime!.substring(0, 5), remainingTimeInMinutes: null), ], ), @@ -458,7 +458,7 @@ class _PickupLocationState extends State { ), ); } else { - locationUtils.getCurrentLocation(); + locationUtils!.getCurrentLocation(); } }, child: Row( @@ -520,39 +520,39 @@ class _PickupLocationState extends State { widget.patientER_RC.transportationDetails!.pickupSpot = _isInsideHome ? 1 : 0; if (widget.patientER_RC.transportationDetails!.direction == 0) { // To Hospital - widget.patientER_RC.transportationDetails!.dropoffLatitude = _result.lat.toStringAsFixed(6); - widget.patientER_RC.transportationDetails!.dropoffLongitude = _result.long.toStringAsFixed(6); - widget.patientER_RC.transportationDetails!.pickupLatitude = _selectedHospital.latitude; - widget.patientER_RC.transportationDetails!.pickupLongitude = _selectedHospital.longitude; + widget.patientER_RC.transportationDetails!.dropoffLatitude = _result!.lat.toStringAsFixed(6); + widget.patientER_RC.transportationDetails!.dropoffLongitude = _result!.long.toStringAsFixed(6); + widget.patientER_RC.transportationDetails!.pickupLatitude = _selectedHospital!.latitude; + widget.patientER_RC.transportationDetails!.pickupLongitude = _selectedHospital!.longitude; } else { // From Hospital - widget.patientER_RC.transportationDetails!.pickupLatitude = _selectedHospital.latitude; - widget.patientER_RC.transportationDetails!.pickupLongitude = _selectedHospital.longitude; - widget.patientER_RC.transportationDetails!.dropoffLatitude = _result.lat.toStringAsFixed(6); - widget.patientER_RC.transportationDetails!.dropoffLongitude = _result.long.toStringAsFixed(6); + widget.patientER_RC.transportationDetails!.pickupLatitude = _selectedHospital!.latitude; + widget.patientER_RC.transportationDetails!.pickupLongitude = _selectedHospital!.longitude; + widget.patientER_RC.transportationDetails!.dropoffLatitude = _result!.lat.toStringAsFixed(6); + widget.patientER_RC.transportationDetails!.dropoffLongitude = _result!.long.toStringAsFixed(6); } - widget.patientER_RC.transportationDetails!.dropoffLocationName = widget.patientER_RC.transportationDetails!.direction == 1 ? _result.formattedAddress : _selectedHospital.name; + widget.patientER_RC.transportationDetails!.dropoffLocationName = widget.patientER_RC.transportationDetails!.direction == 1 ? _result!.formattedAddress : _selectedHospital!.name; - widget.patientER_RC.patientIdentificationID = widget.amRequestViewModel.user!.patientIdentificationNo; + widget.patientER_RC.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo; widget.patientER_RC.transportationDetails!.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); - widget.patientER_RC.transportationDetails!.pickupLocationName = widget.patientER_RC.transportationDetails!.direction == 1 ? _selectedHospital.name : _result.formattedAddress; - widget.patientER_RC.projectID = widget.amRequestViewModel.user!.projectID; - widget.patientER_RC.patientID = widget.amRequestViewModel.user!.patientID; + widget.patientER_RC.transportationDetails!.pickupLocationName = widget.patientER_RC.transportationDetails!.direction == 1 ? _selectedHospital!.name : _result!.formattedAddress; + widget.patientER_RC.projectID = widget.amRequestViewModel.user.projectID; + widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID; widget.patientER_RC.transportationDetails!.requesterIsOutSA = false; - widget.patientER_RC.transportationDetails!.requesterMobileNo = widget.amRequestViewModel.user!.mobileNumber; - widget.patientER_RC.transportationDetails!.requesterFileNo = widget.amRequestViewModel.user!.patientID; + widget.patientER_RC.transportationDetails!.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; + widget.patientER_RC.transportationDetails!.requesterFileNo = widget.amRequestViewModel.user.patientID; if (_haveAppointment == HaveAppointment.YES) { - widget.patientER_RC.transportationDetails!.appointmentNo = myAppointment.appointmentNo.toString(); - widget.patientER_RC.transportationDetails!.appointmentClinicName = myAppointment.clinicName; - widget.patientER_RC.transportationDetails!.appointmentDoctorName = myAppointment.doctorNameObj; - widget.patientER_RC.transportationDetails!.appointmentBranch = myAppointment.projectName; - widget.patientER_RC.transportationDetails!.appointmentTime = myAppointment.appointmentDate; + widget.patientER_RC.transportationDetails!.appointmentNo = myAppointment!.appointmentNo.toString(); + widget.patientER_RC.transportationDetails!.appointmentClinicName = myAppointment!.clinicName; + widget.patientER_RC.transportationDetails!.appointmentDoctorName = myAppointment!.doctorNameObj; + widget.patientER_RC.transportationDetails!.appointmentBranch = myAppointment!.projectName; + widget.patientER_RC.transportationDetails!.appointmentTime = myAppointment!.appointmentDate; widget.patientER_RC.transportationDetails!.haveAppointment = 1; - widget.patientER_RC.transportationDetails!.dropoffLatitude = myAppointment.latitude; - widget.patientER_RC.transportationDetails!.dropoffLongitude = myAppointment.longitude; - widget.patientER_RC.transportationDetails!.dropoffLocationName = myAppointment.projectName; + widget.patientER_RC.transportationDetails!.dropoffLatitude = myAppointment!.latitude; + widget.patientER_RC.transportationDetails!.dropoffLongitude = myAppointment!.longitude; + widget.patientER_RC.transportationDetails!.dropoffLocationName = myAppointment!.projectName; } else { widget.patientER_RC.transportationDetails!.appointmentNo = "0"; widget.patientER_RC.transportationDetails!.appointmentClinicName = ""; @@ -593,11 +593,15 @@ class _PickupLocationState extends State { } String getHospitalName(String title) { - return _selectedHospital == null ? title : _selectedHospital.name!; + return _selectedHospital == null ? title : _selectedHospital!.name!; } String getSelectFromMapName(context) { - return _result != null ? _result.formattedAddress : ""; + return _result != null + ? _result!.formattedAddress != null + ? _result!.formattedAddress! + : "" + : ""; } getAppointment() { @@ -619,11 +623,11 @@ class _PickupLocationState extends State { setState(() { myAppointment = value; HospitalsModel hospitalsModel = HospitalsModel(); - hospitalsModel.name = myAppointment.projectName; - hospitalsModel.iD = myAppointment.projectID; - hospitalsModel.mainProjectID = myAppointment.projectID; - hospitalsModel.latitude = myAppointment.latitude; - hospitalsModel.longitude = myAppointment.longitude; + hospitalsModel.name = myAppointment!.projectName; + hospitalsModel.iD = myAppointment!.projectID; + hospitalsModel.mainProjectID = myAppointment!.projectID; + hospitalsModel.latitude = myAppointment!.latitude; + hospitalsModel.longitude = myAppointment!.longitude; _selectedHospital = hospitalsModel; }); else { diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index f42119cf..0745daa8 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -102,7 +102,6 @@ class _HomePageFragment2State extends State { margin: EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 6), child: SliderView( onLoginClick: () { - print("-----------"); widget.onLoginClick!(); projectViewModel.analytics.loginRegistration.login_register_initiate(); }, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 5bb66735..a0792b3d 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -565,7 +565,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { changeCurrentTab(1); }, onLoginClick: () { - print("here i am"); login(); }, onMedicalFileClick: () { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index fd4be2a1..bc25ea16 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; @@ -59,7 +60,7 @@ class _ConfirmLogin extends State { PharmacyModuleViewModel pharmacyModuleViewModel = locator(); late int mobileNumber; String errorMsg = ''; - SelectDeviceIMEIRES user = SelectDeviceIMEIRES(); + SelectDeviceIMEIRES? user; bool isLoading = false; var registerd_data; bool isMoreOption = false; @@ -107,7 +108,6 @@ class _ConfirmLogin extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); toDoProvider = Provider.of(context); - return Scaffold( backgroundColor: Color(0xfff8f8f8), resizeToAvoidBottomInset: false, @@ -139,7 +139,7 @@ class _ConfirmLogin extends State { style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), ), Text( - user.name!.toLowerCase().capitalizeFirstofEach, + user!.name!.toLowerCase().capitalizeFirstofEach, style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), ), SizedBox(height: 10), @@ -172,10 +172,10 @@ class _ConfirmLogin extends State { style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), ), Text( - user.editedOn != null - ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.editedOn!)) - : user.createdOn != null - ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.createdOn!)) + user!.editedOn != null + ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.editedOn!)) + : user!.createdOn != null + ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.createdOn!)) : '--', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), ), @@ -194,7 +194,7 @@ class _ConfirmLogin extends State { ), ), Text( - " " + getType(user.logInType, context), + " " + getType(user!.logInType, context), style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, @@ -203,10 +203,10 @@ class _ConfirmLogin extends State { ), Expanded(child: SizedBox()), Text( - user.editedOn != null - ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.editedOn!), false) - : user.createdOn != null - ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.createdOn!), false) + user!.editedOn != null + ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user!.editedOn!), false) + : user!.createdOn != null + ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user!.createdOn!), false) : '--', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), ), @@ -499,24 +499,25 @@ class _ConfirmLogin extends State { } setDefault() async { + showLoader(true); if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson(await sharedPref.getObject(IMEI_USER_DATA)); if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) { isMoreOption = true; - this.registerd_data = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); + this.registerd_data = await CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); } - this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user.mobile!); + this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user!.mobile!); this.zipCode = this.registerd_data != null ? this.registerd_data.zipCode - : this.user.outSA == true + : this.user!.outSA == true ? "971" : "966"; this.patientOutSA = this.registerd_data != null ? this.registerd_data.zipCode == "966" ? 0 : 1 - : this.user.outSA; + : this.user!.outSA; if (this.registerd_data != null) { this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); this.loginType = this.registerd_data.searchType; @@ -534,9 +535,10 @@ class _ConfirmLogin extends State { this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : user != null - ? user.logInType + ? user!.logInType : null; + showLoader(false); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); } @@ -560,7 +562,7 @@ class _ConfirmLogin extends State { 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; + request.patientID = this.user!.patientID != null ? this.user!.patientID : 0; request.nationalID = request.nationalID != null ? request.nationalID : '0'; request.patientIdentificationID = request.patientIdentificationID != null ? request.patientIdentificationID : '0'; request.isRegister = false; diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index b89afe70..a4f21c80 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -15,14 +15,16 @@ import 'package:provider/provider.dart'; class MedicalProfilePageNew extends StatefulWidget { Function()? onTap; String? a; + MedicalProfilePageNew({this.onTap}); + @override _MedicalProfilePageState createState() => _MedicalProfilePageState(); } class _MedicalProfilePageState extends State { var authProvider = new AuthProvider(); - List medical =[]; + List medical = []; ProjectViewModel? projectViewModel; @override @@ -57,7 +59,7 @@ class _MedicalProfilePageState extends State { children: [ projectViewModel!.isLogin ? Text( - projectViewModel?.user?.firstName ?? "", + projectViewModel?.user.firstName ?? "", style: TextStyle(color: Colors.black, fontSize: SizeConfig.textMultiplier! * 1.8), ) : Container(), diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index fbe60a75..52f8a86b 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -44,7 +44,7 @@ class _AddWeightPageState extends State { "باوند", "كيلو جرام", ]; - late String measureTimeSelectedType; + String? measureTimeSelectedType; bool isButtonDisabled = true; @override diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index e1c39e62..d890c157 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -24,7 +24,8 @@ class WeightMonthlyPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + //if (projectViewModel == null) + projectViewModel = Provider.of(context); groupData(); return ListView( children: [ diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index a4343acb..05cafe04 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -24,7 +24,8 @@ class WeightWeeklyPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + ///if (projectViewModel == null) + projectViewModel = Provider.of(context); return ListView( children: [ Container( diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index 79445ddc..1eabcce2 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -20,7 +20,8 @@ class BloodPressureMonthlyPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + // if (projectViewModel == null) + projectViewModel = Provider.of(context); groupData(); return ListView( children: [ diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index 47ec32f7..260cdbed 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -22,7 +22,8 @@ class BloodPressureYearPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + // if (projectViewModel == null) + projectViewModel = Provider.of(context); groupData(); return ListView( children: [ diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index eb24b139..9d0d6685 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -22,7 +22,8 @@ class BloodPressureWeeklyPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + // if (projectViewModel == null) + projectViewModel = Provider.of(context); return ListView( children: [ Container( diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index 243d6164..59cc2e12 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -25,7 +25,7 @@ class BloodMonthlyPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); groupData(); return AppScaffold( body: ListView( diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index d90b23b4..3e284565 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -23,7 +23,8 @@ class BloodYearPage extends StatelessWidget { @override Widget build(BuildContext context) { - if (projectViewModel == null) projectViewModel = Provider.of(context); + // if (projectViewModel == null) + projectViewModel = Provider.of(context); groupData(); return ListView( diff --git a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart index dfa882f6..54228d1e 100644 --- a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart +++ b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart @@ -128,7 +128,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { fontSize: 10, ); return Text( - timeSeries1![value.toInt()].time, + timeSeries1![value.toInt()].time.toString(), style: styl, ); }), @@ -148,7 +148,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { fontSize: 10, ); return Text( - timeSeries1![value.toInt()].time, + timeSeries1![value.toInt()].time.toString(), style: styl, ); } diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 432c811b..be050ac4 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -61,9 +61,9 @@ class PrescriptionItemsPage extends StatelessWidget { prescriptions.name!, DateUtil.convertStringToDate(prescriptions.appointmentDate!), DateUtil.formatDateToTime( - DateUtil.convertStringToDate( + model.prescriptionReportEnhList.length > 0 || model.prescriptionReportListINP.length > 0 ? DateUtil.convertStringToDate( model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!, - ), + ) : DateTime.now(), ), prescriptions.nationalityFlagURL!, prescriptions.doctorRate, diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 3b4e643b..d42cbe34 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -50,7 +50,7 @@ class RadiologyDetailsPage extends StatelessWidget { finalRadiology!.doctorName!, finalRadiology!.doctorID!, finalRadiology!.doctorImageURL!, - finalRadiology!.speciality!, + finalRadiology!.speciality ?? [""], Utils.isVidaPlusProject(projectViewModel, finalRadiology!.projectID!) ? finalRadiology!.invoiceNo_VP.toString() : finalRadiology!.invoiceNo.toString(), finalRadiology!.projectName!, finalRadiology!.orderDate, @@ -59,7 +59,7 @@ class RadiologyDetailsPage extends StatelessWidget { finalRadiology!.doctorRate, finalRadiology!.actualDoctorRate, finalRadiology!.noOfPatientsRate, - projectViewModel.user!.emailAddress!, + projectViewModel.user.emailAddress!, ), onTap: () { showConfirmMessage(finalRadiology: finalRadiology!, model: model, userObj: projectViewModel.user!); diff --git a/lib/pages/medical/reports/monthly_reports.dart b/lib/pages/medical/reports/monthly_reports.dart index c0931371..f6b43c5e 100644 --- a/lib/pages/medical/reports/monthly_reports.dart +++ b/lib/pages/medical/reports/monthly_reports.dart @@ -20,12 +20,12 @@ class MonthlyReportsPage extends StatefulWidget { } class _MonthlyReportsPageState extends State { - late bool isAgree; - late bool isSummary; - late String email; + bool isAgree = false; + bool isSummary = false; + String email = ""; final formKey = GlobalKey(); - List imagesInfo =[]; + List imagesInfo = []; @override void initState() { @@ -47,7 +47,7 @@ class _MonthlyReportsPageState extends State { isAgree = model.receiveHealthSummaryReport; } if (email == null) { - email = model?.user?.emailAddress ?? ""; + email = model.user.emailAddress ?? ""; } return AppScaffold( isShowAppBar: true, @@ -99,10 +99,11 @@ class _MonthlyReportsPageState extends State { }); if (!isSummary) { GifLoaderDialogUtils.showMyDialog(context); + print("is Summry: $isSummary"); await model.updatePatientHealthSummaryReport(message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary); model.receiveHealthSummaryReport = isSummary; isAgree = isSummary; - model.user!.emailAddress = ""; + model.user.emailAddress = ""; GifLoaderDialogUtils.hideDialog(context); } }, @@ -187,7 +188,8 @@ class _MonthlyReportsPageState extends State { RichText( text: TextSpan( text: TranslationBase.of(context).toViewTheTermsAndConditions + " ", - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + style: TextStyle( + fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), children: [ TextSpan( text: TranslationBase.of(context).clickHere, diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 02c0c045..dc7a5343 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; import 'package:diplomaticquarterapp/core/service/medical/reports_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -41,6 +42,7 @@ class ReportListWidget extends StatelessWidget { separatorBuilder: (context, index) => SizedBox(height: 14), itemBuilder: (context, index) { Reports report = reportList[index]; + logger.d(report.toJson()); return Container( decoration: BoxDecoration( borderRadius: BorderRadius.all( @@ -105,7 +107,7 @@ class ReportListWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ RatingBar( - initialRating: report.actualDoctorRate!.toDouble(), + initialRating:report.actualDoctorRate == null ? 0.0: report.actualDoctorRate!.toDouble(), itemSize: 16, ratingWidget: RatingWidget( full: Icon( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index ae8e228f..ee50866f 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; @@ -378,23 +379,29 @@ class DoctorsListService extends BaseService { }; if (clinicID == 253) { - List procedureID = projectViewModel!.selectedBodyPartList!.map((element) => element.id.toString()).toList(); + List procedureID = projectViewModel!.selectedBodyPartList.map((element) => element.id.toString()).toList(); request["GeneralProcedureList"] = procedureID; if (procedureID.length == 1 && procedureID[0] == "1") { request["InitialSlotDuration"] = 90; } else { - request["InitialSlotDuration"] = projectViewModel!.laserSelectionDuration!; + request["InitialSlotDuration"] = projectViewModel.laserSelectionDuration; } } dynamic localRes; - - await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); - return Future.value(localRes); + try { + await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + logger.d(error); + throw error; + }, body: request); + logger.d(localRes); + return Future.value(localRes); + } catch (e) { + logger.d(e); + return Future.error(e); + } } Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, String selectedTime, String selectedDate, BuildContext context) async { @@ -1841,6 +1848,4 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - - } diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index d35be3f4..8031aeae 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -31,7 +31,7 @@ class AppToast { int? elevation, int imageSize = 32, }) { - Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); + Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds ?? 0, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); } static void showErrorToast({ diff --git a/lib/uitl/gif_loader_dialog_utils.dart b/lib/uitl/gif_loader_dialog_utils.dart index eae84e38..937e1016 100644 --- a/lib/uitl/gif_loader_dialog_utils.dart +++ b/lib/uitl/gif_loader_dialog_utils.dart @@ -8,10 +8,11 @@ class GifLoaderDialogUtils { } static hideDialog(BuildContext context) { - try { - Navigator.of(context).pop(); - } catch (error) { - Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).pop()); + try { + Navigator.of(context).pop(); + } catch (error) { + Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).pop()); + } } - } + } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index b0b821bf..17f072e7 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -617,7 +617,7 @@ class Utils { 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: [ MedicalProfileItem( diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index 1bae6ed9..4495f499 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -56,7 +56,7 @@ class LargeAvatar extends StatelessWidget { } else return Center( child: Texts( - name![0].toUpperCase(), + name == null? "" : name![0].toUpperCase(), color: Colors.white, fontSize: 18, )); diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index bee98dad..e90e6733 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -206,6 +208,7 @@ class DoctorCard extends StatelessWidget { itemSize: 20.0, allowHalfRating: true, initialRating: rating!, + ignoreGestures: true, ratingWidget: RatingWidget( full: Icon( Icons.star, @@ -213,7 +216,7 @@ class DoctorCard extends StatelessWidget { ), half: Icon( Icons.star_half, - color: Color(0XFFD02127), + color: CustomColors.accentColor, ), empty: Icon( Icons.star_border, diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 7bb2346f..53e2182b 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; @@ -35,30 +36,37 @@ class TimeLineView extends StatefulWidget { class _TimeLineViewState extends State { List tempList = []; List dateObjs = []; - DateObj selectedDateObj = DateObj(DateTime.now().month,DateTime.now().year,DateTime.now().year.toString()); - final authService = new auth.AuthProvider(); + + DateObj? selectedDateObj; + + final authService = auth.AuthProvider(); @override void initState() { super.initState(); - dateObjs.add(new DateObj(0, 0, widget.isArabic ? "الكل" : "All")); + // selectedDateObj = DateObj(DateTime.august, 2021, 2021.toString()); + dateObjs.add(DateObj(0, 0, widget.isArabic ? "الكل" : "All")); for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { tempList.add(widget.appoitmentAllHistoryResultList[i]); - dateObjs.add(new DateObj( + dateObjs.add( + DateObj( DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!).month, DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!).year, DateUtil.getMonthYearLangDateFormatted( DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!), widget.isArabic ? "ar" : "en", - ))); + ), + ), + ); } dateObjs = dateObjs.toSet().toList(); dateObjs.sort((a, b) => a.month.compareTo(b.month)); dateObjs.sort((a, b) => a.year.compareTo(b.year)); + logger.d(dateObjs); - // for (int i = 0; i < dateObjs.length; i++) { - // print(dateObjs[i].monthYear.toString()); - // } + for (int i = 0; i < dateObjs.length; i++) { + print(dateObjs[i].monthYear.toString()); + } } applyFilter(bool isAll) { @@ -73,7 +81,7 @@ class _TimeLineViewState extends State { DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!), widget.isArabic ? "ar" : "en", ) == - selectedDateObj.monthYear) { + selectedDateObj!.monthYear) { tempList.add(widget.appoitmentAllHistoryResultList[i]); } } @@ -142,14 +150,14 @@ class _TimeLineViewState extends State { items: dateObjs.map((DateObj value) { return DropdownMenuItem( value: value, - child: new AutoSizeText( - value.monthYear, + child: AutoSizeText( + '${value.monthYear}', ), ); }).toList(), - onChanged: (r) { + onChanged: (DateObj? r) { selectedDateObj = r!; - applyFilter(r?.year == 0 ? true : false); + applyFilter(r.year == 0 ? true : false); setState(() {}); }, underline: Container( @@ -159,6 +167,7 @@ class _TimeLineViewState extends State { ), ), ) + : Container() ], ), @@ -236,7 +245,7 @@ class _TimeLineViewState extends State { fontWeight: FontWeight.bold, fontSize: 14, letterSpacing: -0.42, - ), + ), ), mHeight(4), !isLogged @@ -244,9 +253,9 @@ class _TimeLineViewState extends State { height: MediaQuery.of(context).size.width / 14, width: MediaQuery.of(context).size.width / (widget.isArabic ? 4 : 6), child: CustomTextButton( - // shape: cardRadiusNew(8), - elevation: 0, - backgroundColor: Color(0xFFFBF2E31), + // shape: cardRadiusNew(8), + elevation: 0, + backgroundColor: Color(0xFFFBF2E31), onPressed: () { // onLoginClick(); login(); diff --git a/lib/widgets/input/custom_switch.dart b/lib/widgets/input/custom_switch.dart index 6f022cef..85cb2b32 100644 --- a/lib/widgets/input/custom_switch.dart +++ b/lib/widgets/input/custom_switch.dart @@ -39,12 +39,12 @@ class _CustomSwitchState extends State with SingleTickerProviderSt bool _switchStatus = _circleAnimation!.status == AnimationStatus.dismissed || _circleAnimation!.status == AnimationStatus.reverse; return GestureDetector( onTap: Feedback.wrapForTap(() async { - if (widget!.value!) { + if (widget.value!) { _animationController!.reverse(); } else { _animationController!.forward(); } - await widget!.onChanged!(); + await widget.onChanged!(); }, context), child: AnimatedContainer( duration: Duration(milliseconds: 200), diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index d0bb9640..5ced91ba 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -134,6 +134,7 @@ class DoctorHeader extends StatelessWidget { RatingBar( itemSize: 20.0, allowHalfRating: true, + ignoreGestures: true, initialRating: headerModel.actualDoctorRate! + 0.0, ratingWidget: RatingWidget( full: Icon( @@ -174,14 +175,14 @@ class DoctorHeader extends StatelessWidget { onTap!(); }, child: Container( - padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), + padding: EdgeInsets.only(top: 10, bottom: 10, right: 15, left: 15), decoration: BoxDecoration( color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), child: Row( mainAxisSize: MainAxisSize.min, children: [ SvgPicture.asset(buttonIcon ?? 'assets/images/new/email.svg', width: 19.0), - SizedBox(width: 6), + SizedBox(width: 4), Text( buttonTitle == null ? TranslationBase.of(context).sendEmail : buttonTitle!, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 1),