diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 069d11ca..2fe453ba 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -329,13 +329,13 @@ class BaseAppClient { String getError(parsed) { //TODO change this fun - String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; + String? error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) { - error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; + error = error! + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; } } } diff --git a/lib/config/config.dart b/lib/config/config.dart index e248f70e..56335ddc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -11,7 +11,7 @@ const DOCTOR_ROTATION = 'https://doctorrota.hmg.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://webservices.hmg.com/'; +//const BASE_URL = 'https://webservices.hmg.com/'; // const BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; //Vida Plus URL @@ -275,7 +275,6 @@ const GET_STP_MASTER_LIST = "Services/DoctorApplication.svc/REST/DoctorApp_GetST const DOCTOR_ER_SIGN_ASSESSMENT = "Services/DoctorApplication.svc/REST/DoctorApp_DoctorERSignAssessment"; - const DOCTOR_SCHEDULE = "api/ScheduledSchedule/GetallSchedulebyUser"; var selectedPatientType = 1; diff --git a/lib/core/model/procedure/procedure_valadate_model.dart b/lib/core/model/procedure/procedure_valadate_model.dart index ee41791f..1ec57ad1 100644 --- a/lib/core/model/procedure/procedure_valadate_model.dart +++ b/lib/core/model/procedure/procedure_valadate_model.dart @@ -4,8 +4,7 @@ class ProcedureValadteModel { dynamic statusMessage; dynamic success; - ProcedureValadteModel( - {this.entityList, this.rowcount, this.statusMessage, this.success}); + ProcedureValadteModel({this.entityList, this.rowcount, this.statusMessage, this.success}); ProcedureValadteModel.fromJson(Map json) { if (json['entityList'] != null) { @@ -20,7 +19,7 @@ class ProcedureValadteModel { } Map toJson() { - final Map data = new Map(); + final Map data = Map(); if (this.entityList != null) { data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } @@ -43,7 +42,7 @@ class EntityList { } Map toJson() { - final Map data = new Map(); + final Map data = Map(); data['procedureId'] = this.procedureId; data['warringMessages'] = this.warringMessages; return data; diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index db0b9be2..e8160c6c 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -13,37 +13,32 @@ import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class ProcedureService extends BaseService { - List _procedureList =[]; + List _procedureList = []; List get procedureList => _procedureList; - List _valadteProcedureList =[]; + List _valadteProcedureList = []; List get valadteProcedureList => _valadteProcedureList; - List _categoriesList =[]; + List _categoriesList = []; List get categoriesList => _categoriesList; - List procedureslist =[]; + List procedureslist = []; List categoryList = []; // List _templateList =[]; // List get templateList => _templateList; - List templateList =[]; + List templateList = []; - List _templateDetailsList =[]; + List _templateDetailsList = []; - List get templateDetailsList => - _templateDetailsList; + List get templateDetailsList => _templateDetailsList; - GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(); + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); - ProcedureTempleteRequestModel _procedureTempleteRequestModel = - ProcedureTempleteRequestModel(); - ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(); - GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( - ); + GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel(); GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel( clinicId: 0, @@ -52,8 +47,7 @@ class ProcedureService extends BaseService { patientMRN: 0, ); - Future getProcedureTemplate( - {int? doctorId, int? projectId, int? clinicId, String? categoryID, bool? isLocalBusy}) async { + Future getProcedureTemplate({int? doctorId, int? projectId, int? clinicId, String? categoryID, bool? isLocalBusy}) async { _procedureTempleteRequestModel = ProcedureTempleteRequestModel( // tokenID: "@dm!n", patientID: 0, @@ -62,12 +56,10 @@ class ProcedureService extends BaseService { hasError = false; - await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/, onSuccess: (dynamic response, int statusCode) { templateList.clear(); response['DAPP_TemplateGetList'].forEach((template) { - ProcedureTempleteDetailsModel templateElement = - ProcedureTempleteDetailsModel.fromJson(template); + ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template); if (categoryID != null) { if (categoryID == templateElement.categoryID) { templateList.add(templateElement); @@ -85,21 +77,16 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteRequestModel.toJson()); } - Future getProcedureTemplateDetails( - {int? doctorId, int? projectId, int? clinicId, int? templateId}) async { - _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel( - templateID: templateId, searchType: 1, patientID: 0); + Future getProcedureTemplateDetails({int? doctorId, int? projectId, int? clinicId, int? templateId}) async { + _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0); hasError = false; //insuranceApprovalInPatient.clear(); _templateDetailsList.clear(); - await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, onSuccess: (dynamic response, int statusCode) { //prescriptionsList.clear(); response['HIS_ProcedureTemplateDetailsList'].forEach((template) { - _templateDetailsList - .add(ProcedureTempleteDetailsModel.fromJson(template)); + _templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -113,10 +100,8 @@ class ProcedureService extends BaseService { ); hasError = false; _procedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { - _procedureList.add( - GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { + _procedureList.add(GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -126,8 +111,7 @@ class ProcedureService extends BaseService { Future getCategory() async { hasError = false; - await baseAppClient.post(GET_LIST_CATEGORISE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_LIST_CATEGORISE, onSuccess: (dynamic response, int statusCode) { categoryList = []; categoryList = response['listProcedureCategories']['entityList']; }, onFailure: (String error, int statusCode) { @@ -136,8 +120,7 @@ class ProcedureService extends BaseService { }, body: Map()); } - Future getProcedureCategory( - {String? categoryName, String? categoryID, patientId}) async { + Future getProcedureCategory({String? categoryName, String? categoryID, patientId}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( search: ["$categoryName"], patientMRN: patientId, @@ -148,10 +131,8 @@ class ProcedureService extends BaseService { ); hasError = false; _categoriesList.clear(); - await baseAppClient.post(GET_CATEGORISE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { - _categoriesList - .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + await baseAppClient.post(GET_CATEGORISE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { + _categoriesList.add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -161,8 +142,7 @@ class ProcedureService extends BaseService { Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(POST_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(POST_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -170,12 +150,10 @@ class ProcedureService extends BaseService { }, body: postProcedureReqModel.toJson()); } - Future updateProcedure( - UpdateProcedureRequestModel updateProcedureRequestModel) async { + Future updateProcedure(UpdateProcedureRequestModel updateProcedureRequestModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(UPDATE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { print("ACCEPTED"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -183,14 +161,13 @@ class ProcedureService extends BaseService { }, body: updateProcedureRequestModel.toJson()); } - Future validationProcedure( - ProcedureValidationRequestModel validationProcedureRequestModel) async { + Future validationProcedure(ProcedureValidationRequestModel validationProcedureRequestModel) async { hasError = false; _valadteProcedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_VALIDATION, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PROCEDURE_VALIDATION, onSuccess: (dynamic response, int statusCode) { _valadteProcedureList.add( - ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); + ProcedureValadteModel.fromJson(response['ValidateProcedureList']), + ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index 7e543740..be2333d3 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -63,8 +63,8 @@ class _OutPatientsScreenState extends State { List _times = []; int _activeLocation = 1; - String? patientType; - String? patientTypeTitle; + String patientType = ''; + String patientTypeTitlem = ''; var selectedFilter = 1; String arrivalType = ''; late ProjectViewModel projectsProvider; @@ -216,12 +216,11 @@ class _OutPatientsScreenState extends State { padding: EdgeInsets.symmetric(horizontal: 8, vertical: 0), child: PatientCard( patientInfo: model.filterData[index], - patientType: patientType!, + patientType: patientType, arrivalType: arrivalType, isFromSearch: widget.isSearchAndOut, isInpatient: widget.isInpatient, onTap: () { - // TODO change the parameter to daynamic Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": model.filterData[index], "patientType": "1", diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 4feff254..2571560b 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -1,6 +1,6 @@ +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart'; import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; @@ -13,9 +13,9 @@ import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-prof import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import '../../../../widgets/shared/errors/error_message.dart'; class LabsHomePage extends StatefulWidget { @@ -67,16 +67,12 @@ class _LabsHomePageState extends State { SizedBox( height: 12, ), - if ((model.patientLabOrdersList.isNotEmpty && - patient!.patientStatusType != 43)|| (patient!.patientStatusType != null && - patient!.patientStatusType == 43)) + if ((model.patientLabOrdersList.isNotEmpty && patient!.patientStatusType != 43) || (patient!.patientStatusType != null && patient!.patientStatusType == 43)) ServiceTitle( title: TranslationBase.of(context).lab, subTitle: TranslationBase.of(context).result, ), - if ((patient!.patientStatusType != null && - patient!.patientStatusType == 43) || - (isFromLiveCare! && patient!.appointmentNo != null)) + if ((patient!.patientStatusType != null && patient!.patientStatusType == 43) || (isFromLiveCare! && patient!.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( @@ -115,44 +111,26 @@ class _LabsHomePageState extends State { child: Container( width: 20, decoration: BoxDecoration( - color: model.patientLabOrdersList[index] - .isLiveCareAppointment! + color: model.patientLabOrdersList[index].isLiveCareAppointment! ? Colors.red[900] - : !model.patientLabOrdersList[index] - .isInOutPatient! + : !model.patientLabOrdersList[index].isInOutPatient! ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - bottomLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - topRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), - bottomRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0)), + topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), + topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0), + bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)), ), child: RotatedBox( quarterTurns: 3, child: Center( child: Text( - model.patientLabOrdersList[index] - .isLiveCareAppointment! - ? TranslationBase.of(context) - .liveCare - .toUpperCase() - : !model.patientLabOrdersList[index] - .isInOutPatient! - ? TranslationBase.of(context) - .inPatientLabel - .toUpperCase() - : TranslationBase.of(context) - .outpatient - .toUpperCase(), + model.patientLabOrdersList[index].isLiveCareAppointment! + ? TranslationBase.of(context).liveCare.toUpperCase() + : !model.patientLabOrdersList[index].isInOutPatient! + ? TranslationBase.of(context).inPatientLabel.toUpperCase() + : TranslationBase.of(context).outpatient.toUpperCase(), style: TextStyle(color: Colors.white), ), )), @@ -164,31 +142,26 @@ class _LabsHomePageState extends State { margin: EdgeInsets.only(left: 20), child: DoctorCard( isNoMargin: true, - onTap: () => Navigator.push( - context, - FadePage( - page: LaboratoryResultPage( - patientLabOrders: - model.patientLabOrdersList[index], - patient: patient!, - isInpatient: isInpatient!, - arrivalType: arrivalType!, - patientType: patientType!, + onTap: () { + Navigator.push( + context, + FadePage( + page: LaboratoryResultPage( + patientLabOrders: model.patientLabOrdersList[index], + patient: patient!, + isInpatient: isInpatient!, + arrivalType: arrivalType!, + patientType: patientType!, + ), ), - ), - ), - doctorName: - Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName!), - invoiceNO: - ' ${model.patientLabOrdersList[index].invoiceNo}', - profileUrl: model - .patientLabOrdersList[index].doctorImageURL!, - branch: - model.patientLabOrdersList[index].projectName!, - clinic: - Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription!), - appointmentDate: - model.patientLabOrdersList[index].createdOn!, + ); + }, + doctorName: Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName!), + invoiceNO: ' ${model.patientLabOrdersList[index].invoiceNo}', + profileUrl: model.patientLabOrdersList[index].doctorImageURL!, + branch: model.patientLabOrdersList[index].projectName!, + clinic: Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription!), + appointmentDate: model.patientLabOrdersList[index].createdOn!, orderNo: model.patientLabOrdersList[index].orderNo!, isShowTime: false, ), @@ -197,8 +170,7 @@ class _LabsHomePageState extends State { ), ), ), - if (model.patientLabOrdersList.isEmpty && - patient!.patientStatusType != 43) + if (model.patientLabOrdersList.isEmpty && patient!.patientStatusType != 43) Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 5cdea7c7..76a4ecc1 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -152,6 +152,11 @@ class _AddProcedurePageState extends State { }); }, addSelectedHistories: () {}, + selectedType: (val) { + print("------------"); + print(val); + selectedType = val; + }, isEntityListSelected: (master) => widget.model.isEntityListSelected(master, entityList), )), SizedBox( @@ -184,14 +189,18 @@ class _AddProcedurePageState extends State { return; } GifLoaderDialogUtils.showMyDialog(context); - await widget.model.preparePostProcedure( - orderType: selectedType.toString(), + await widget.model + .preparePostProcedure( + orderType: selectedType, entityList: entityList, patient: patient, remarks: remarksController.text, procedureType: ProcedureType.PROCEDURE, isLocalBusy: true, - ); + ) + + + GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context); } }), diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 09f994a5..2ca6603e 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -18,6 +18,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { final Function(EntityList) addProcedure; final bool Function(EntityList) isEntityListSelected; final List masterList; + Function(String val) selectedType; EntityListCheckboxSearchWidget({ Key? key, @@ -27,6 +28,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { required this.masterList, required this.addProcedure, required this.isEntityListSelected, + required this.selectedType, }) : super(key: key); @override @@ -34,13 +36,14 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { } class _EntityListCheckboxSearchWidgetState extends State { - String selectedType = '0'; + String? selectedType; int typeUrgent = 0; int typeRegular = 0; setSelectedType(String val) { setState(() { selectedType = val; + widget.selectedType(val); }); } diff --git a/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart b/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart index 1bb98d8e..2f5e7c62 100644 --- a/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart +++ b/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart @@ -6,7 +6,7 @@ import 'package:hexcolor/hexcolor.dart'; import '../../config/config.dart'; class CustomBottomSheetContainer extends StatelessWidget { - final Function onTap; + final Function() onTap; final String label; double headerHeight = SizeConfig.heightMultiplier! * 12; @@ -28,15 +28,14 @@ class CustomBottomSheetContainer extends StatelessWidget { child: Column( children: [ Container( - margin: EdgeInsets.only( - top: headerHeight * (SizeConfig.isWidthLarge ? 0.3 : 0.2)), + margin: EdgeInsets.only(top: headerHeight * (SizeConfig.isWidthLarge ? 0.3 : 0.2)), child: FractionallySizedBox( widthFactor: .80, child: Center( child: AppButton( title: label, color: AppGlobal.appGreenColor, - onPressed: onTap(), + onPressed: onTap, ), ), ), diff --git a/lib/widgets/patients/profile/add-order/addNewOrder.dart b/lib/widgets/patients/profile/add-order/addNewOrder.dart index d150d244..8f0e67f9 100644 --- a/lib/widgets/patients/profile/add-order/addNewOrder.dart +++ b/lib/widgets/patients/profile/add-order/addNewOrder.dart @@ -9,13 +9,13 @@ class AddNewOrder extends StatelessWidget { required this.label, }) : super(key: key); - final Function onTap; + final Function() onTap; final String label; @override Widget build(BuildContext context) { return InkWell( - onTap: onTap(), + onTap: onTap, child: Container( width: double.maxFinite, height: MediaQuery.of(context).size.height * 0.18, diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index 735c3792..8699175b 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -5,12 +5,9 @@ import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../config/size_config.dart'; - class DoctorCard extends StatelessWidget { final String? doctorName; final String? branch; @@ -18,7 +15,7 @@ class DoctorCard extends StatelessWidget { final String? profileUrl; final String? invoiceNO; final String? orderNo; - final Function? onTap; + final Function()? onTap; final bool isPrescriptions; final String? clinic; final bool isShowEye; @@ -56,7 +53,7 @@ class DoctorCard extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(15.0), child: InkWell( - onTap: (isShowEye) ? onTap!() : null, + onTap: (isShowEye) ? onTap : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -108,41 +105,36 @@ class DoctorCard extends StatelessWidget { Expanded( child: Container( margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (orderNo != null && !isPrescriptions) - CustomRow( - label: TranslationBase.of(context).orderNo , - value: orderNo!, - valueSize: 13, - labelSize: 13, - ), - if (invoiceNO != null && !isPrescriptions) - CustomRow( - label: TranslationBase.of(context).invoiceNo , - value: invoiceNO!, - valueSize: 13, - labelSize: 13, - ), - if (clinic != null) - CustomRow( - label: TranslationBase.of(context).clinic + - ": ", - - value: clinic!, - valueSize: 13, - labelSize: 13, - ), - if (branch != null) - CustomRow( - label: TranslationBase.of(context).branch + - ": ", - value: branch!, - valueSize: 13, - labelSize: 13, - ), - ]), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + if (orderNo != null && !isPrescriptions) + CustomRow( + label: TranslationBase.of(context).orderNo, + value: orderNo!, + valueSize: 13, + labelSize: 13, + ), + if (invoiceNO != null && !isPrescriptions) + CustomRow( + label: TranslationBase.of(context).invoiceNo, + value: invoiceNO!, + valueSize: 13, + labelSize: 13, + ), + if (clinic != null) + CustomRow( + label: TranslationBase.of(context).clinic + ": ", + value: clinic!, + valueSize: 13, + labelSize: 13, + ), + if (branch != null) + CustomRow( + label: TranslationBase.of(context).branch + ": ", + value: branch!, + valueSize: 13, + labelSize: 13, + ), + ]), ), ), if (isShowEye) diff --git a/lib/widgets/shared/text_fields/TextFields.dart b/lib/widgets/shared/text_fields/TextFields.dart index d679fd06..7e4a832e 100644 --- a/lib/widgets/shared/text_fields/TextFields.dart +++ b/lib/widgets/shared/text_fields/TextFields.dart @@ -89,14 +89,14 @@ class TextFields extends StatefulWidget { final Color? suffixIconColor; final Icon? prefixIcon; final VoidCallback? onTap; - final Function? onTapTextFields; + final Function()? onTapTextFields; final TextEditingController? controller; final TextInputType? keyboardType; final FormFieldValidator? validator; - final Function? onSaved; - final Function? onSuffixTap; - final Function? onChanged; - final Function? onSubmit; + final Function(String? val)? onSaved; + final Function()? onSuffixTap; + final Function(String val)? onChanged; + final Function()? onSubmit; final bool? readOnly; final int? maxLength; final int? minLines; @@ -179,7 +179,7 @@ class _TextFieldsState extends State { break; default: if (widget.suffixIcon != null) - return InkWell(onTap: widget.onSuffixTap!(), child: Icon(widget.suffixIcon, size: 22.0, color: widget.suffixIconColor != null ? widget.suffixIconColor : Colors.grey[500])); + return InkWell(onTap: widget.onSuffixTap, child: Icon(widget.suffixIcon, size: 22.0, color: widget.suffixIconColor != null ? widget.suffixIconColor : Colors.grey[500])); else return SizedBox(); } @@ -211,7 +211,7 @@ class _TextFieldsState extends State { child: Column( children: [ TextFormField( - onTap: widget.onTapTextFields!(), + onTap: widget.onTapTextFields, keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), // autovalidate: widget.autoValidate, @@ -250,7 +250,7 @@ class _TextFieldsState extends State { obscureText: widget.type == "password" && !view ? true : false, autofocus: widget.autoFocus ?? false, validator: widget.validator, - onSaved: widget.onSaved!(), + onSaved: widget.onSaved, style: Theme.of(context).textTheme.bodyText1!.copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ diff --git a/lib/widgets/shared/user-guid/CusomRow.dart b/lib/widgets/shared/user-guid/CusomRow.dart index 09a4cdfd..aea3b1e8 100644 --- a/lib/widgets/shared/user-guid/CusomRow.dart +++ b/lib/widgets/shared/user-guid/CusomRow.dart @@ -8,24 +8,24 @@ class CustomRow extends StatelessWidget { Key? key, this.label = '', this.value = '', - this.labelSize = 0, - this.valueSize = 0, + this.labelSize, + this.valueSize, this.width = 0, this.isCopyable = true, this.isExpanded = true, - this.labelColor = Colors.white, - this.valueColor = Colors.white, + this.labelColor, + this.valueColor, }) : super(key: key); final String label; final String value; - final double labelSize; - final double valueSize; + final double? labelSize; + final double? valueSize; final double width; final bool isCopyable; final bool isExpanded; - final Color labelColor; - final Color valueColor; + final Color? labelColor; + final Color? valueColor; @override Widget build(BuildContext context) { @@ -34,8 +34,7 @@ class CustomRow extends StatelessWidget { children: [ AppText( label, - fontSize: - labelSize ?? SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, + fontSize: labelSize ?? SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, color: labelColor ?? Color(0xFF575757), fontWeight: FontWeight.w600, letterSpacing: -0.4, @@ -47,8 +46,7 @@ class CustomRow extends StatelessWidget { flex: isExpanded ? 1 : 0, child: AppText( value, - fontSize: - valueSize ?? SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, + fontSize: valueSize ?? SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, color: valueColor ?? Color(0xFF2B353E), fontWeight: FontWeight.w700, letterSpacing: -0.48,