diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 00069e3a..5286a54b 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -44,10 +44,10 @@ class BaseAppClient { if (body['DoctorID'] == "") body['DoctorID'] = null; if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID; if (body['ProjectID'] == null) { - body['ProjectID'] = doctorProfile?.projectID; + body['ProjectID'] = doctorProfile.projectID; } - if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; + if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile.clinicID; if (body['DoctorID'] == '') { body['DoctorID'] = null; } @@ -56,7 +56,7 @@ class BaseAppClient { } } if (body['TokenID'] == null) { - body['TokenID'] = token ?? ''; + body['TokenID'] = token; } // body['TokenID'] = "@dm!n" ?? ''; String lang = await sharedPref.getString(APP_Language); diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index 75c37643..2cbec3eb 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -37,16 +37,16 @@ class SizeConfig { } else if (constraints.maxHeight < 1000) { isHeightMiddle = true; } else { - isHeightLarge = true; + isHeightLarge = true; } - if(constraints.maxWidth > 600) { + if (constraints.maxWidth > 600) { isWidthLarge = true; } if (orientation == Orientation.portrait) { isPortrait = true; - if (realScreenWidth! < 450) { + if (realScreenWidth < 450) { isMobilePortrait = true; } screenHeight = realScreenHeight; @@ -57,8 +57,8 @@ class SizeConfig { screenHeight = realScreenWidth; screenWidth = realScreenHeight; } - _blockWidth = (screenWidth! / 100); - _blockHeight = (screenHeight! / 100)!; + _blockWidth = (screenWidth / 100); + _blockHeight = (screenHeight / 100); textMultiplier = _blockHeight; imageSizeMultiplier = _blockWidth; @@ -75,27 +75,26 @@ class SizeConfig { print('isMobilePortrait $isMobilePortrait'); } - static getTextMultiplierBasedOnWidth({double? width}){ + static getTextMultiplierBasedOnWidth({double? width}) { // TODO handel LandScape case - if(width != null) { - return width / 100; + if (width != null) { + return width / 100; } return widthMultiplier; } - - static getWidthMultiplier({double? width}){ + static getWidthMultiplier({double? width}) { // TODO handel LandScape case - if(width != null) { - return width / 100; + if (width != null) { + return width / 100; } return widthMultiplier; } - static getHeightMultiplier({double? height}){ + static getHeightMultiplier({double? height}) { // TODO handel LandScape case - if(height != null) { - return height / 100; + if (height != null) { + return height / 100; } return heightMultiplier; } diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index 52c10ad5..3d97ae10 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -428,7 +428,7 @@ class PatientService extends BaseService { referralClinic: selectedClinicID.toString(), referralDoctor: selectedDoctorID.toString(), createdBy: doctorID!, - editedBy: doctorID!, + editedBy: doctorID, patientID: patientID!, patientTypeID: patientTypeID!, referringClinic: clinicId!, diff --git a/lib/core/service/patient_medical_file/prescription/prescription_service.dart b/lib/core/service/patient_medical_file/prescription/prescription_service.dart index 96399156..4a672412 100644 --- a/lib/core/service/patient_medical_file/prescription/prescription_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescription_service.dart @@ -203,7 +203,7 @@ class PrescriptionService extends LookupService { "Gender": patient.gender == 1 ? 'Male' : 'Female', "Age": AppDateUtils.convertDateFromServerFormat(patient.dateofBirth!, 'dd/MM/yyyy') }, - "objVitalSign": {"Height": vital?.heightCm, "Weight": vital?.weightKg}, + "objVitalSign": {"Height": vital.heightCm, "Weight": vital.weightKg}, "objPrescriptionItems": prescription, "objAllergies": getAllergiesObj(allergy), "objDiagnosis": getDiagnosisObj(lstAssessments), diff --git a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart index 83fc9fd3..22e5044d 100644 --- a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart @@ -124,7 +124,7 @@ class PrescriptionsService extends BaseService { bool isInPatient = false; prescriptionsList.forEach((element) { if (prescriptionsOrder!.appointmentNo == "0") { - if (element.dischargeNo == int.parse(prescriptionsOrder!.dischargeID)) { + if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) { _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; _requestPrescriptionReportEnh.clinicID = element.clinicID; _requestPrescriptionReportEnh.projectID = element.projectID; diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 52819e43..a38cd0eb 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -184,7 +184,7 @@ class AuthenticationViewModel extends BaseViewModel { mobileNumber: loggedUser != null ? loggedUser!.mobileNumber : user!.mobile, projectID: await sharedPref.getInt(PROJECT_ID) != null ? await sharedPref.getInt(PROJECT_ID) : user!.projectID, logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - activationCode: activationCode ?? '0000', + activationCode: activationCode, oTPSendType: await sharedPref.getInt(OTP_TYPE), generalid: "Cs2020@2016\$2958"); await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); @@ -232,8 +232,8 @@ class AuthenticationViewModel extends BaseViewModel { /// add  token to shared preferences in case of send activation code is success setDataAfterSendActivationSuccess( SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { - print("VerificationCode : " +sendActivationCodeForDoctorAppResponseModel!.verificationCode!); - // DrAppToastMsg.showSuccesToast("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode!); + print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode!); + // DrAppToastMsg.showSuccesToast("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode!); sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID!); sharedPref.setString(VIDA_REFRESH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID!); sharedPref.setString(LOGIN_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.logInTokenID!); @@ -270,11 +270,12 @@ class AuthenticationViewModel extends BaseViewModel { /// get doctor profile based on clinic model Future getDoctorProfileBasedOnClinic(ClinicModel clinicInfo) async { ProfileReqModel docInfo = new ProfileReqModel( - doctorID: clinicInfo.doctorID, - clinicID: clinicInfo.clinicID, - license: true, - projectID: clinicInfo.projectID, - tokenID: '',); //TODO change the lan + doctorID: clinicInfo.doctorID, + clinicID: clinicInfo.clinicID, + license: true, + projectID: clinicInfo.projectID, + tokenID: '', + ); //TODO change the lan await _authService.getDoctorProfileBasedOnClinic(docInfo); if (_authService.hasError) { error = _authService.error!; diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 27489733..409fc935 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -24,8 +24,8 @@ class DashboardViewModel extends BaseViewModel { String? get sServiceID => _dashboardService.sServiceID; - List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; - + List get specialClinicalCareList => + _specialClinicsService.specialClinicalCareList; Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async { setState(ViewState.Busy); @@ -82,7 +82,7 @@ class DashboardViewModel extends BaseViewModel { ); await authProvider.getDoctorProfileBasedOnClinic(clinicModel); if (authProvider.state == ViewState.ErrorLocal) { - error = authProvider.error!; + error = authProvider.error; } } @@ -93,16 +93,14 @@ class DashboardViewModel extends BaseViewModel { return value.toString(); } - - GetSpecialClinicalCareListResponseModel? getSpecialClinic(clinicId){ - GetSpecialClinicalCareListResponseModel? special ; + GetSpecialClinicalCareListResponseModel? getSpecialClinic(clinicId) { + GetSpecialClinicalCareListResponseModel? special; specialClinicalCareList.forEach((element) { - if(element.clinicID == 1){ + if (element.clinicID == 1) { special = element; } }); return special; - } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 188e4be2..7b25b6fe 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -110,7 +110,7 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Busy); await _patientService.getPatientRadiology(patient); if (_patientService.hasError) { - error = _patientService.error!!; + error = _patientService.error!; setState(ViewState.Error); } else setState(ViewState.Idle); @@ -231,16 +231,16 @@ class PatientViewModel extends BaseViewModel { Future referToDoctor( {required String selectedDoctorID, - required String selectedClinicID, - required int admissionNo, - required String extension, - required String priority, - required String frequency, - required String referringDoctorRemarks, - required int patientID, - required int patientTypeID, - required String roomID, - required int projectID}) async { + required String selectedClinicID, + required int admissionNo, + required String extension, + required String priority, + required String frequency, + required String referringDoctorRemarks, + required int patientID, + required int patientTypeID, + required String roomID, + required int projectID}) async { setState(ViewState.BusyLocal); await _patientService.referToDoctor( selectedClinicID: selectedClinicID, diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 4d68ea52..81edda20 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -23,8 +23,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' - as cpe; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it @@ -78,15 +77,12 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory( - {String? categoryName, String? categoryID, patientId}) async { + Future getProcedureCategory({String? categoryName, String? categoryID, patientId}) async { if (categoryName == null) return; hasError = false; setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, - categoryID: categoryID, - patientId: patientId); + categoryName: categoryName, categoryID: categoryID, patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error!; setState(ViewState.ErrorLocal); @@ -318,14 +314,13 @@ class ProcedureViewModel extends BaseViewModel { {String? remarks, String? orderType, PatiantInformtion? patient, - List ? entityList, + List? entityList, ProcedureType? procedureType}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = new ProcedureValadteRequestModel(); procedureValadteRequestModel.patientMRN = patient!.patientMRN; - procedureValadteRequestModel.episodeID = patient!.episodeNo; - procedureValadteRequestModel.appointmentNo = patient!.appointmentNo; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; List controlsProcedure = []; @@ -334,31 +329,23 @@ class ProcedureViewModel extends BaseViewModel { postProcedureReqModel.patientMRN = patient.patientMRN; entityList!.forEach((element) { - procedureValadteRequestModel.procedure = [element!.procedureId!]; + procedureValadteRequestModel.procedure = [element.procedureId!]; List controls = []; controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), + Controls(code: "remarks", controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( - Controls( - code: "ordertype", - controlValue: procedureType == ProcedureType.PROCEDURE - ? element.type ?? "1" - : "0"), + Controls(code: "ordertype", controlValue: procedureType == ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); + controlsProcedure + .add(Procedures(category: element.categoryID, procedure: element.procedureId, controls: controls)); }); postProcedureReqModel.procedures = controlsProcedure; await valadteProcedure(procedureValadteRequestModel); if (state == ViewState.Idle) { if (valadteProcedureList[0].entityList!.length == 0) { - await postProcedure(postProcedureReqModel, patient!.patientMRN!); + await postProcedure(postProcedureReqModel, patient.patientMRN!); if (state == ViewState.ErrorLocal) { Helpers.showErrorToast(error); @@ -371,8 +358,7 @@ class ProcedureViewModel extends BaseViewModel { Helpers.showErrorToast(error); getProcedure(mrn: patient.patientMRN); } else if (state == ViewState.Idle) { - Helpers.showErrorToast( - valadteProcedureList[0].entityList![0].warringMessages); + Helpers.showErrorToast(valadteProcedureList[0].entityList![0].warringMessages); } } } else { diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 75eecbc6..c1ca9bbb 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -17,7 +17,7 @@ Helpers helpers = Helpers(); class ProjectViewModel with ChangeNotifier { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); - late Locale _appLocale = Locale(currentLanguage ); + late Locale _appLocale = Locale(currentLanguage); String currentLanguage = 'ar'; bool _isArabic = false; bool isInternetConnection = true; @@ -52,7 +52,7 @@ class ProjectViewModel with ChangeNotifier { void loadSharedPrefLanguage() async { currentLanguage = await sharedPref.getString(APP_Language); - _appLocale = Locale(currentLanguage ?? 'en'); + _appLocale = Locale(currentLanguage); _isArabic = currentLanguage != null ? currentLanguage == 'ar' ? true diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index f8e62ea1..d41c6e2b 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -61,68 +61,63 @@ class _VerificationMethodsScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?6:4), - ), - if(authenticationViewModel.isFromLogin) - InkWell( - onTap: (){ - authenticationViewModel.setUnverified(false,isFromLogin: false); - authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); - }, - child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) - + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 6 : 4), ), + if (authenticationViewModel.isFromLogin) + InkWell( + onTap: () { + authenticationViewModel.setUnverified(false, isFromLogin: false); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + }, + child: Icon( + Icons.arrow_back_ios, + color: Color(0xFF2B353E), + )), Column( children: [ SizedBox( - height: SizeConfig.heightMultiplier*(SizeConfig.isHeightVeryShort?3:4), + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 3 : 4), ), authenticationViewModel.user != null && isMoreOption == false ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - AppText( - TranslationBase.of(context).welcomeBack, - fontSize:SizeConfig.getTextMultiplierBasedOnWidth()*4, - fontWeight: FontWeight.w700, - color: Color(0xFF2B353E), - ), - AppText( - Helpers.capitalize(authenticationViewModel.user!.doctorName), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*6, - color: Color(0xFF2B353E), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: SizeConfig.heightMultiplier*4, - ), - AppText( - TranslationBase.of(context).accountInfo , - fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*5, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w600, - ), - SizedBox( - height: SizeConfig.heightMultiplier*4 - ), - Container( - padding: EdgeInsets.all(15), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10), - ), - border: Border.all( - color: HexColor('#707070'), - width: 0.1), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).welcomeBack, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4, + fontWeight: FontWeight.w700, + color: Color(0xFF2B353E), + ), + AppText( + Helpers.capitalize(authenticationViewModel.user!.doctorName), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 6, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), + SizedBox( + height: SizeConfig.heightMultiplier * 4, + ), + AppText( + TranslationBase.of(context).accountInfo, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + ), + SizedBox(height: SizeConfig.heightMultiplier * 4), + Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all(color: HexColor('#707070'), width: 0.1), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ Container( width: SizeConfig.realScreenWidth * .5, padding: EdgeInsets.all(0), @@ -130,277 +125,198 @@ class _VerificationMethodsScreenState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - TranslationBase.of(context) - .lastLoginAt!, + TranslationBase.of(context).lastLoginAt!, overflow: TextOverflow.ellipsis, style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, ), ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.55, + width: MediaQuery.of(context).size.width * 0.55, child: RichText( text: TextSpan( text: TranslationBase.of(context).verifyWith, style: TextStyle( color: Color(0xFF2B353E), - fontWeight: FontWeight.w600, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + fontWeight: FontWeight.w600, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, fontFamily: 'Poppins', ), children: [ TextSpan( - text: authenticationViewModel - .getType( - authenticationViewModel - .user - !.logInTypeID, - context), + text: authenticationViewModel.getType( + authenticationViewModel.user!.logInTypeID, context), style: TextStyle( - color: - Color(0xFF2B353E), - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + color: Color(0xFF2B353E), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, fontFamily: 'Poppins', - fontWeight: - FontWeight.w700, + fontWeight: FontWeight.w700, ), ) ]), ), ), ], - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, ), ), Column( mainAxisAlignment: MainAxisAlignment.start, - children: [ AppText( - authenticationViewModel - .user!.editedOn != - null - ? AppDateUtils - .getDayMonthYearDateFormatted( - AppDateUtils - .convertStringToDate( - authenticationViewModel - ! .user - !.editedOn!)) - : authenticationViewModel - .user!.createdOn! != - null + authenticationViewModel.user!.editedOn != null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate( + authenticationViewModel.user!.editedOn!)) + : authenticationViewModel.user!.createdOn! != null ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate(authenticationViewModel!.user - !.createdOn!)) - : '--', - textAlign: - TextAlign.right, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *4.5, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700, + AppDateUtils.convertStringToDate( + authenticationViewModel.user!.createdOn!)) + : '--', + textAlign: TextAlign.right, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + ), + AppText( + authenticationViewModel.user!.editedOn != null + ? AppDateUtils.getHour(AppDateUtils.convertStringToDate( + authenticationViewModel.user!.editedOn!)) + : authenticationViewModel.user!.createdOn != null + ? AppDateUtils.getHour(AppDateUtils.convertStringToDate( + authenticationViewModel.user!.createdOn!)) + : '--', + textAlign: TextAlign.right, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ) + ], + crossAxisAlignment: CrossAxisAlignment.start, + ) + ], ), - AppText( - authenticationViewModel.user!.editedOn != - null - ? AppDateUtils.getHour( - AppDateUtils.convertStringToDate( - authenticationViewModel!.user - !.editedOn!)) - : authenticationViewModel.user!.createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils.convertStringToDate(authenticationViewModel!.user - !.createdOn!)) - : '--', - textAlign: - TextAlign.right, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *4.5, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ) - ], - crossAxisAlignment: CrossAxisAlignment.start, - - ) + ), + SizedBox( + height: SizeConfig.heightMultiplier * 3, + ), + Row( + children: [ + //todo add translation + AppText( + "Please Verify", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 5, + color: Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + ], + ), + SizedBox( + height: SizeConfig.heightMultiplier * 2, + ), ], - ), - ), - SizedBox( - height: SizeConfig.heightMultiplier*3, - ), - - Row( - children: [ - - //todo add translation - AppText( - "Please Verify", - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 5, - color: Color(0xFF2B353E), - - fontWeight: FontWeight.w700, - ), - ], - ), - SizedBox( - height: SizeConfig.heightMultiplier*2, - ), - ], - ) + ) : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - this.onlySMSBox == false - ? Container( - margin: EdgeInsets.only(bottom: 20, top: 30), - child: AppText( - TranslationBase.of(context) - .verifyLoginWith , - fontSize: SizeConfig.getTextMultiplierBasedOnWidth()* 4 , - color: Color(0xFF2E303A), - fontWeight: FontWeight.bold, - textAlign: TextAlign.left, - ), - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: - SizeConfig.getTextMultiplierBasedOnWidth()* 4, - textAlign: TextAlign.start, - ), - ]), + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? Container( + margin: EdgeInsets.only(bottom: 20, top: 30), + child: AppText( + TranslationBase.of(context).verifyLoginWith, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context).verifyFingerprint2, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4, + textAlign: TextAlign.start, + ), + ]), authenticationViewModel.user != null && isMoreOption == false ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => - { - // TODO check this logic it seem it will create bug to us - authenticateUser( - AuthMethodTypes - .Fingerprint, true) - }, - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: SelectedAuthMethodTypesService - .getMethodsTypeService( - authenticationViewModel!.user - !.logInTypeID!!), - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - ), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.MoreOptions, - onShowMore: () { - setState(() { - isMoreOption = true; - }); - }, - )) - ]), - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.Fingerprint, - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.FaceID, - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Expanded( + child: InkWell( + onTap: () => { + // TODO check this logic it seem it will create bug to us + authenticateUser(AuthMethodTypes.Fingerprint, true) + }, + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: SelectedAuthMethodTypesService.getMethodsTypeService( + authenticationViewModel.user!.logInTypeID!), + authenticateUser: (AuthMethodTypes authMethodType, isActive) => + authenticateUser(authMethodType, isActive), + )), + ), + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.MoreOptions, + onShowMore: () { + setState(() { + isMoreOption = true; + }); + }, )) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: - MainAxisAlignment.center, + ]), + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: AuthMethodTypes - .SMS, - authenticateUser: - ( - AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.WhatsApp, - authenticateUser: - ( - AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )) - ], - ), - ]), + onlySMSBox == false + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.Fingerprint, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => + authenticateUser(authMethodType, isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.FaceID, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => + authenticateUser(authMethodType, isActive), + )) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.SMS, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => + authenticateUser(authMethodType, isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.WhatsApp, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => + authenticateUser(authMethodType, isActive), + )) + ], + ), + ]), // ) ], @@ -410,36 +326,36 @@ class _VerificationMethodsScreenState extends State { ), ), ), - bottomSheet: authenticationViewModel.user == null ? SizedBox(height: 0,) : Container( - // color: Colors.green, - height: SizeConfig.heightMultiplier * 10 , - width: double.infinity, - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppButton( - title: TranslationBase - .of(context) - .useAnotherAccount, - color: Color(0xFFD02127), - - fontWeight: FontWeight.w700, - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort? 8 : 6), - hPadding: 1, - - onPressed: () { - authenticationViewModel.deleteUser(); - authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); - }, + bottomSheet: authenticationViewModel.user == null + ? SizedBox( + height: 0, + ) + : Container( + // color: Colors.green, + height: SizeConfig.heightMultiplier * 10, + width: double.infinity, + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).useAnotherAccount, + color: Color(0xFFD02127), + fontWeight: FontWeight.w700, + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 8 : 6), + hPadding: 1, + onPressed: () { + authenticationViewModel.deleteUser(); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + }, + ), + ], + ), ), - - ], + ), ), - ), - ),), ); } diff --git a/lib/screens/home/dashboard_referral_patient.dart b/lib/screens/home/dashboard_referral_patient.dart index a7e4339d..fd5ab744 100644 --- a/lib/screens/home/dashboard_referral_patient.dart +++ b/lib/screens/home/dashboard_referral_patient.dart @@ -1,4 +1,3 @@ - import 'package:charts_flutter/flutter.dart' as charts; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; @@ -29,152 +28,117 @@ class DashboardReferralPatient extends StatelessWidget { shadowDy: 1, margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - - children: [ - Expanded( - flex: 1, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - - children: [ - Expanded( - flex: 4, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(8), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: SizeConfig - .getHeightMultiplier( - height: height) * - (SizeConfig.isHeightVeryShort - ? 3 - : SizeConfig.isHeightShort + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ + Expanded( + flex: 1, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(8), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.getHeightMultiplier(height: height) * + (SizeConfig.isHeightVeryShort + ? 3 + : SizeConfig.isHeightShort ? 2 - : 2) - ), - Label(firstLine: TranslationBase - .of(context) - .patients, - secondLine: TranslationBase - .of(context) - .referral, - color: Color(0xFF2B353E), - secondLineFontSize: SizeConfig - .getHeightMultiplier( - height: height) * - (SizeConfig.isHeightVeryShort - ? 5 - : SizeConfig.isHeightShort + : 2)), + Label( + firstLine: TranslationBase.of(context).patients, + secondLine: TranslationBase.of(context).referral, + color: Color(0xFF2B353E), + secondLineFontSize: SizeConfig.getHeightMultiplier(height: height) * + (SizeConfig.isHeightVeryShort + ? 5 + : SizeConfig.isHeightShort ? 7 - : 12),), - - SizedBox( - height: SizeConfig - .getHeightMultiplier( - height: height) * - (SizeConfig.isHeightVeryShort - ? 5 - : SizeConfig.isHeightShort - ? 10 - : 5) - ) - ], - ),), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - RowCounts( - dashboardItemList![2] - .summaryoptions![0] - .kPIParameter, - dashboardItemList![2] - .summaryoptions![0] - .value!, - Colors.black, height: height!,), - RowCounts( - dashboardItemList![2] - .summaryoptions![1] - .kPIParameter, - dashboardItemList![2] - .summaryoptions![1] - .value!, - Colors.grey, height: height!,), - RowCounts( - - dashboardItemList![2] - .summaryoptions![2] - .kPIParameter, - dashboardItemList![2] - .summaryoptions![2] - .value!, - Colors.red, height: height!,), - ], + : 12), ), - ) - ], - )), - ), - Expanded( - flex: 3, - child: Stack(children: [ - Container( - padding:EdgeInsets.all(0), - - child: GaugeChart( - _createReferralData(dashboardItemList!))), - Positioned( + SizedBox( + height: SizeConfig.getHeightMultiplier(height: height) * + (SizeConfig.isHeightVeryShort + ? 5 + : SizeConfig.isHeightShort + ? 10 + : 5)) + ], + ), + ), + Expanded( + flex: 1, child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - model! - .getPatientCount(dashboardItemList![2]) - .toString(), - fontSize: SizeConfig.textMultiplier * 3.0, - fontWeight: FontWeight.bold, - ) + RowCounts( + dashboardItemList![2].summaryoptions![0].kPIParameter, + dashboardItemList![2].summaryoptions![0].value!, + Colors.black, + height: height!, + ), + RowCounts( + dashboardItemList![2].summaryoptions![1].kPIParameter, + dashboardItemList![2].summaryoptions![1].value!, + Colors.grey, + height: height!, + ), + RowCounts( + dashboardItemList![2].summaryoptions![2].kPIParameter, + dashboardItemList![2].summaryoptions![2].value!, + Colors.red, + height: height!, + ), ], ), - top: height! * (SizeConfig.isHeightVeryShort?0.35:0.40), - left: 0, - right: 0) - ]), - ), - ], - )), - ])); + ) + ], + )), + ), + Expanded( + flex: 3, + child: Stack(children: [ + Container(padding: EdgeInsets.all(0), child: GaugeChart(_createReferralData(dashboardItemList!))), + Positioned( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + model!.getPatientCount(dashboardItemList![2]).toString(), + fontSize: SizeConfig.textMultiplier * 3.0, + fontWeight: FontWeight.bold, + ) + ], + ), + top: height! * (SizeConfig.isHeightVeryShort ? 0.35 : 0.40), + left: 0, + right: 0) + ]), + ), + ], + )), + ])); } + static List> _createReferralData(List dashboardItemList) { final data = [ - new GaugeSegment( - dashboardItemList![2].summaryoptions![0].kPIParameter!, - getValue(dashboardItemList![1].summaryoptions![0].value), - charts.MaterialPalette.black), - new GaugeSegment( - dashboardItemList![2].summaryoptions![1].kPIParameter!, - getValue(dashboardItemList[1].summaryoptions![1].value), - charts.MaterialPalette.gray.shadeDefault), - new GaugeSegment( - dashboardItemList[2].summaryoptions![2].kPIParameter!, - getValue(dashboardItemList[1].summaryoptions![2].value), - charts.MaterialPalette.red.shadeDefault), + new GaugeSegment(dashboardItemList[2].summaryoptions![0].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![0].value), charts.MaterialPalette.black), + new GaugeSegment(dashboardItemList[2].summaryoptions![1].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![1].value), charts.MaterialPalette.gray.shadeDefault), + new GaugeSegment(dashboardItemList[2].summaryoptions![2].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![2].value), charts.MaterialPalette.red.shadeDefault), ]; return [ @@ -191,5 +155,4 @@ class DashboardReferralPatient extends StatelessWidget { static int getValue(value) { return value == 0 ? 1 : value; } - -} \ No newline at end of file +} diff --git a/lib/screens/home/dashboard_slider-item-widget.dart b/lib/screens/home/dashboard_slider-item-widget.dart index a78cfd1f..3c633430 100644 --- a/lib/screens/home/dashboard_slider-item-widget.dart +++ b/lib/screens/home/dashboard_slider-item-widget.dart @@ -15,18 +15,24 @@ class DashboardSliderItemWidget extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - Row( + Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Label(firstLine:Helpers.getLabelFromKPI(item!.kPIName!) ,secondLine:Helpers.getNameFromKPI(item!.kPIName!), ), - + Label( + firstLine: Helpers.getLabelFromKPI(item.kPIName!), + secondLine: Helpers.getNameFromKPI(item.kPIName!), + ), ], ), - - - - new Container( - height: SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightShort?14:SizeConfig.isHeightLarge?15:13), + new Container( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort + ? 16 + : SizeConfig.isHeightShort + ? 14 + : SizeConfig.isHeightLarge + ? 15 + : 13), child: ListView( scrollDirection: Axis.horizontal, children: List.generate(item.summaryoptions!.length, (int index) { diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 95897dd3..5c97cb9c 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -38,8 +38,8 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { bool isLoading = false; - ProjectViewModel ?projectsProvider; - DoctorProfileModel ?profile; + ProjectViewModel? projectsProvider; + DoctorProfileModel? profile; bool isExpanded = false; bool isInpatient = false; int sliderActiveIndex = 0; @@ -48,7 +48,6 @@ class _HomeScreenState extends State { int colorIndex = 0; final GlobalKey scaffoldKey = new GlobalKey(); - @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); @@ -60,7 +59,6 @@ class _HomeScreenState extends State { } return BaseView( - onModelReady: (model) async { await model.setFirebaseNotification(projectsProvider, authenticationViewModel); await model.getDashboard(); @@ -71,9 +69,9 @@ class _HomeScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: HomeScreenHeader( + appBar: HomeScreenHeader( model: model, - onOpenDrawer: (){ + onOpenDrawer: () { Scaffold.of(context).openDrawer(); }, ), @@ -108,13 +106,10 @@ class _HomeScreenState extends State { height: SizeConfig.heightMultiplier * 3, ), sliderActiveIndex == 1 - ? DashboardSliderItemWidget( - model.dashboardItemsList[4]) + ? DashboardSliderItemWidget(model.dashboardItemsList[4]) : sliderActiveIndex == 0 - ? DashboardSliderItemWidget( - model.dashboardItemsList[3]) - : DashboardSliderItemWidget( - model.dashboardItemsList[6]), + ? DashboardSliderItemWidget(model.dashboardItemsList[3]) + : DashboardSliderItemWidget(model.dashboardItemsList[6]), ], ), ), @@ -131,7 +126,8 @@ class _HomeScreenState extends State { borderRadius: BorderRadius.only( topRight: Radius.circular(70), )), - padding: EdgeInsets.only(left: SizeConfig.widthMultiplier * 3.1, top: 10, right: SizeConfig.widthMultiplier * 3.1), + padding: EdgeInsets.only( + left: SizeConfig.widthMultiplier * 3.1, top: 10, right: SizeConfig.widthMultiplier * 3.1), margin: EdgeInsets.only(top: 10), child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -154,7 +150,9 @@ class _HomeScreenState extends State { ? 16 : SizeConfig.isHeightShort ? 14 - : SizeConfig.isHeightLarge?15:13), + : SizeConfig.isHeightLarge + ? 15 + : 13), child: ListView( scrollDirection: Axis.horizontal, children: [ @@ -162,8 +160,13 @@ class _HomeScreenState extends State { ], ), ), - SizedBox(height: SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?3:SizeConfig.isHeightShort?4:2)) - + SizedBox( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort + ? 3 + : SizeConfig.isHeightShort + ? 4 + : 2)) ], ), ), @@ -174,7 +177,7 @@ class _HomeScreenState extends State { ); } - List homePatientsCardsWidget(DashboardViewModel model,projectsProvider) { + List homePatientsCardsWidget(DashboardViewModel model, projectsProvider) { colorIndex = 0; // List backgroundColors = List(3); @@ -193,7 +196,6 @@ class _HomeScreenState extends State { // List patientCards = []; // - List backgroundColors = []; backgroundColors.add(Color(0xffD02127)); backgroundColors.add(Colors.grey[300]!); @@ -239,8 +241,9 @@ class _HomeScreenState extends State { Navigator.push( context, FadePage( - page: PatientInPatientScreen(specialClinic: model!.getSpecialClinic(clinicId??projectsProvider - !.doctorClinicsList[0]!.clinicID!),), + page: PatientInPatientScreen( + specialClinic: model.getSpecialClinic(clinicId ?? projectsProvider!.doctorClinicsList[0]!.clinicID!), + ), ), ); }, @@ -327,6 +330,3 @@ class _HomeScreenState extends State { } } } - - - diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart index 4b9200ad..00cb9579 100644 --- a/lib/screens/live_care/live-care_transfer_to_admin.dart +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -110,20 +110,20 @@ class _LivaCareTransferToAdminState extends State { if (noteController.text.isNotEmpty) { Helpers.showConfirmationDialog(context, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?", - () async { - Navigator.of(context).pop(); - GifLoaderDialogUtils.showMyDialog(context); - await model.transferToAdmin(widget!.patient!.vcId!, noteController.text); - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast("You successfully transfer to admin"); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - } - }); + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + await model.transferToAdmin(widget.patient.vcId!, noteController.text); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast("You successfully transfer to admin"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + }); } }); }, diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index 6dff0abc..7fab2bd8 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -104,10 +104,9 @@ class _MedicalFileDetailsState extends State { isPrescriptions: true, isMedicalFile: true, episode: episode, - visitDate: - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat( - vistDate, - ), isArabic: projectViewModel.isArabic)}', + visitDate: '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat( + vistDate, + ), isArabic: projectViewModel.isArabic)}', isAppointmentHeader: true, ); @@ -128,30 +127,20 @@ class _MedicalFileDetailsState extends State { model.getMedicalFile(mrn: pp); } }, - builder: - (BuildContext? context, MedicalFileViewModel? model, Widget ?child) => - AppScaffold( - patientProfileAppBarModel: patientProfileAppBarModel!, - isShowAppBar: true, - appBarTitle: TranslationBase - .of(context!)! - .medicalReport! - .toUpperCase(), - body: NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Center( - child: Container( - child: Column( - children: [ - model!.medicalFileList!.length != 0 && - model - .medicalFileList![0] - .entityList![0] - .timelines![encounterNumber] - .timeLineEvents![0] - .consulations! - .length != + builder: (BuildContext? context, MedicalFileViewModel? model, Widget? child) => AppScaffold( + patientProfileAppBarModel: patientProfileAppBarModel!, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context!).medicalReport!.toUpperCase(), + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Center( + child: Container( + child: Column( + children: [ + model!.medicalFileList.length != 0 && + model.medicalFileList[0].entityList![0].timelines![encounterNumber].timeLineEvents![0] + .consulations!.length != 0 ? Padding( padding: EdgeInsets.all(10.0), @@ -160,7 +149,7 @@ class _MedicalFileDetailsState extends State { children: [ SizedBox(height: 25.0), if (model.medicalFileList.length != 0 && - model.medicalFileList![0].entityList![0].timelines![encounterNumber] + model.medicalFileList[0].entityList![0].timelines![encounterNumber] .timeLineEvents![0].consulations!.length != 0) Container( @@ -205,7 +194,7 @@ class _MedicalFileDetailsState extends State { scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -224,7 +213,7 @@ class _MedicalFileDetailsState extends State { Expanded( child: AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -254,7 +243,7 @@ class _MedicalFileDetailsState extends State { height: 30, ), if (model.medicalFileList.length != 0 && - model.medicalFileList![0].entityList![0].timelines![encounterNumber] + model.medicalFileList[0].entityList![0].timelines![encounterNumber] .timeLineEvents![0].consulations!.length != 0) Container( @@ -297,7 +286,7 @@ class _MedicalFileDetailsState extends State { scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -319,7 +308,7 @@ class _MedicalFileDetailsState extends State { ), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -342,7 +331,7 @@ class _MedicalFileDetailsState extends State { Expanded( child: AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -361,7 +350,7 @@ class _MedicalFileDetailsState extends State { Expanded( child: AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -383,7 +372,7 @@ class _MedicalFileDetailsState extends State { Expanded( child: AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -401,7 +390,7 @@ class _MedicalFileDetailsState extends State { ), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -432,7 +421,7 @@ class _MedicalFileDetailsState extends State { height: 30, ), if (model.medicalFileList.length != 0 && - model.medicalFileList![0].entityList![0].timelines![encounterNumber] + model.medicalFileList[0].entityList![0].timelines![encounterNumber] .timeLineEvents![0].consulations!.length != 0) Container( @@ -475,7 +464,7 @@ class _MedicalFileDetailsState extends State { scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -498,7 +487,7 @@ class _MedicalFileDetailsState extends State { ), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -520,7 +509,7 @@ class _MedicalFileDetailsState extends State { AppText( AppDateUtils.getDateFormatted(DateTime.parse( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -544,7 +533,7 @@ class _MedicalFileDetailsState extends State { Expanded( child: AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -563,7 +552,7 @@ class _MedicalFileDetailsState extends State { ), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -600,7 +589,7 @@ class _MedicalFileDetailsState extends State { height: 30, ), if (model.medicalFileList.length != 0 && - model.medicalFileList![0].entityList![0].timelines![encounterNumber] + model.medicalFileList[0].entityList![0].timelines![encounterNumber] .timeLineEvents![0].consulations!.length != 0) Container( @@ -645,7 +634,7 @@ class _MedicalFileDetailsState extends State { scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -663,7 +652,7 @@ class _MedicalFileDetailsState extends State { AppText(TranslationBase.of(context).examType! + ": "), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -678,7 +667,7 @@ class _MedicalFileDetailsState extends State { children: [ AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -694,7 +683,7 @@ class _MedicalFileDetailsState extends State { AppText(TranslationBase.of(context).abnormal! + ": "), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] @@ -710,7 +699,7 @@ class _MedicalFileDetailsState extends State { ), AppText( model - .medicalFileList![0] + .medicalFileList[0] .entityList![0] .timelines![encounterNumber] .timeLineEvents![0] diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 8a9d3cef..b43ac22b 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -62,87 +62,87 @@ class _InPatientPageState extends State { model.filterSearchResults(value); }), ), - model.state == ViewState.Idle?model.filteredInPatientItems.length > 0 - ? Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...List.generate(model.filteredInPatientItems.length, (index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: model.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: - model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID, - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + model.state == ViewState.Idle + ? model.filteredInPatientItems.length > 0 + ? Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: SingleChildScrollView( + child: ListView.builder( + physics: const AlwaysScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: 70, + itemBuilder: (context, index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: model.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: + model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": model.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else if (model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: model.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: - model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID, - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else if (model.filteredInPatientItems[index].doctorId == + model.doctorProfile!.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: model.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: + model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": model.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else + return SizedBox(); + }), + ), ), - ), - ), - ) - : Expanded( - child: SingleChildScrollView( - child: Container(child: ErrorMessage(error: TranslationBase.of(context).noDataAvailable ?? "")), - ), - ): Center( + ) + : Expanded( + child: SingleChildScrollView( + child: + Container(child: ErrorMessage(error: TranslationBase.of(context).noDataAvailable ?? "")), + ), + ) + : Center( child: Container( height: 300, width: 300, - child: Image.asset( - "assets/images/progress-loading-red.gif"), + child: Image.asset("assets/images/progress-loading-red.gif"), ), ), ], diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index 9090f24b..411228ed 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -37,7 +37,7 @@ class _InsuranceApprovalScreenNewState extends State ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) : patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient?.appointmentNo, projectId: patient.projectId) + appointmentNo: patient.appointmentNo, projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget? child) => AppScaffold( patientProfileAppBarModel: PatientProfileAppBarModel( diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index 1d039a72..a506b113 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -32,8 +32,8 @@ class _InsuranceApprovalsDetailsState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context!); - final routeArgs = ModalRoute.of(context!)!.settings.arguments as Map; + ProjectViewModel projectViewModel = Provider.of(context); + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; return BaseView( onModelReady: (model) => model.insuranceApprovalInPatient.length == 0 @@ -44,747 +44,599 @@ class _InsuranceApprovalsDetailsState extends State { appointmentNo: patient.appointmentNo, projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient) : null, - builder: (BuildContext? context, InsuranceViewModel? model, Widget? child) => - AppScaffold( - isShowAppBar: true, - baseViewModel: model, - patientProfileAppBarModel: - PatientProfileAppBarModel(patient: patient), - body: patient.admissionNo != null - ? SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + builder: (BuildContext? context, InsuranceViewModel? model, Widget? child) => AppScaffold( + isShowAppBar: true, + baseViewModel: model, + patientProfileAppBarModel: PatientProfileAppBarModel(patient: patient), + body: patient.admissionNo != null + ? SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - TranslationBase.of(context!).insurance22, - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context!).approvals22, - fontSize: 30.0, - fontWeight: FontWeight.w700, - ), - ], + AppText( + TranslationBase.of(context!).insurance22, + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', ), ], ), - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), + Row( + children: [ + AppText( + TranslationBase.of(context).approvals22, + fontSize: 30.0, + fontWeight: FontWeight.w700, ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - .approvalStatusDescption != - null - ? model!.insuranceApprovalInPatient[ - indexInsurance] - .approvalStatusDescption ?? - "" - : "", - color: model!.insuranceApprovalInPatient[ - indexInsurance] - .approvalStatusDescption != - null - ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == - "Approved" || - "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == - "تمت الموافقة" - ? Color(0xff359846) - : Color(0xffD02127) - : Color(0xffD02127), - ), - ], - ), - Row( - children: [ - AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - .doctorName! - .toUpperCase(), - color: Colors.black, - fontSize: 18, - fontWeight: FontWeight.bold, - ) - ], + AppText( + model!.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption != null + ? model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption ?? + "" + : "", + color: model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption != + null + ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == + "Approved" || + "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == + "تمت الموافقة" + ? Color(0xff359846) + : Color(0xffD02127) + : Color(0xffD02127), ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( + ], + ), + Row( + children: [ + AppText( + model.insuranceApprovalInPatient[indexInsurance].doctorName!.toUpperCase(), + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Column( children: [ - Column( - children: [ - Container( - height: 85.0, - width: 85.0, - child: CircleAvatar( - radius: SizeConfig - .imageSizeMultiplier * - 12, - // radius: (52) - child: ClipRRect( - borderRadius: - BorderRadius.circular( - 50), - child: Image.network( - model!.insuranceApprovalInPatient[ - indexInsurance] - .doctorImage!, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: - Colors.transparent, + Container( + height: 85.0, + width: 85.0, + child: CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(50), + child: Image.network( + model.insuranceApprovalInPatient[indexInsurance].doctorImage!, + fit: BoxFit.fill, + width: 700, ), ), - ], + backgroundColor: Colors.transparent, + ), ), - Expanded( - child: Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25.0, + ), + Row( children: [ - SizedBox( - height: 25.0, + AppText( + TranslationBase.of(context).clinic! + ": ", + color: Colors.grey[500], + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .clinic! + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - Expanded( - child: AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - .clinicName, - fontSize: 14, - ), - ) - ], + Expanded( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance].clinicName, + fontSize: 14, + ), + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).approvalNo! + ": ", + color: Colors.grey[500], + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .approvalNo! + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - .approvalNo - .toString(), - fontSize: 14, - ) - ], + AppText( + model.insuranceApprovalInPatient[indexInsurance].approvalNo + .toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + 'Unused Count:', + color: Colors.grey[500], + fontSize: 14, ), - Row( - children: [ - AppText( - 'Unused Count:', - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - .unUsedCount - .toString(), - fontSize: 14, - ) - ], + AppText( + model.insuranceApprovalInPatient[indexInsurance].unUsedCount + .toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).companyName! + ": ", + color: Colors.grey[500], ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .companyName! + - ": ", - color: Colors.grey[500], - ), - AppText('Sample') - ], + AppText('Sample') + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).receiptOn! + ": ", + color: Colors.grey[500], ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .receiptOn! + - ": ", - color: Colors.grey[500], - ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn!), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: - FontWeight.w600, - ), - ), - ], + Expanded( + child: AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + ), ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .expiryDate! + - ": ", - color: Colors.grey[500], - ), - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: - FontWeight.w600, - ), - ], + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).expiryDate! + ": ", + color: Colors.grey[500], + ), + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, ), ], ), - ), + ], ), - ], + ), ), - ), - SizedBox( - height: 20.0, - ), - Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( - children: [ - Expanded( - child: AppText( - TranslationBase.of(context!) - .procedure, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context!) - .status, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context!) - .usageStatus, - fontWeight: FontWeight.w700, - ), - ) - ], + ], + ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context).procedure, + fontWeight: FontWeight.w700, + ), ), - ), - Divider( - color: Colors.black, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model!.insuranceApprovalInPatient[ - indexInsurance] - .apporvalDetails! - .length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Column( + Expanded( + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).usageStatus, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model + .insuranceApprovalInPatient[indexInsurance].apporvalDetails!.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: Container( - child: AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - ?.apporvalDetails![ - index] - ?.procedureName ?? - "", - textAlign: - TextAlign - .start, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - ?.apporvalDetails![ - index] - ?.status ?? - "", - textAlign: - TextAlign - .center, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model!.insuranceApprovalInPatient[ - indexInsurance] - ?.apporvalDetails![ - index] - ?.isInvoicedDesc ?? - "", - textAlign: - TextAlign - .center, - ), - ), + Expanded( + child: Container( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance] + .apporvalDetails![index].procedureName ?? + "", + textAlign: TextAlign.start, ), - ], + ), ), - SizedBox( - width: 5, + Expanded( + child: Container( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance] + .apporvalDetails![index].status ?? + "", + textAlign: TextAlign.center, + ), + ), ), - Divider( - color: Colors.black38, + Expanded( + child: Container( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance] + .apporvalDetails![index].isInvoicedDesc ?? + "", + textAlign: TextAlign.center, + ), + ), ), ], ), - ); - }), - ), - ], + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, + ), + ], + ), + ); + }), ), - ), - ], + ], + ), ), - ), + ], ), - ], + ), ), - ), - ) - : SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ], + ), + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - TranslationBase.of(context!).insurance22, - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context!).approvals22, - fontSize: 30.0, - fontWeight: FontWeight.w700, - ), - ], + AppText( + TranslationBase.of(context!).insurance22, + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', ), ], ), - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), + Row( + children: [ + AppText( + TranslationBase.of(context).approvals22, + fontSize: 30.0, + fontWeight: FontWeight.w700, ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - model!.insuranceApproval[ - indexInsurance] - .approvalStatusDescption != - null - ? model!.insuranceApproval[ - indexInsurance] - .approvalStatusDescption ?? - "" - : "", - color: model!.insuranceApproval[ - indexInsurance] - .approvalStatusDescption != - null - ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == - "Approved" - ? Color(0xff359846) - : Color(0xffD02127) - : Color(0xffD02127), - ), - ], + AppText( + model!.insuranceApproval[indexInsurance].approvalStatusDescption != null + ? model.insuranceApproval[indexInsurance].approvalStatusDescption ?? "" + : "", + color: model.insuranceApproval[indexInsurance].approvalStatusDescption != null + ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == + "Approved" + ? Color(0xff359846) + : Color(0xffD02127) + : Color(0xffD02127), ), - Row( - children: [ - AppText( - model!.insuranceApproval[indexInsurance] - .doctorName! - .toUpperCase(), - color: Colors.black, - fontSize: 18, - fontWeight: FontWeight.bold, - ) - ], - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( + ], + ), + Row( + children: [ + AppText( + model.insuranceApproval[indexInsurance].doctorName!.toUpperCase(), + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Column( children: [ - Column( - children: [ - Container( - height: 85.0, - width: 85.0, - child: CircleAvatar( - radius: SizeConfig - .imageSizeMultiplier * - 12, - // radius: (52) - child: ClipRRect( - borderRadius: - BorderRadius.circular( - 50), - child: Image.network( - model!.insuranceApproval[ - indexInsurance] - .doctorImage!, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: - Colors.transparent, + Container( + height: 85.0, + width: 85.0, + child: CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(50), + child: Image.network( + model.insuranceApproval[indexInsurance].doctorImage!, + fit: BoxFit.fill, + width: 700, ), ), - ], + backgroundColor: Colors.transparent, + ), ), - Expanded( - child: Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25.0, + ), + Row( children: [ - SizedBox( - height: 25.0, + AppText( + TranslationBase.of(context).clinic! + ": ", + color: Colors.grey[500], + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .clinic! + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - Expanded( - child: AppText( - model!.insuranceApproval[ - indexInsurance] - .clinicName, - fontSize: 14, - ), - ) - ], + Expanded( + child: AppText( + model.insuranceApproval[indexInsurance].clinicName, + fontSize: 14, + ), + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).approvalNo! + ": ", + color: Colors.grey[500], + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .approvalNo! + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model!.insuranceApproval[ - indexInsurance] - .approvalNo - .toString(), - fontSize: 14, - ) - ], + AppText( + model.insuranceApproval[indexInsurance].approvalNo.toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).unusedCount! + ": ", + color: Colors.grey[500], + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .unusedCount! + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model!.insuranceApproval[ - indexInsurance] - .unUsedCount - .toString(), - fontSize: 14, - ) - ], + AppText( + model.insuranceApproval[indexInsurance].unUsedCount.toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).companyName! + ": ", + color: Colors.grey[500], ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .companyName! + - ": ", - color: Colors.grey[500], - ), - AppText('Sample') - ], + AppText('Sample') + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).receiptOn! + ": ", + color: Colors.grey[500], ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .receiptOn! + - ": ", - color: Colors.grey[500], - ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn!), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: - FontWeight.w600, - ), - ), - ], + Expanded( + child: AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + ), ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .expiryDate! + - ": ", - color: Colors.grey[500], - ), - if (model!.insuranceApproval[ - indexInsurance] - .expiryDate != - null) - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model!.insuranceApproval[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: - FontWeight.w600, - ), - ], + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).expiryDate! + ": ", + color: Colors.grey[500], ), + if (model.insuranceApproval[indexInsurance].expiryDate != null) + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + ), ], ), - ), + ], ), - ], + ), ), - ), - SizedBox( - height: 20.0, - ), - Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( - children: [ - Expanded( - child: AppText( - TranslationBase.of(context!) - .procedure, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context!) - .status, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context!) - .usageStatus, - fontWeight: FontWeight.w700, - ), - ) - ], + ], + ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context).procedure, + fontWeight: FontWeight.w700, + ), ), - ), - Divider( - color: Colors.black, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model!.insuranceApproval[ - indexInsurance] - .apporvalDetails! - .length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Column( + Expanded( + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).usageStatus, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model.insuranceApproval[indexInsurance].apporvalDetails!.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: Container( - child: AppText( - model!.insuranceApproval[ - indexInsurance] - ?.apporvalDetails![ - index] - ?.procedureName ?? - "", - textAlign: - TextAlign - .start, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model!.insuranceApproval[ - indexInsurance] - ?.apporvalDetails![ - index] - ?.status ?? - "", - textAlign: - TextAlign - .center, - ), - ), + Expanded( + child: Container( + child: AppText( + model.insuranceApproval[indexInsurance] + .apporvalDetails![index].procedureName ?? + "", + textAlign: TextAlign.start, ), - Expanded( - child: Container( - child: AppText( - model!.insuranceApproval[ - indexInsurance] - ?.apporvalDetails![ - index] - ?.isInvoicedDesc ?? - "", - textAlign: - TextAlign - .center, - ), - ), - ), - ], + ), ), - SizedBox( - width: 5, + Expanded( + child: Container( + child: AppText( + model.insuranceApproval[indexInsurance] + .apporvalDetails![index].status ?? + "", + textAlign: TextAlign.center, + ), + ), ), - Divider( - color: Colors.black38, + Expanded( + child: Container( + child: AppText( + model.insuranceApproval[indexInsurance] + .apporvalDetails![index].isInvoicedDesc ?? + "", + textAlign: TextAlign.center, + ), + ), ), ], ), - ); - }), - ), - ], + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, + ), + ], + ), + ); + }), ), - ), - ], + ], + ), ), - ), + ], ), - ], + ), ), - ), - )), + ], + ), + ), + )), ); } } diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index b1be78ed..a524a7b9 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -44,7 +44,7 @@ class _PatientSearchScreenState extends State { child: Center( child: Column( children: [ - BottomSheetTitle(title: TranslationBase.of(context).searchPatient!!), + BottomSheetTitle(title: TranslationBase.of(context).searchPatient!), FractionallySizedBox( widthFactor: 0.9, child: Container( diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index b9783a9b..d807ba54 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -37,10 +37,11 @@ class _LaboratoryResultPageState extends State { builder: (_, model, w) => AppScaffold( isShowAppBar: true, patientProfileAppBarModel: PatientProfileAppBarModel( - patient:widget.patient,isInpatient:widget.isInpatient, - isFromLabResult: true, - appointmentDate: widget.patientLabOrders.orderDate!,), - + patient: widget.patient, + isInpatient: widget.isInpatient, + isFromLabResult: true, + appointmentDate: widget.patientLabOrders.orderDate!, + ), baseViewModel: model, body: AppScaffold( isShowAppBar: false, @@ -50,9 +51,8 @@ class _LaboratoryResultPageState extends State { LaboratoryResultWidget( onTap: () async {}, billNo: widget.patientLabOrders.invoiceNo!, - details: model.patientLabSpecialResult.length > 0 - ? model.patientLabSpecialResult[0]!.resultDataHTML - : null, + details: + model.patientLabSpecialResult.length > 0 ? model.patientLabSpecialResult[0].resultDataHTML : null, orderNo: widget.patientLabOrders.orderNo!, patientLabOrder: widget.patientLabOrders, patient: widget.patient, diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 1f78b242..b898f849 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -54,85 +54,81 @@ class _AddVerifyMedicalReportState extends State { child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // if (model.medicalReportTemplate.length > 0) - HtmlRichEditor( - initialText: (medicalReport != null - ? medicalReport.reportDataHtml - : model!.medicalReportTemplate! - .length! > 0 ? model.medicalReportTemplate[0].templateTextHtml!: ""), - hint: "Write the medical report ", - controller: _controller, - height: - MediaQuery - .of(context) - .size - .height * - 0.75, + children: [ + // if (model.medicalReportTemplate.length > 0) + HtmlRichEditor( + initialText: (medicalReport != null + ? medicalReport.reportDataHtml + : model.medicalReportTemplate.length > 0 + ? model.medicalReportTemplate[0].templateTextHtml! + : ""), + hint: "Write the medical report ", + controller: _controller, + height: MediaQuery.of(context).size.height * 0.75, + ), + ], ), - ], + ), + ), ), - ), + ], ), ), - ], - ), - ), - ), - Container( - padding: EdgeInsets.all(16.0), - color: Colors.white, - child: Row( - children: [ - Expanded( - child: AppButton( - title: status == MedicalReportStatus.ADD - ? TranslationBase.of(context).save - : TranslationBase.of(context).save, - color: Color(0xffEAEAEA), - fontColor: Colors.black, - // disabled: progressNoteController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () async { - String txtOfMedicalReport = await _controller.getText(); + ), + Container( + padding: EdgeInsets.all(16.0), + color: Colors.white, + child: Row( + children: [ + Expanded( + child: AppButton( + title: status == MedicalReportStatus.ADD + ? TranslationBase.of(context).save + : TranslationBase.of(context).save, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + // disabled: progressNoteController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + String txtOfMedicalReport = await _controller.getText(); - if (txtOfMedicalReport.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - await model.insertMedicalReport(patient, txtOfMedicalReport); - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } - } - }, + if (txtOfMedicalReport.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + await model.insertMedicalReport(patient, txtOfMedicalReport); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + } + }, + ), + ), + SizedBox( + width: 8, + ), + if (medicalReport != null) + Expanded( + child: AppButton( + title: status == MedicalReportStatus.ADD + ? TranslationBase.of(context).add + : TranslationBase.of(context).verify, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.verifyMedicalReport(patient, medicalReport); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }, + ), + ), + ], ), ), - SizedBox( - width: 8, - ), - if (medicalReport != null) - Expanded( - child: AppButton( - title: status == MedicalReportStatus.ADD - ? TranslationBase.of(context).add - : TranslationBase.of(context).verify, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.verifyMedicalReport(patient, medicalReport); - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } - }, - ), - ), ], ), - ), - ], - ), )); } diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index 8e47ba60..bcf09283 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -77,8 +77,7 @@ class _ProgressNoteState extends State { baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor, patientProfileAppBarModel: PatientProfileAppBarModel( - patient: - patient, + patient: patient, isInpatient: true, ), body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0 @@ -115,21 +114,21 @@ class _ProgressNoteState extends State { child: CardWithBgWidget( hasBorder: false, bgColor: model.patientProgressNoteList[index].status == 1 && - authenticationViewModel!.doctorProfile!.doctorID != + authenticationViewModel.doctorProfile!.doctorID != model.patientProgressNoteList[index].createdBy ? Color(0xFFCC9B14) : model.patientProgressNoteList[index].status == 4 ? Colors.red.shade700 : model.patientProgressNoteList[index].status == 2 ? Colors.green[600]! - : Color(0xFFCC9B14)!, + : Color(0xFFCC9B14), widget: Column( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ if (model.patientProgressNoteList[index].status == 1 && - authenticationViewModel!.doctorProfile!.doctorID != + authenticationViewModel.doctorProfile!.doctorID != model.patientProgressNoteList[index].createdBy) AppText( TranslationBase.of(context).notePending, @@ -153,7 +152,7 @@ class _ProgressNoteState extends State { ), if (model.patientProgressNoteList[index].status != 2 && model.patientProgressNoteList[index].status != 4 && - authenticationViewModel!.doctorProfile!.doctorID == + authenticationViewModel.doctorProfile!.doctorID == model.patientProgressNoteList[index].createdBy) Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -352,9 +351,9 @@ class _ProgressNoteState extends State { ? AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDateTimeFromServerFormat( model.patientProgressNoteList[index].createdOn ?? ""), - isArabic: projectViewModel!.isArabic) + isArabic: projectViewModel.isArabic) : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), - isArabic: projectViewModel!.isArabic), + isArabic: projectViewModel.isArabic), fontWeight: FontWeight.w600, fontSize: 14, ), @@ -445,7 +444,7 @@ class _ProgressNoteState extends State { padding: EdgeInsets.all(20), color: Colors.white, child: AppText( - projectViewModel!.isArabic + projectViewModel.isArabic ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟" : 'Are you sure you want $actionName this order?', fontSize: 15, diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index a2ceb550..724bdb15 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -55,7 +55,7 @@ class _PatientProfileScreenState extends State with Single int _activeTab = 0; late StreamController videoCallDurationStreamController; - late Stream videoCallDurationStream; //= (() async*{})(); TODO Elham* + late Stream videoCallDurationStream; //= (() async*{})(); TODO Elham* @override void initState() { _tabController = TabController(length: 2, vsync: this); @@ -94,7 +94,7 @@ class _PatientProfileScreenState extends State with Single if (routeArgs.containsKey("isFromLiveCare")) { isFromLiveCare = routeArgs['isFromLiveCare']; } - if(routeArgs.containsKey("isCallFinished")) { + if (routeArgs.containsKey("isCallFinished")) { isCallFinished = routeArgs['isCallFinished']; } if (isInpatient) @@ -104,7 +104,7 @@ class _PatientProfileScreenState extends State with Single } late StreamSubscription callTimer; - callConnected(){ + callConnected() { callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) ..onDone(() { callTimer.cancel(); @@ -115,7 +115,7 @@ class _PatientProfileScreenState extends State with Single }); } - callDisconnected(){ + callDisconnected() { callTimer.cancel(); videoCallDurationStreamController.sink.add(''); } @@ -134,8 +134,9 @@ class _PatientProfileScreenState extends State with Single children: [ Column( children: [ - PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType, - videoCallDurationStream: videoCallDurationStream,isInpatient: isInpatient, + PatientProfileHeaderNewDesignAppBar(patient, arrivalType, patientType, + videoCallDurationStream: videoCallDurationStream, + isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, height: (patient.patientStatusType != null && patient.patientStatusType == 43) ? 210 @@ -192,7 +193,7 @@ class _PatientProfileScreenState extends State with Single ), if (isFromLiveCare ? patient.episodeNo != null - :patient.patientStatusType != null && patient.patientStatusType == 43) + : patient.patientStatusType != null && patient.patientStatusType == 43) BaseView( onModelReady: (model) async {}, builder: (_, model, w) => Positioned( @@ -208,7 +209,9 @@ class _PatientProfileScreenState extends State with Single "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", color: isFromLiveCare ? Colors.red.shade700 - :patient.patientStatusType == 43 ? Colors.red.shade700 : Colors.grey.shade700, + : patient.patientStatusType == 43 + ? Colors.red.shade700 + : Colors.grey.shade700, fontColor: Colors.white, vPadding: 8, radius: 30, @@ -222,8 +225,9 @@ class _PatientProfileScreenState extends State with Single ), onPressed: () async { if ((isFromLiveCare && - patient.appointmentNo != null && - patient.appointmentNo != 0) ||patient.patientStatusType == 43) { + patient.appointmentNo != null && + patient.appointmentNo != 0) || + patient.patientStatusType == 43) { PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( appointmentNo: patient.appointmentNo, patientMRN: patient.patientMRN); GifLoaderDialogUtils.showMyDialog(context); @@ -239,9 +243,11 @@ class _PatientProfileScreenState extends State with Single AppButton( title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color:isFromLiveCare - ? Colors.red.shade700 - :patient.patientStatusType == 43 ? Colors.red.shade700 : Colors.grey.shade700, + color: isFromLiveCare + ? Colors.red.shade700 + : patient.patientStatusType == 43 + ? Colors.red.shade700 + : Colors.grey.shade700, fontColor: Colors.white, vPadding: 8, radius: 30, @@ -255,9 +261,9 @@ class _PatientProfileScreenState extends State with Single ), onPressed: () { if ((isFromLiveCare && - patient.appointmentNo != - null && - patient.appointmentNo != 0) ||patient.patientStatusType == 43) { + patient.appointmentNo != null && + patient.appointmentNo != 0) || + patient.patientStatusType == 43) { Navigator.of(context) .pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); } @@ -298,8 +304,8 @@ class _PatientProfileScreenState extends State with Single disabled: model.state == ViewState.BusyLocal, onPressed: () async { // Navigator.push(context, MaterialPageRoute( - // builder: (BuildContext context) => - // EndCallScreen(patient:patient))) + // builder: (BuildContext context) => + // EndCallScreen(patient:patient))) if (isCallFinished) { Navigator.push( context, @@ -317,30 +323,29 @@ class _PatientProfileScreenState extends State with Single patient.appointmentNo = model.startCallRes.appointmentNo; patient.episodeNo = 0; - GifLoaderDialogUtils.hideDialog(context); - AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ - locator().openVideo(model.startCallRes, patient, callConnected, callDisconnected); - }, type: ''); - - - } - } - - - }, + GifLoaderDialogUtils.hideDialog(context); + AppPermissionsUtils.requestVideoCallPermission( + context: context, + onTapGrant: () { + locator() + .openVideo(model.startCallRes, patient, callConnected, callDisconnected); + }, + type: ''); + } + } + }, + ), + ), ), ), - ), - ), - SizedBox( - height: 5, + SizedBox( + height: 5, + ), + ], ), - ], - ), - ) : null, - ), - - + ) + : null, + ), ); } } diff --git a/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart b/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart index cfd37cd0..5a4eab5f 100644 --- a/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart @@ -21,12 +21,10 @@ class ReplySummeryOnReferralPatient extends StatefulWidget { ReplySummeryOnReferralPatient(this.referredPatient, this.doctorReply); @override - _ReplySummeryOnReferralPatientState createState() => - _ReplySummeryOnReferralPatientState(this.referredPatient); + _ReplySummeryOnReferralPatientState createState() => _ReplySummeryOnReferralPatientState(this.referredPatient); } -class _ReplySummeryOnReferralPatientState - extends State { +class _ReplySummeryOnReferralPatientState extends State { final MyReferralPatientModel referredPatient; _ReplySummeryOnReferralPatientState(this.referredPatient); @@ -41,15 +39,12 @@ class _ReplySummeryOnReferralPatientState body: Container( child: Column( children: [ - Expanded( child: SingleChildScrollView( child: Container( width: double.infinity, - margin: - EdgeInsets.symmetric(horizontal: 16, vertical: 16), - padding: EdgeInsets.symmetric( - horizontal: 16, vertical: 16), + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, @@ -70,7 +65,7 @@ class _ReplySummeryOnReferralPatientState color: Color(0XFF2E303A), ), AppText( - widget.doctorReply ?? '', + widget.doctorReply, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -85,8 +80,7 @@ class _ReplySummeryOnReferralPatientState ), ), Container( - margin: - EdgeInsets.symmetric(horizontal: 16, vertical: 16), + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Row( children: [ Expanded( @@ -99,7 +93,9 @@ class _ReplySummeryOnReferralPatientState color: Colors.red[600], ), ), - SizedBox(width: 4,), + SizedBox( + width: 4, + ), Expanded( child: AppButton( onPressed: () {}, diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 0848eee2..d7f25f5f 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -13,7 +13,6 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ReferredPatientScreen extends StatelessWidget { - PatientType patientType = PatientType.IN_PATIENT; @override @@ -40,71 +39,72 @@ class ReferredPatientScreen extends StatelessWidget { GifLoaderDialogUtils.hideDialog(context); }, ), - ),model.listMyReferredPatientModel == null || model.listMyReferredPatientModel.length == 0 - ? Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 100, + ), + model.listMyReferredPatientModel == null || model.listMyReferredPatientModel.length == 0 + ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + ], ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).referralEmptyMsg, - color: Theme.of(context).errorColor, - ), - ) - ], - ), - ) - : Expanded( - child: SingleChildScrollView( + ) + : Expanded( + child: SingleChildScrollView( // DoctorApplication.svc/REST/GtMyReferredPatient child: Container( child: Column( children: [ - - ...List.generate( - model.listMyReferredPatientModel.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferredPatientDetailScreen(model.getReferredPatientItem(index)), + ...List.generate( + model.listMyReferredPatientModel.length, + (index) => InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferredPatientDetailScreen(model.getReferredPatientItem(index)), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model.getReferredPatientItem(index).referralStatusDesc, + referralStatusCode: model.getReferredPatientItem(index).referralStatus, + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: model.getReferredPatientItem(index).gender, + referredDate: AppDateUtils.convertDateFromServerFormat( + model.getReferredPatientItem(index).referralDate!, "dd/MM/yyyy"), + referredTime: AppDateUtils.convertDateFromServerFormat( + model.getReferredPatientItem(index).referralDate!, "hh:mm a"), + patientID: "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model.getReferredPatientItem(index).isReferralDoctorSameBranch, + isReferral: false, + remark: model.getReferredPatientItem(index).referringDoctorRemarks, + nationality: model.getReferredPatientItem(index).nationalityName, + nationalityFlag: model.getReferredPatientItem(index).nationalityFlagURL, + doctorAvatar: model.getReferredPatientItem(index).doctorImageURL, + referralDoctorName: + "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model.getReferredPatientItem(index).referralClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), + ), ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferredPatientItem(index).referralStatusDesc, - referralStatusCode: model.getReferredPatientItem(index).referralStatus, - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - patientGender: model.getReferredPatientItem(index).gender, - referredDate: AppDateUtils.convertDateFromServerFormat( - model.getReferredPatientItem(index).referralDate!, "dd/MM/yyyy"), - referredTime: AppDateUtils.convertDateFromServerFormat( - model.getReferredPatientItem(index).referralDate!, "hh:mm a"), - patientID: "${model.getReferredPatientItem(index).patientID}", - isSameBranch: model.getReferredPatientItem(index).isReferralDoctorSameBranch, - isReferral: false, - remark: model.getReferredPatientItem(index).referringDoctorRemarks, - nationality: model.getReferredPatientItem(index).nationalityName, - nationalityFlag: model.getReferredPatientItem(index).nationalityFlagURL, - doctorAvatar: model.getReferredPatientItem(index).doctorImageURL, - referralDoctorName: - "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", - clinicDescription: model.getReferredPatientItem(index).referralClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), - ), + ), + ], ), ), - ], - ),), ), - ), + ), ], ), ), @@ -118,8 +118,7 @@ class PatientTypeRadioWidget extends StatefulWidget { PatientTypeRadioWidget(this.radioOnChange); @override - _PatientTypeRadioWidgetState createState() => - _PatientTypeRadioWidgetState(this.radioOnChange); + _PatientTypeRadioWidgetState createState() => _PatientTypeRadioWidgetState(this.radioOnChange); } class _PatientTypeRadioWidgetState extends State { @@ -141,7 +140,7 @@ class _PatientTypeRadioWidgetState extends State { onChanged: (PatientType? value) { setState(() { patientType = value!; - radioOnChange(value!); + radioOnChange(value); }); }, ), diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 91d42e96..66467177 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -198,7 +198,7 @@ class _UpdateAssessmentPageState extends State { ), ), new TextSpan( - text: assessment.appointmentId.toString() ?? "", + text: assessment.appointmentId.toString(), style: new TextStyle( fontSize: 14, color: Color(0xFF2B353E), diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index 1c088af2..8b874f0f 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -38,7 +38,7 @@ class VitalSignDetailsScreen extends StatelessWidget { baseViewModel: mode, isShowAppBar: true, backgroundColor: Theme.of(context).scaffoldBackgroundColor, - patientProfileAppBarModel: PatientProfileAppBarModel(patient:patient), + patientProfileAppBarModel: PatientProfileAppBarModel(patient: patient), appBarTitle: TranslationBase.of(context).vitalSign!, body: mode.patientVitalSignsHistory.length > 0 ? Column( @@ -54,7 +54,7 @@ class VitalSignDetailsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", + "${patient.firstName ?? patient.patientDetails?.firstName ?? patient.fullName ?? ''}'s", fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart index f71306aa..eed82785 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart @@ -190,9 +190,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { appBarTitle: pageTitle ?? "", backgroundColor: Color.fromRGBO(248, 248, 248, 1), isShowAppBar: true, - - - patientProfileAppBarModel: PatientProfileAppBarModel(patient:patient), + patientProfileAppBarModel: PatientProfileAppBarModel(patient: patient), body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -203,7 +201,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", + "${patient.firstName ?? patient.patientDetails?.firstName ?? patient.fullName ?? ''}'s", fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.w600, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index cc6a87be..7fbefeb0 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -71,10 +71,10 @@ postPrescription( prescriptionList.add(PrescriptionRequestModel( covered: true, dose: double.parse(dose ?? "0"), - itemId: drugId!.isEmpty ? 1 : int.parse(drugId ?? "0"), + itemId: drugId!.isEmpty ? 1 : int.parse(drugId), doseUnitId: int.parse(doseUnit ?? "1"), - route: route!.isEmpty ? 1 : int.parse(route ?? "1"), - frequency: frequency!.isEmpty ? 1 : int.parse(frequency!), + route: route!.isEmpty ? 1 : int.parse(route), + frequency: frequency!.isEmpty ? 1 : int.parse(frequency), remarks: instruction, approvalRequired: true, icdcode10Id: icdCode.toString(), diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart index e57982cf..67122fd7 100644 --- a/lib/screens/prescription/prescription_checkout_screen.dart +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -72,10 +72,10 @@ class _PrescriptionCheckOutScreenState extends State prescriptionList.add(PrescriptionRequestModel( covered: true, dose: double.parse(dose!), - itemId: drugId!.isEmpty ? 1 : int.parse(drugId!), + itemId: drugId!.isEmpty ? 1 : int.parse(drugId), doseUnitId: int.parse(doseUnit!), - route: route!.isEmpty ? 1 : int.parse(route!), - frequency: frequency!.isEmpty ? 1 : int.parse(frequency!), + route: route!.isEmpty ? 1 : int.parse(route), + frequency: frequency!.isEmpty ? 1 : int.parse(frequency), remarks: instruction, approvalRequired: true, icdcode10Id: icdCode.toString(), @@ -85,7 +85,7 @@ class _PrescriptionCheckOutScreenState extends State postProcedureReqModel.prescriptionRequestModel = prescriptionList; await model!.postPrescription(postProcedureReqModel, patient.patientMRN!); - if (model!.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); } else if (model.state == ViewState.Idle) { model.getPrescriptions(patient); @@ -617,7 +617,7 @@ class _PrescriptionCheckOutScreenState extends State route: model.itemMedicineListRoute.length == 1 ? model.itemMedicineListRoute[0]['parameterCode'].toString() : route['parameterCode'].toString(), - drugId: (widget!.groupProcedures!.aliasN! + drugId: (widget.groupProcedures!.aliasN! .replaceAll("item code ;", "")), strength: strengthController.text, indication: indicationController.text, diff --git a/lib/screens/prescription/prescription_item_in_patient_page.dart b/lib/screens/prescription/prescription_item_in_patient_page.dart index 4429199a..e516f997 100644 --- a/lib/screens/prescription/prescription_item_in_patient_page.dart +++ b/lib/screens/prescription/prescription_item_in_patient_page.dart @@ -44,8 +44,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { isShowAppBar: true, backgroundColor: Colors.grey[100]!, baseViewModel: model, - patientProfileAppBarModel: PatientProfileAppBarModel( - patient:patient), + patientProfileAppBarModel: PatientProfileAppBarModel(patient: patient), body: SingleChildScrollView( child: Container( child: Column( @@ -92,8 +91,8 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { color: Colors.grey, ), Expanded( - child: AppText( - " " + model.inPatientPrescription[prescriptionIndex].direction! ?? '')), + child: + AppText(" " + model.inPatientPrescription[prescriptionIndex].direction!)), ], ), Row( @@ -102,8 +101,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).route, color: Colors.grey, ), - AppText( - " " + model.inPatientPrescription[prescriptionIndex].route.toString() ?? ''), + AppText(" " + model.inPatientPrescription[prescriptionIndex].route.toString()), ], ), Row( @@ -114,7 +112,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { ), Expanded( child: AppText( - " " + model.inPatientPrescription[prescriptionIndex].refillType! ?? '')), + " " + model.inPatientPrescription[prescriptionIndex].refillType!)), ], ), Row( @@ -156,9 +154,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { color: Colors.grey, ), AppText(" " + - model.inPatientPrescription[prescriptionIndex] - .unitofMeasurementDescription! ?? - ''), + model.inPatientPrescription[prescriptionIndex].unitofMeasurementDescription!), ], ), Row( @@ -167,8 +163,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).dailyDoses, color: Colors.grey, ), - AppText( - " " + model.inPatientPrescription[prescriptionIndex].dose.toString() ?? ''), + AppText(" " + model.inPatientPrescription[prescriptionIndex].dose.toString()), ], ), Row( @@ -177,10 +172,10 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).status, color: Colors.grey, ), - AppText(" " + - model.inPatientPrescription[prescriptionIndex].statusDescription - .toString() ?? - ''), + AppText( + " " + + model.inPatientPrescription[prescriptionIndex].statusDescription.toString(), + ), ], ), Row( @@ -189,7 +184,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).processed, color: Colors.grey, ), - AppText(" " + model.inPatientPrescription[prescriptionIndex].processedBy! ?? ''), + AppText(" " + model.inPatientPrescription[prescriptionIndex].processedBy!), ], ), Row( @@ -198,8 +193,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).dailyDoses, color: Colors.grey, ), - AppText( - " " + model.inPatientPrescription[prescriptionIndex].dose.toString() ?? ''), + AppText(" " + model.inPatientPrescription[prescriptionIndex].dose.toString()), ], ), SizedBox( diff --git a/lib/screens/prescription/prescription_items_page.dart b/lib/screens/prescription/prescription_items_page.dart index bed9825f..2fb4131d 100644 --- a/lib/screens/prescription/prescription_items_page.dart +++ b/lib/screens/prescription/prescription_items_page.dart @@ -37,8 +37,7 @@ class PrescriptionItemsPage extends StatelessWidget { clinic: prescriptions.clinicDescription!, branch: prescriptions.name!, isPrescriptions: true, - appointmentDate: AppDateUtils.getDateTimeFromServerFormat( - prescriptions.appointmentDate!), + appointmentDate: AppDateUtils.getDateTimeFromServerFormat(prescriptions.appointmentDate!), doctorName: prescriptions.doctorName!, profileUrl: prescriptions.doctorImageURL!, isAppointmentHeader: true, @@ -123,7 +122,7 @@ class PrescriptionItemsPage extends StatelessWidget { TranslationBase.of(context).frequency, color: Colors.grey, ), - AppText(" " + model.prescriptionReportList[index].frequencyN! ?? ''), + AppText(" " + model.prescriptionReportList[index].frequencyN!), ], ), Row( @@ -132,8 +131,7 @@ class PrescriptionItemsPage extends StatelessWidget { TranslationBase.of(context).dailyDoses, color: Colors.grey, ), - AppText( - " " + model.prescriptionReportList[index].doseDailyQuantity ?? ''), + AppText(" " + model.prescriptionReportList[index].doseDailyQuantity), ], ), Row( @@ -142,8 +140,7 @@ class PrescriptionItemsPage extends StatelessWidget { TranslationBase.of(context).duration, color: Colors.grey, ), - AppText( - " " + model.prescriptionReportList[index].days.toString() ?? ''), + AppText(" " + model.prescriptionReportList[index].days.toString()), ], ), SizedBox( @@ -237,9 +234,7 @@ class PrescriptionItemsPage extends StatelessWidget { TranslationBase.of(context).route, color: Colors.grey, ), - Expanded( - child: - AppText(" " + model.prescriptionReportEnhList[index].route! ?? '')), + Expanded(child: AppText(" " + model.prescriptionReportEnhList[index].route!)), ], ), Row( @@ -248,7 +243,7 @@ class PrescriptionItemsPage extends StatelessWidget { TranslationBase.of(context).frequency, color: Colors.grey, ), - AppText(" " + model.prescriptionReportEnhList[index].frequency! ?? ''), + AppText(" " + model.prescriptionReportEnhList[index].frequency!), ], ), Row( @@ -258,8 +253,7 @@ class PrescriptionItemsPage extends StatelessWidget { color: Colors.grey, ), AppText(" " + - model.prescriptionReportEnhList[index].doseDailyQuantity.toString() ?? - ''), + model.prescriptionReportEnhList[index].doseDailyQuantity.toString()), ], ), Row( @@ -268,7 +262,7 @@ class PrescriptionItemsPage extends StatelessWidget { TranslationBase.of(context).duration, color: Colors.grey, ), - AppText(" " + model.prescriptionReportList[index].days.toString() ?? ''), + AppText(" " + model.prescriptionReportList[index].days.toString()), ], ), SizedBox( diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index 611218c1..266bd82f 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -26,7 +26,8 @@ class ProcedureCard extends StatelessWidget { required this.categoryID, this.categoryName, required this.patient, - required this.doctorID, this.isInpatient = false, + required this.doctorID, + this.isInpatient = false, }) : super(key: key); @override @@ -189,11 +190,13 @@ class ProcedureCard extends StatelessWidget { children: [ Expanded( child: AppText( - entityList.remarks.toString() ?? '', + entityList.remarks.toString(), fontSize: 12, ), ), - if ((entityList.categoryID == 2 || entityList.categoryID == 4) && doctorID == entityList.doctorID && !isInpatient) + if ((entityList.categoryID == 2 || entityList.categoryID == 4) && + doctorID == entityList.doctorID && + !isInpatient) InkWell( child: Icon(DoctorApp.edit), onTap: onTap, diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 6c9dfd8b..1c2141e8 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -11,22 +11,21 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'ProcedureType.dart'; class AddFavouriteProcedure extends StatefulWidget { - final ProcedureViewModel model; - final PrescriptionViewModel prescriptionModel; + final ProcedureViewModel? model; + final PrescriptionViewModel? prescriptionModel; final PatiantInformtion patient; final ProcedureType procedureType; AddFavouriteProcedure({ Key? key, - required this.model, - required this.prescriptionModel, + this.model, + this.prescriptionModel, required this.patient, required this.procedureType, }); @@ -41,15 +40,13 @@ class _AddFavouriteProcedureState extends State { ProcedureViewModel? model; PatiantInformtion? patient; List entityList = []; - late ProcedureTempleteDetailsModel groupProcedures; + ProcedureTempleteDetailsModel? groupProcedures; @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => - model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), - builder: (BuildContext? context, ProcedureViewModel? model, Widget? child) => - AppScaffold( + onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), + builder: (BuildContext? context, ProcedureViewModel? model, Widget? child) => AppScaffold( isShowAppBar: false, baseViewModel: model, body: Column( @@ -72,8 +69,7 @@ class _AddFavouriteProcedureState extends State { entityList.add(history); }); }, - isEntityFavListSelected: (master) => - isEntityListSelected(master), + isEntityFavListSelected: (master) => isEntityListSelected(master), groupProcedures: groupProcedures, selectProcedures: (selectedProcedure) { setState(() { @@ -88,12 +84,11 @@ class _AddFavouriteProcedureState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: widget.procedureType.getAddButtonTitle(context!) ?? - TranslationBase.of(context!).addSelectedProcedures, + title: widget.procedureType.getAddButtonTitle(context), color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () { - if(widget.procedureType == ProcedureType.PRESCRIPTION){ + if (widget.procedureType == ProcedureType.PRESCRIPTION) { if (groupProcedures == null) { DrAppToastMsg.showErrorToast( 'Please Select item ', @@ -114,8 +109,7 @@ class _AddFavouriteProcedureState extends State { } else { if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( - TranslationBase.of(context!) - .fillTheMandatoryProcedureDetails, + TranslationBase.of(context).fillTheMandatoryProcedureDetails, ); return; } @@ -126,8 +120,8 @@ class _AddFavouriteProcedureState extends State { items: entityList, model: model, patient: widget.patient, - addButtonTitle: widget.procedureType.getAddButtonTitle(context!), - toolbarTitle: widget.procedureType.getToolbarLabel(context!), + addButtonTitle: widget.procedureType.getAddButtonTitle(context), + toolbarTitle: widget.procedureType.getToolbarLabel(context), ), ), ); diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart index 9f953267..41331c08 100644 --- a/lib/screens/procedures/add-procedure-page.dart +++ b/lib/screens/procedures/add-procedure-page.dart @@ -16,23 +16,21 @@ import 'ProcedureType.dart'; import 'entity_list_checkbox_search_widget.dart'; class AddProcedurePage extends StatefulWidget { - final ProcedureViewModel model; + final ProcedureViewModel? model; final PatiantInformtion patient; final ProcedureType procedureType; - const AddProcedurePage( - {Key? key, required this.model, required this.patient, required this.procedureType}) - : super(key: key); + const AddProcedurePage({Key? key, this.model, required this.patient, required this.procedureType}) : super(key: key); @override - _AddProcedurePageState createState() => _AddProcedurePageState( - patient: patient, model: model, procedureType: this.procedureType); + _AddProcedurePageState createState() => + _AddProcedurePageState(patient: patient, model: model, procedureType: this.procedureType); } class _AddProcedurePageState extends State { int? selectedType; ProcedureViewModel? model; - PatiantInformtion ?patient; + PatiantInformtion? patient; ProcedureType? procedureType; _AddProcedurePageState({this.patient, this.model, this.procedureType}); @@ -60,8 +58,7 @@ class _AddProcedurePageState extends State { categoryID: procedureType!.getCategoryId(), patientId: patient!.patientId); }, - builder: (BuildContext? context, ProcedureViewModel? model, Widget? child) => - AppScaffold( + builder: (BuildContext? context, ProcedureViewModel? model, Widget? child) => AppScaffold( isShowAppBar: false, body: Column( children: [ @@ -82,29 +79,24 @@ class _AddProcedurePageState extends State { Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - TranslationBase.of(context!) - .pleaseEnterProcedure, + TranslationBase.of(context).pleaseEnterProcedure, fontWeight: FontWeight.w700, fontSize: 20, ), ], ), SizedBox( - height: - MediaQuery.of(context!).size.height * 0.02, + height: MediaQuery.of(context).size.height * 0.02, ), Row( children: [ Container( - width: MediaQuery.of(context!).size.width * - 0.79, + width: MediaQuery.of(context).size.width * 0.79, child: AppTextFieldCustom( - hintText: TranslationBase.of(context!) - .searchProcedureHere, + hintText: TranslationBase.of(context).searchProcedureHere, isTextFieldHasSuffix: false, maxLines: 1, minLines: 1, @@ -113,22 +105,17 @@ class _AddProcedurePageState extends State { ), ), SizedBox( - width: MediaQuery.of(context!).size.width * - 0.02, + width: MediaQuery.of(context).size.width * 0.02, ), Expanded( child: InkWell( onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) + if (procedureName.text.isNotEmpty && procedureName.text.length >= 3) model!.getProcedureCategory( - patientId: patient!.patientId, - categoryName: - procedureName.text); + patientId: patient!.patientId, categoryName: procedureName.text); else DrAppToastMsg.showErrorToast( - TranslationBase.of(context!) - .atLeastThreeCharacters, + TranslationBase.of(context).atLeastThreeCharacters, ); }, child: Icon( @@ -141,16 +128,13 @@ class _AddProcedurePageState extends State { ), ], ), - if ((procedureType == ProcedureType.PROCEDURE - ? procedureName.text.isNotEmpty - : true) && + if ((procedureType == ProcedureType.PROCEDURE ? procedureName.text.isNotEmpty : true) && model!.categoriesList.length != 0) NetworkBaseView( baseViewModel: model, child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - model!.categoriesList[0].entityList!, + model: widget.model!, + masterList: model.categoriesList[0].entityList!, removeHistory: (item) { setState(() { entityList.remove(item); @@ -165,8 +149,7 @@ class _AddProcedurePageState extends State { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: (master) => - isEntityListSelected(master), + isEntityListSelected: (master) => isEntityListSelected(master), )), ], ), @@ -181,14 +164,13 @@ class _AddProcedurePageState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: procedureType!.getAddButtonTitle(context!), + title: procedureType!.getAddButtonTitle(context), fontWeight: FontWeight.w700, color: Color(0xff359846), onPressed: () async { if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( - TranslationBase.of(context!) - .fillTheMandatoryProcedureDetails, + TranslationBase.of(context).fillTheMandatoryProcedureDetails, ); return; } @@ -198,7 +180,7 @@ class _AddProcedurePageState extends State { entityList: entityList, patient: patient, remarks: remarksController.text); - Navigator.pop(context!); + Navigator.pop(context); }, ), ], @@ -211,8 +193,7 @@ class _AddProcedurePageState extends State { } bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); + Iterable history = entityList.where((element) => masterKey.procedureId == element.procedureId); if (history.length > 0) { return true; } diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 202a261f..8d6a42e3 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -21,21 +21,16 @@ class BaseAddProcedureTabPage extends StatefulWidget { final ProcedureType? procedureType; const BaseAddProcedureTabPage( - {Key? key, - this.model, - this.prescriptionModel, - this.patient, - @required this.procedureType}) + {Key? key, this.model, this.prescriptionModel, this.patient, @required this.procedureType}) : super(key: key); @override - _BaseAddProcedureTabPageState createState() => _BaseAddProcedureTabPageState( - patient: patient!, model: model!, procedureType: procedureType!); + _BaseAddProcedureTabPageState createState() => + _BaseAddProcedureTabPageState(patient: patient!, model: model, procedureType: procedureType!); } -class _BaseAddProcedureTabPageState extends State - with SingleTickerProviderStateMixin { - final ProcedureViewModel model; +class _BaseAddProcedureTabPageState extends State with SingleTickerProviderStateMixin { + final ProcedureViewModel? model; final PatiantInformtion patient; final ProcedureType procedureType; @@ -68,8 +63,7 @@ class _BaseAddProcedureTabPageState extends State final screenSize = MediaQuery.of(context).size; return BaseView( - builder: (BuildContext? context, ProcedureViewModel? model, Widget? child) => - AppScaffold( + builder: (BuildContext? context, ProcedureViewModel? model, Widget? child) => AppScaffold( isShowAppBar: false, body: NetworkBaseView( baseViewModel: model, @@ -131,8 +125,7 @@ class _BaseAddProcedureTabPageState extends State tabWidget( screenSize, _activeTab == 0, - procedureType - .getFavouriteTabName(context), + procedureType.getFavouriteTabName(context), ), tabWidget( screenSize, @@ -152,22 +145,15 @@ class _BaseAddProcedureTabPageState extends State controller: _tabController, children: [ AddFavouriteProcedure( - model: this.model, - prescriptionModel: - widget.prescriptionModel!, patient: patient, procedureType: procedureType, ), - if (widget.procedureType == - ProcedureType.PRESCRIPTION) - PrescriptionFormWidget( - widget.prescriptionModel!, - widget.patient!, - widget!.prescriptionModel! - .prescriptionList!) + if (widget.procedureType == ProcedureType.PRESCRIPTION) + PrescriptionFormWidget(widget.prescriptionModel!, widget.patient!, + widget.prescriptionModel!.prescriptionList) else AddProcedurePage( - model: this.model, + model: this.model!, patient: patient, procedureType: procedureType, ), @@ -193,10 +179,8 @@ class _BaseAddProcedureTabPageState extends State child: Container( height: screenSize.height * 0.070, decoration: TextFieldsUtils.containerBorderDecoration( - isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, borderWidth: 0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index 25864cea..0a150c55 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -69,7 +69,7 @@ class _ProcedureCheckOutScreenState extends State { width: 5.0, ), AppText( - widget.toolbarTitle ?? 'Add Procedure', + widget.toolbarTitle, fontWeight: FontWeight.w700, fontSize: 20, ), @@ -196,7 +196,7 @@ class _ProcedureCheckOutScreenState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: widget.addButtonTitle ?? TranslationBase.of(context).addSelectedProcedures, + title: widget.addButtonTitle, color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () async { @@ -213,9 +213,7 @@ class _ProcedureCheckOutScreenState extends State { }); Navigator.pop(context); await model.preparePostProcedure( - entityList: entityList, - patient: widget.patient, - remarks: remarksController.text); + entityList: entityList, patient: widget.patient, remarks: remarksController.text); Navigator.pop(context); Navigator.pop(context); }, diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 20201360..b115c0eb 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -44,7 +44,9 @@ class ProcedureScreen extends StatelessWidget { backgroundColor: Colors.grey[100], baseViewModel: model, patientProfileAppBarModel: PatientProfileAppBarModel( - patient: patient, isInpatient:isInpatient,), + patient: patient, + isInpatient: isInpatient, + ), body: SingleChildScrollView( child: Container( child: Column( @@ -173,7 +175,7 @@ class ProcedureScreen extends StatelessWidget { // 'You Cant Update This Procedure'); }, patient: patient, - doctorID: model!.doctorProfile!.doctorID!, + doctorID: model.doctorProfile!.doctorID!, ), ), if (model.state == ViewState.ErrorLocal || diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index a0e2acda..ad0191b9 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -264,17 +264,16 @@ class Helpers { } static getLabelFromKPI(String kpi) { - if (kpi.indexOf("(") > -1 && kpi.indexOf(")")>-1) - return kpi.substring(kpi.indexOf("(") + 1, kpi.indexOf(")")); + if (kpi.indexOf("(") > -1 && kpi.indexOf(")") > -1) + return kpi.substring(kpi.indexOf("(") + 1, kpi.indexOf(")")); else return ''; - } static String timeFrom({Duration? duration}) { String twoDigits(int n) => n.toString().padLeft(2, "0"); String twoDigitMinutes = twoDigits(duration!.inMinutes.remainder(60)); - String twoDigitSeconds = twoDigits(duration!.inSeconds.remainder(60)); + String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60)); return "$twoDigitMinutes:$twoDigitSeconds"; } } diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 042a963f..a8b7d477 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -218,7 +218,7 @@ class _DoctorReplyWidgetState extends State { color: Color(0xFF575757), fontWeight: FontWeight.bold)), new TextSpan( - text: widget.reply?.remarks?.trim() ?? '', + text: widget.reply.remarks?.trim() ?? '', style: TextStyle(fontFamily: 'Poppins', color: Color(0xFF575757), fontSize: 12)), ], ), diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 53c8e4cb..e7a571c5 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -82,9 +82,9 @@ class MyScheduleWidget extends StatelessWidget { SizedBox( height: 5, ), - if (workingHoursTable!.clinicName != null) + if (workingHoursTable.clinicName != null) AppText( - workingHoursTable!.clinicName ?? "", + workingHoursTable.clinicName ?? "", fontSize: 15, fontWeight: FontWeight.w700, ), diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index 337f630e..e7553b9c 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -1,12 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class PatientReferralItemWidget extends StatelessWidget { final String? referralStatus; @@ -50,8 +48,6 @@ class PatientReferralItemWidget extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return Container( margin: EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0), child: Column( @@ -76,7 +72,7 @@ class PatientReferralItemWidget extends StatelessWidget { AppText( referralStatus != null ? referralStatus : "", fontFamily: 'Poppins', - fontSize: 1.9 * SizeConfig.textMultiplier!, + fontSize: 1.9 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, color: referralStatusCode == 1 ? Color(0xffc4aa54) @@ -85,10 +81,10 @@ class PatientReferralItemWidget extends StatelessWidget { : Colors.red[700], ), AppText( - referredDate??'', + referredDate ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 2.0 * SizeConfig.textMultiplier!, + fontSize: 2.0 * SizeConfig.textMultiplier, color: Color(0XFF28353E), ) ], @@ -98,8 +94,8 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Expanded( child: AppText( - patientName??'', - fontSize: SizeConfig.textMultiplier! * 2.2, + patientName ?? '', + fontSize: SizeConfig.textMultiplier * 2.2, fontWeight: FontWeight.bold, color: Colors.black, fontFamily: 'Poppins', @@ -121,10 +117,10 @@ class PatientReferralItemWidget extends StatelessWidget { width: 4, ), AppText( - referredTime??'', + referredTime ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier!, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF575757), ) ], @@ -143,14 +139,14 @@ class PatientReferralItemWidget extends StatelessWidget { TranslationBase.of(context).fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier!, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( patientID!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier!, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -165,16 +161,16 @@ class PatientReferralItemWidget extends StatelessWidget { : TranslationBase.of(context).refClinic, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier!, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), - Expanded( + Expanded( child: AppText( !isReferralClinic! - ? isSameBranch - ? TranslationBase.of(context).sameBranch - : TranslationBase.of(context).otherBranch - : " " + referralClinic!, + ? isSameBranch + ? TranslationBase.of(context).sameBranch + : TranslationBase.of(context).otherBranch + : " " + referralClinic!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -218,7 +214,7 @@ class PatientReferralItemWidget extends StatelessWidget { TranslationBase.of(context).remarks ?? "" + " : ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier!, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), Expanded( @@ -226,7 +222,7 @@ class PatientReferralItemWidget extends StatelessWidget { remark ?? "", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier!, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), maxLines: 1, ), @@ -281,10 +277,10 @@ class PatientReferralItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - referralDoctorName??'', + referralDoctorName ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w800, - fontSize: 1.7 * SizeConfig.textMultiplier!, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Colors.black, ), if (clinicDescription != null) @@ -292,7 +288,7 @@ class PatientReferralItemWidget extends StatelessWidget { clinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.4 * SizeConfig.textMultiplier!, + fontSize: 1.4 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index beffc92f..4a27347a 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -35,7 +35,6 @@ class PatientCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( width: SizeConfig.screenWidth * 0.9, margin: EdgeInsets.all(6), @@ -58,10 +57,10 @@ class PatientCard extends StatelessWidget { : isMyPatient ? Colors.green[500]! : isInpatient - ? Colors.white! + ? Colors.white : !isFromSearch ? Colors.red[800]! - : Colors.white!, + : Colors.white, widget: Container( color: Colors.white, // padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), @@ -242,7 +241,6 @@ class PatientCard extends StatelessWidget { textOverflow: TextOverflow.ellipsis, ), ), - if (patientInfo.gender == 1) Icon( DoctorApp.male_2, @@ -253,9 +251,10 @@ class PatientCard extends StatelessWidget { DoctorApp.female_1, color: Colors.pink, ), - - if(isFromLiveCare) - ShowTimer(patientInfo: patientInfo,), + if (isFromLiveCare) + ShowTimer( + patientInfo: patientInfo, + ), ]), ), Row( @@ -462,6 +461,4 @@ class PatientCard extends StatelessWidget { )), )); } - - -} \ No newline at end of file +} diff --git a/lib/widgets/patients/profile/add-order/addNewOrder.dart b/lib/widgets/patients/profile/add-order/addNewOrder.dart index 83c02eb7..52929c86 100644 --- a/lib/widgets/patients/profile/add-order/addNewOrder.dart +++ b/lib/widgets/patients/profile/add-order/addNewOrder.dart @@ -46,7 +46,7 @@ class AddNewOrder extends StatelessWidget { height: 10, ), AppText( - label ?? '', + label, color: Colors.grey[600], fontWeight: FontWeight.w600, ) diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index 8b7a4c05..d6c12dc8 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -12,14 +12,12 @@ import 'package:url_launcher/url_launcher.dart'; import 'large_avatar.dart'; -class PatientProfileAppBar extends StatelessWidget - with PreferredSizeWidget { +class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { final PatientProfileAppBarModel patientProfileAppBarModel; final bool isFromLabResult; final VoidCallback? onPressed; - PatientProfileAppBar( - {required this.patientProfileAppBarModel, this.isFromLabResult=false, this.onPressed}); + PatientProfileAppBar({required this.patientProfileAppBarModel, this.isFromLabResult = false, this.onPressed}); @override Widget build(BuildContext context) { @@ -53,23 +51,18 @@ class PatientProfileAppBar extends StatelessWidget icon: Icon(Icons.arrow_back_ios), color: Color(0xFF2B353E), //Colors.black, onPressed: () { - if(onPressed!=null) - onPressed!(); - Navigator.pop(context); + if (onPressed != null) onPressed!(); + Navigator.pop(context); }, ), Expanded( child: AppText( patientProfileAppBarModel.patient!.firstName != null - ? (Helpers.capitalize( - patientProfileAppBarModel.patient!.firstName) + + ? (Helpers.capitalize(patientProfileAppBarModel.patient!.firstName) + " " + - Helpers.capitalize( - patientProfileAppBarModel.patient!.lastName)) - : Helpers.capitalize( - patientProfileAppBarModel.patient!.fullName ?? - patientProfileAppBarModel - .patient!.patientDetails!.fullName!), + Helpers.capitalize(patientProfileAppBarModel.patient!.lastName)) + : Helpers.capitalize(patientProfileAppBarModel.patient!.fullName ?? + patientProfileAppBarModel.patient!.patientDetails!.fullName!), fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -89,8 +82,7 @@ class PatientProfileAppBar extends StatelessWidget margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { - launch("tel://" + - patientProfileAppBarModel.patient!.mobileNumber!); + launch("tel://" + patientProfileAppBarModel.patient!.mobileNumber!); }, child: Icon( Icons.phone, @@ -107,9 +99,7 @@ class PatientProfileAppBar extends StatelessWidget width: 60, height: 60, child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', + gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), @@ -126,9 +116,7 @@ class PatientProfileAppBar extends StatelessWidget child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - patientProfileAppBarModel - .patient!.patientStatusType == - 43 + patientProfileAppBarModel.patient!.patientStatusType == 43 ? AppText( TranslationBase.of(context).arrivedP, color: Colors.green, @@ -143,14 +131,10 @@ class PatientProfileAppBar extends StatelessWidget fontFamily: 'Poppins', fontSize: 12, ), - patientProfileAppBarModel.patient!.startTime != - null + patientProfileAppBarModel.patient!.startTime != null ? AppText( - patientProfileAppBarModel - .patient!.startTime != - null - ? patientProfileAppBarModel - .patient!.startTime + patientProfileAppBarModel.patient!.startTime != null + ? patientProfileAppBarModel.patient!.startTime : '', fontWeight: FontWeight.w700, fontSize: 12, @@ -165,9 +149,7 @@ class PatientProfileAppBar extends StatelessWidget children: [ RichText( text: TextSpan( - style: TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black), + style: TextStyle(fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black), children: [ new TextSpan( text: TranslationBase.of(context).fileNumber, @@ -179,9 +161,7 @@ class PatientProfileAppBar extends StatelessWidget ), ), new TextSpan( - text: patientProfileAppBarModel - .patient!.patientId - .toString(), + text: patientProfileAppBarModel.patient!.patientId.toString(), style: TextStyle( fontWeight: FontWeight.w700, fontFamily: 'Poppins', @@ -195,27 +175,20 @@ class PatientProfileAppBar extends StatelessWidget children: [ AppText( patientProfileAppBarModel.patient!.nationalityName ?? - patientProfileAppBarModel - .patient!.nationality ?? - patientProfileAppBarModel - .patient!.nationalityId ?? + patientProfileAppBarModel.patient!.nationality ?? + patientProfileAppBarModel.patient!.nationalityId ?? '', fontWeight: FontWeight.bold, fontSize: 12, ), - patientProfileAppBarModel - .patient!.nationalityFlagURL != - null + patientProfileAppBarModel.patient!.nationalityFlagURL != null ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( - patientProfileAppBarModel - .patient!.nationalityFlagURL!, + patientProfileAppBarModel.patient!.nationalityFlagURL!, height: 25, width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace? stackTrace) { + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -253,10 +226,9 @@ class PatientProfileAppBar extends StatelessWidget ), ), - if (patientProfileAppBarModel.patient!.appointmentDate != - null && - patientProfileAppBarModel - .patient!.appointmentDate!.isNotEmpty && !isFromLabResult) + if (patientProfileAppBarModel.patient!.appointmentDate != null && + patientProfileAppBarModel.patient!.appointmentDate!.isNotEmpty && + !isFromLabResult) Row( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -272,9 +244,7 @@ class PatientProfileAppBar extends StatelessWidget ), AppText( AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate( - patientProfileAppBarModel - .patient!.appointmentDate!)), + AppDateUtils.convertStringToDate(patientProfileAppBarModel.patient!.appointmentDate!)), fontWeight: FontWeight.w700, fontSize: 12, color: Color(0xFF2E303A), @@ -305,9 +275,7 @@ class PatientProfileAppBar extends StatelessWidget new TextSpan( text: '${AppDateUtils.getDayMonthYearDateFormatted(patientProfileAppBarModel.appointmentDate!, isArabic: projectViewModel.isArabic)}', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 12)), + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 12)), ], ), ), @@ -316,10 +284,8 @@ class PatientProfileAppBar extends StatelessWidget Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (patientProfileAppBarModel.patient!.admissionDate != - null && - patientProfileAppBarModel - .patient!.admissionDate!.isNotEmpty) + if (patientProfileAppBarModel.patient!.admissionDate != null && + patientProfileAppBarModel.patient!.admissionDate!.isNotEmpty) Container( child: RichText( text: new TextSpan( @@ -331,18 +297,12 @@ class PatientProfileAppBar extends StatelessWidget ), children: [ new TextSpan( - text: patientProfileAppBarModel - .patient!.admissionDate == - null + text: patientProfileAppBarModel.patient!.admissionDate == null ? "" - : TranslationBase.of(context) - .admissionDate! + - " : ", + : TranslationBase.of(context).admissionDate! + " : ", style: TextStyle(fontSize: 10)), new TextSpan( - text: patientProfileAppBarModel - .patient!.admissionDate == - null + text: patientProfileAppBarModel.patient!.admissionDate == null ? "" : "${AppDateUtils.getDayMonthYearDateFormatted((AppDateUtils.getDateTimeFromServerFormat(patientProfileAppBarModel.patient!.admissionDate.toString())))}", style: TextStyle( @@ -351,20 +311,13 @@ class PatientProfileAppBar extends StatelessWidget color: Color(0xFF2E303A), )), ]))), - if (patientProfileAppBarModel.patient!.admissionDate != - null) + if (patientProfileAppBarModel.patient!.admissionDate != null) Row( children: [ - AppText( - "${TranslationBase.of(context).numOfDays}: ", - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757)), - if (patientProfileAppBarModel! - .isDischargedPatient! && - patientProfileAppBarModel - .patient!.dischargeDate != - null) + AppText("${TranslationBase.of(context).numOfDays}: ", + fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + if (patientProfileAppBarModel.isDischargedPatient! && + patientProfileAppBarModel.patient!.dischargeDate != null) AppText( "${AppDateUtils.getDateTimeFromServerFormat(patientProfileAppBarModel.patient!.dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(patientProfileAppBarModel.patient!.admissionDate!)).inDays + 1}", fontWeight: FontWeight.w700, @@ -394,14 +347,11 @@ class PatientProfileAppBar extends StatelessWidget width: 30, height: 30, margin: EdgeInsets.only( - left: projectViewModel.isArabic ? 10 : 85, - right: projectViewModel.isArabic ? 85 : 10, - top: 5), + left: projectViewModel.isArabic ? 10 : 85, right: projectViewModel.isArabic ? 85 : 10, top: 5), decoration: BoxDecoration( shape: BoxShape.rectangle, border: Border( - bottom: - BorderSide(color: Colors.grey[400]!, width: 2.5), + bottom: BorderSide(color: Colors.grey[400]!, width: 2.5), left: BorderSide(color: Colors.grey[400]!, width: 2.5), )), ), @@ -424,145 +374,107 @@ class PatientProfileAppBar extends StatelessWidget flex: 5, child: Container( margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - '${TranslationBase.of(context).dr}${patientProfileAppBarModel.doctorName}', - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700, - fontSize: 12, - ), - if (patientProfileAppBarModel.orderNo != - null && - !patientProfileAppBarModel - .isPrescriptions!) - Row( - children: [ - AppText( - 'Order No: ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - patientProfileAppBarModel - .orderNo ?? - '', - fontSize: 12) - ], + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText( + '${TranslationBase.of(context).dr}${patientProfileAppBarModel.doctorName}', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + fontSize: 12, + ), + if (patientProfileAppBarModel.orderNo != null && + !patientProfileAppBarModel.isPrescriptions!) + Row( + children: [ + AppText( + 'Order No: ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (patientProfileAppBarModel.invoiceNO != - null && - !patientProfileAppBarModel! - .isPrescriptions!) - Row( - children: [ - AppText( - 'Invoice: ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - patientProfileAppBarModel - .invoiceNO ?? - "", - fontSize: 12) - ], + AppText(patientProfileAppBarModel.orderNo ?? '', fontSize: 12) + ], + ), + if (patientProfileAppBarModel.invoiceNO != null && + !patientProfileAppBarModel.isPrescriptions!) + Row( + children: [ + AppText( + 'Invoice: ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (patientProfileAppBarModel.branch != - null) - Row( - children: [ - AppText( - 'Branch: ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - patientProfileAppBarModel - .branch ?? - '', - fontSize: 12) - ], + AppText(patientProfileAppBarModel.invoiceNO ?? "", fontSize: 12) + ], + ), + if (patientProfileAppBarModel.branch != null) + Row( + children: [ + AppText( + 'Branch: ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (patientProfileAppBarModel.clinic != - null) - Row( - children: [ - AppText( - 'Clinic: ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - patientProfileAppBarModel - .clinic ?? - '', - fontSize: 12) - ], + AppText(patientProfileAppBarModel.branch ?? '', fontSize: 12) + ], + ), + if (patientProfileAppBarModel.clinic != null) + Row( + children: [ + AppText( + 'Clinic: ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (patientProfileAppBarModel - .isMedicalFile! && - patientProfileAppBarModel.episode != - null) - Row( - children: [ - AppText( - 'Episode: ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - patientProfileAppBarModel - .episode ?? - '', - fontSize: 12) - ], + AppText(patientProfileAppBarModel.clinic ?? '', fontSize: 12) + ], + ), + if (patientProfileAppBarModel.isMedicalFile! && + patientProfileAppBarModel.episode != null) + Row( + children: [ + AppText( + 'Episode: ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ), + AppText(patientProfileAppBarModel.episode ?? '', fontSize: 12) + ], + ), + if (patientProfileAppBarModel.isMedicalFile! && + patientProfileAppBarModel.visitDate != null) + Row( + children: [ + AppText( + 'Visit Date: ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (patientProfileAppBarModel - .isMedicalFile! && - patientProfileAppBarModel.visitDate != - null) - Row( - children: [ - AppText( - 'Visit Date: ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - patientProfileAppBarModel - .visitDate ?? - '', - fontSize: 12) - ], + AppText(patientProfileAppBarModel.visitDate ?? '', fontSize: 12) + ], + ), + if (!patientProfileAppBarModel.isMedicalFile!) + Row( + children: [ + AppText( + !patientProfileAppBarModel.isPrescriptions! + ? 'Result Date:' + : 'Prescriptions Date ', + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (!patientProfileAppBarModel - .isMedicalFile!) - Row( - children: [ - AppText( - !patientProfileAppBarModel - .isPrescriptions! - ? 'Result Date:' - : 'Prescriptions Date ', - fontSize: 10, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(patientProfileAppBarModel.appointmentDate!, isArabic: projectViewModel.isArabic)}', - fontSize: 12, - ) - ], + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(patientProfileAppBarModel.appointmentDate!, isArabic: projectViewModel.isArabic)}', + fontSize: 12, ) - ]), + ], + ) + ]), ), ), ], @@ -583,12 +495,16 @@ class PatientProfileAppBar extends StatelessWidget patientProfileAppBarModel.height == 0 ? patientProfileAppBarModel.isAppointmentHeader! ? 270 - : ((patientProfileAppBarModel.patient!.appointmentDate! != null &&patientProfileAppBarModel.patient!.appointmentDate!.isNotEmpty ) - ? patientProfileAppBarModel.isFromLabResult!?170:150 + : ((patientProfileAppBarModel.patient!.appointmentDate!.isNotEmpty) + ? patientProfileAppBarModel.isFromLabResult! + ? 170 + : 150 : patientProfileAppBarModel.patient!.admissionDate != null - ? patientProfileAppBarModel.isFromLabResult!?170:150 + ? patientProfileAppBarModel.isFromLabResult! + ? 170 + : 150 : patientProfileAppBarModel.isDischargedPatient! - ? 240! - : 130!) + ? 240 + : 130) : patientProfileAppBarModel.height!); } diff --git a/lib/widgets/shared/StarRating.dart b/lib/widgets/shared/StarRating.dart index 88b6a970..1caded9b 100644 --- a/lib/widgets/shared/StarRating.dart +++ b/lib/widgets/shared/StarRating.dart @@ -20,9 +20,9 @@ class StarRating extends StatelessWidget { 5, (index) => Padding( padding: EdgeInsets.only(right: 1.0), - child: Icon((index + 1) <= (totalAverage ?? 0) ? EvaIcons.star : EvaIcons.starOutline, + child: Icon((index + 1) <= (totalAverage) ? EvaIcons.star : EvaIcons.starOutline, size: size, - color: (index + 1) <= (totalAverage ?? 0) + color: (index + 1) <= (totalAverage) ? Color.fromRGBO(255, 186, 0, 1.0) : Theme.of(context).hintColor), )), diff --git a/lib/widgets/shared/buttons/secondary_button.dart b/lib/widgets/shared/buttons/secondary_button.dart index 320f4402..7fd680e3 100644 --- a/lib/widgets/shared/buttons/secondary_button.dart +++ b/lib/widgets/shared/buttons/secondary_button.dart @@ -103,7 +103,7 @@ class _SecondaryButtonState extends State with TickerProviderSt void didUpdateWidget(SecondaryButton oldWidget) { super.didUpdateWidget(oldWidget); if (oldWidget.disabled != widget.disabled) { - bool d = widget.disabled ?? false; + bool d = widget.disabled; if (!d) { _rippleController.forward(); } else { diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index 1e2e19c2..02072bdb 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -39,7 +39,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( child: Container( decoration: BoxDecoration( - color: bgColor ?? HexColor('#58434F'), + color: bgColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10), @@ -55,7 +55,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( child: Container( decoration: BoxDecoration( - color: bgColor ?? HexColor('#58434F'), + color: bgColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10), diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index 7ee26c2f..97635790 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -61,7 +61,7 @@ class DoctorCard extends StatelessWidget { children: [ Expanded( child: AppText( - doctorName ?? "", + doctorName, fontSize: 15, bold: true, )), diff --git a/lib/widgets/shared/errors/error_message.dart b/lib/widgets/shared/errors/error_message.dart index 76b7d515..056f2fd7 100644 --- a/lib/widgets/shared/errors/error_message.dart +++ b/lib/widgets/shared/errors/error_message.dart @@ -27,7 +27,7 @@ class ErrorMessage extends StatelessWidget { padding: const EdgeInsets.only(top: 12, bottom: 12, right: 20, left: 30), child: Center( child: AppText( - error ?? '', + error, textAlign: TextAlign.center, )), ),