Null Safety Fixes & Overrides

update_flutter_3.16.0_voipcall
Aamir Muhammad 2 years ago
parent ea497ff8b1
commit 499cdc77d4

@ -11,7 +11,6 @@ import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequest
import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteResposeModel.dart';
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
import 'package:doctor_app_flutter/core/model/note/stp_master_list_req_model.dart';
import 'package:doctor_app_flutter/core/model/note/stp_master_list_res_model.dart';
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
import 'package:doctor_app_flutter/core/model/patient/get_clinic_by_project_id_request.dart';
import 'package:doctor_app_flutter/core/model/patient/get_doctor_by_clinic_id_request.dart';
@ -39,15 +38,12 @@ class PatientService extends BaseService {
List<LabOrdersResModel> _patientLabResultOrdersList = [];
List<LabOrdersResModel> get patientLabResultOrdersList =>
_patientLabResultOrdersList;
List<LabOrdersResModel> get patientLabResultOrdersList => _patientLabResultOrdersList;
List<PrescriptionResModel> get patientPrescriptionsList =>
_patientPrescriptionsList;
List<PrescriptionResModel> get patientPrescriptionsList => _patientPrescriptionsList;
List<PrescriptionResModel> _patientPrescriptionsList = [];
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList =>
_prescriptionReportForInPatientList;
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList => _prescriptionReportForInPatientList;
List<PrescriptionReportForInPatient> _prescriptionReportForInPatientList = [];
List<RadiologyResModel> _patientRadiologyList = [];
@ -68,17 +64,14 @@ class PatientService extends BaseService {
List<GetNursingProgressNoteResposeModel> _patientNursingProgressNoteList = [];
List<GetNursingProgressNoteResposeModel> get patientNursingProgressNoteList =>
_patientNursingProgressNoteList;
List<GetNursingProgressNoteResposeModel> get patientNursingProgressNoteList => _patientNursingProgressNoteList;
List<GetDiagnosisForInPatientResponseModel> _diagnosisForInPatientList = [];
List<GetDiagnosisForInPatientResponseModel> get diagnosisForInPatientList =>
_diagnosisForInPatientList;
List<GetDiagnosisForInPatientResponseModel> get diagnosisForInPatientList => _diagnosisForInPatientList;
List<GetDiabeticChartValuesResponseModel> _diabeticChartValuesList = [];
List<GetDiabeticChartValuesResponseModel> get diabeticChartValuesList =>
_diabeticChartValuesList;
List<GetDiabeticChartValuesResponseModel> get diabeticChartValuesList => _diabeticChartValuesList;
List<dynamic> stpMasterList = [];
@ -106,12 +99,9 @@ class PatientService extends BaseService {
get referalFrequancyList => _referalFrequancyList;
DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
DoctorsByClinicIdRequest();
STPReferralFrequencyRequest _referralFrequencyRequest =
STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest();
DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest();
STPReferralFrequencyRequest _referralFrequencyRequest = STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest();
ReferToDoctorRequest? _referToDoctorRequest;
Future<dynamic> getPatientList(patient, patientType, {isView}) async {
@ -165,8 +155,7 @@ class PatientService extends BaseService {
return Future.value(localRes);
}
Future getInPatient(
PatientSearchRequestModel requestModel, bool isMyInpatient) async {
Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
@ -206,7 +195,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_patientLabResultOrdersList = [];
response['List_GetLabOreders'].forEach((v) {
_patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v));
_patientLabResultOrdersList.add(LabOrdersResModel.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
@ -242,8 +231,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_prescriptionReportForInPatientList = [];
response['List_PrescriptionReportForInPatient'].forEach((v) {
prescriptionReportForInPatientList
.add(PrescriptionReportForInPatient.fromJson(v));
prescriptionReportForInPatientList.add(PrescriptionReportForInPatient.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
@ -498,9 +486,7 @@ class PatientService extends BaseService {
);
}
Future getNursingProgressNote(
GetNursingProgressNoteRequestModel
getNursingProgressNoteRequestModel) async {
Future getNursingProgressNote(GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel) async {
hasError = false;
await baseAppClient.post(
@ -508,8 +494,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_patientNursingProgressNoteList = [];
response['List_NursingProgressNote'].forEach((v) {
_patientNursingProgressNoteList
.add(GetNursingProgressNoteResposeModel.fromJson(v));
_patientNursingProgressNoteList.add(GetNursingProgressNoteResposeModel.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
@ -520,9 +505,7 @@ class PatientService extends BaseService {
);
}
Future getDiagnosisForInPatient(
GetDiagnosisForInPatientRequestModel
getDiagnosisForInPatientRequestModel) async {
Future getDiagnosisForInPatient(GetDiagnosisForInPatientRequestModel getDiagnosisForInPatientRequestModel) async {
hasError = false;
await baseAppClient.post(
@ -530,8 +513,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_diagnosisForInPatientList = [];
response['List_DiagnosisForInPatient'].forEach((v) {
_diagnosisForInPatientList
.add(GetDiagnosisForInPatientResponseModel.fromJson(v));
_diagnosisForInPatientList.add(GetDiagnosisForInPatientResponseModel.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
@ -542,9 +524,7 @@ class PatientService extends BaseService {
);
}
Future getDiabeticChartValues(
GetDiabeticChartValuesRequestModel
getDiabeticChartValuesRequestModel) async {
Future getDiabeticChartValues(GetDiabeticChartValuesRequestModel getDiabeticChartValuesRequestModel) async {
hasError = false;
await baseAppClient.post(
@ -552,8 +532,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_diabeticChartValuesList = [];
response['List_DiabeticChartValues'].forEach((v) {
_diabeticChartValuesList
.add(GetDiabeticChartValuesResponseModel.fromJson(v));
_diabeticChartValuesList.add(GetDiabeticChartValuesResponseModel.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
@ -564,8 +543,7 @@ class PatientService extends BaseService {
);
}
Future getStpMasterList(
StpMasterListRequestModel stpMasterListRequestModel) async {
Future getStpMasterList(StpMasterListRequestModel stpMasterListRequestModel) async {
hasError = false;
await baseAppClient.post(

@ -142,10 +142,6 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Busy);
} else
setState(ViewState.Busy);
//else
// setState(ViewState.Busy);
await _SOAPService.getMasterLookup(masterKeys, searchKey: searchKey);
if (_SOAPService.hasError) {
error = _SOAPService.error;
@ -259,7 +255,7 @@ class SOAPViewModel extends BaseViewModel {
return allergiesString;
}
Future getPatientPhysicalExam(PatiantInformtion patientInfo, {required bool allowSetState}) async {
Future getPatientPhysicalExam(PatiantInformtion patientInfo) async {
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo == null ? "0" : patientInfo.episodeNo.toString(),
@ -273,12 +269,13 @@ class SOAPViewModel extends BaseViewModel {
getPhysicalExamReqModel.admissionNo = int.parse(patientInfo.admissionNo!);
else
getPhysicalExamReqModel.admissionNo = 0;
if (allowSetState) setState(ViewState.Busy);
setState(ViewState.Busy);
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
if (allowSetState) setState(ViewState.Error);
} else if (allowSetState) setState(ViewState.Idle);
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientProgressNote(GetProgressNoteReqModel getGetProgressNoteReqModel) async {
@ -520,8 +517,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future onAddMedicationStart({required bool allowSetState}) async {
if (allowSetState) setState(ViewState.Busy);
Future onAddMedicationStart() async {
setState(ViewState.Busy);
List services = [];
if (medicationStrengthList.length == 0) {
if (services.isEmpty) {
@ -563,8 +560,12 @@ class SOAPViewModel extends BaseViewModel {
if (_SOAPService.hasError || _prescriptionService.hasError) {
error = _SOAPService.error.toString() + _prescriptionService.error.toString();
if (allowSetState) setState(ViewState.ErrorLocal);
} else if (allowSetState) setState(ViewState.Idle);
setState(ViewState.ErrorLocal);
} else {
setState(
ViewState.Idle,
);
}
}
callAddAssessmentLookupsServices({String searchKey = "", bool allowSetState = true}) async {

@ -7,9 +7,11 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:flutter/material.dart';

@ -1,5 +1,4 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
@ -29,7 +28,7 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
@override
initState() {
super.initState();
mySelectedExaminationLocal = [...?widget.mySelectedExamination];
mySelectedExaminationLocal = widget.mySelectedExamination!;
}
@override
@ -37,9 +36,11 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(
MasterKeysService.PhysicalExamination,
);
WidgetsBinding.instance.addPostFrameCallback((_) async {
await model.getMasterLookup(
MasterKeysService.PhysicalExamination,
);
});
}
},
builder: (_, model, w) => AppScaffold(
@ -71,7 +72,7 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
child: Column(
children: [
ExaminationsListSearchWidget(
mySelectedExamination: widget.mySelectedExamination!,
mySelectedExamination: widget.mySelectedExamination,
masterList: model.physicalExaminationList,
isServiceSelected: (master) => isServiceSelected(master),
removeExamination: (selectedExamination) {
@ -93,23 +94,27 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
),
],
),
bottomSheet: model.state != ViewState.Idle
? Container(
height: 0,
)
: CustomBottomSheetContainer(
label: "${TranslationBase.of(context).addExamination}",
onTap: () {
widget.addSelectedExamination(mySelectedExaminationLocal);
},
),
bottomSheet:
// model.state != ViewState.Idle
// ? Container(
// height: 10,
// color: Colors.red,
// )
// :
CustomBottomSheetContainer(
label: "${TranslationBase.of(context).addExamination}",
onTap: () {
widget.addSelectedExamination(mySelectedExaminationLocal);
},
),
));
}
isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = mySelectedExaminationLocal.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId);
if (exam.length > 0) {
print("--------------");
return true;
}
return false;

@ -23,12 +23,12 @@ class ExaminationsListSearchWidget extends StatefulWidget {
class _ExaminationsListSearchWidgetState extends State<ExaminationsListSearchWidget> {
int expandedIndex = -1;
List<MasterKeyModel> items = [];
List<MasterKeyModel>? items = [];
TextEditingController filteredSearchController = TextEditingController();
@override
void initState() {
items.addAll(widget.masterList as Iterable<MasterKeyModel>);
items!.addAll(widget.masterList!);
super.initState();
}
@ -58,7 +58,7 @@ class _ExaminationsListSearchWidgetState extends State<ExaminationsListSearchWid
DividerWithSpacesAround(
height: 2,
),
...items.mapIndexed((index, item) {
...items!.mapIndexed((index, item) {
return AddExaminationWidget(
item: item,
addExamination: widget.addExamination,
@ -92,14 +92,14 @@ class _ExaminationsListSearchWidgetState extends State<ExaminationsListSearchWid
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
items!.clear();
items!.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList as Iterable<MasterKeyModel>);
items!.clear();
items!.addAll(widget.masterList as Iterable<MasterKeyModel>);
});
}
}

@ -60,7 +60,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
model.setObjectiveCallBack(this);
mySelectedExamination.clear();
model.isAddExamInProgress = true;
await model.getPatientPhysicalExam(widget.patientInfo, allowSetState: false);
await model.getPatientPhysicalExam(widget.patientInfo);
if (model.patientPhysicalExamList.isNotEmpty) {
if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination);
@ -273,28 +273,25 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
page: AddExaminationPage(
mySelectedExamination: mySelectedExamination,
addSelectedExamination: (List<MySelectedExamination> mySelectedExaminationLocal) {
setState(() {
{
mySelectedExaminationLocal.forEach((element) {
if ((mySelectedExamination.singleWhere((it) => it.selectedExamination!.id == element.selectedExamination!.id, orElse: () => MySelectedExamination())) == null) {
mySelectedExamination.insert(0, element);
}
});
/// remove items.
List<MySelectedExamination> removedList = [];
mySelectedExamination.forEach((element) {
if ((mySelectedExaminationLocal.singleWhere((it) => it.selectedExamination!.id == element.selectedExamination!.id, orElse: () => MySelectedExamination())) == null) {
removedList.add(element);
}
});
mySelectedExaminationLocal.forEach((element) {
if (mySelectedExamination.singleWhere((it) => it.selectedExamination!.id == element.selectedExamination!.id, orElse: () => MySelectedExamination()) == MySelectedExamination()) {
mySelectedExamination.insert(0, element);
}
});
removedList.forEach((element) {
removeExamination(element.selectedExamination!);
});
Navigator.of(context).pop();
/// remove items.
List<MySelectedExamination> removedList = [];
mySelectedExamination.forEach((element) {
if (mySelectedExaminationLocal.singleWhere((it) => it.selectedExamination!.id == element.selectedExamination!.id, orElse: () => MySelectedExamination()) == MySelectedExamination()) {
removedList.add(element);
}
});
removedList.forEach((element) {
removeExamination(element.selectedExamination!);
});
Navigator.of(context).pop();
setState(() {});
},
removeExamination: (masterKey) => removeExamination(masterKey)),
),

@ -54,7 +54,7 @@ class _AddMedicationState extends State<AddMedication> {
return FractionallySizedBox(
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {
model.onAddMedicationStart(allowSetState: false).whenComplete(() {});
model.onAddMedicationStart();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,

@ -49,9 +49,7 @@ class _ShowTimerState extends State<ShowTimer> {
generateShowTimerString() {
DateTime now = DateTime.now();
DateTime liveCareDate = DateTime.parse(widget.patientInfo.arrivalTime!);
String timer = AppDateUtils.differenceBetweenDateAndCurrent(
liveCareDate, context,
isShowSecond: true, isShowDays: false);
String timer = AppDateUtils.differenceBetweenDateAndCurrent(liveCareDate, context, isShowSecond: true, isShowDays: false);
return timer;
}

@ -3,22 +3,19 @@ import 'package:flutter/material.dart';
class HeaderBodyExpandableNotifier extends StatefulWidget {
final Widget? headerWidget;
final Widget? bodyWidget;
final Widget bodyWidget;
final Widget? collapsed;
final bool isExpand;
bool expandFlag = false;
var controller = new ExpandableController();
var controller = ExpandableController();
HeaderBodyExpandableNotifier(
{this.headerWidget, this.bodyWidget, this.collapsed, this.isExpand = false});
HeaderBodyExpandableNotifier({this.headerWidget, required this.bodyWidget, this.collapsed, this.isExpand = false});
@override
_HeaderBodyExpandableNotifierState createState() =>
_HeaderBodyExpandableNotifierState();
_HeaderBodyExpandableNotifierState createState() => _HeaderBodyExpandableNotifierState();
}
class _HeaderBodyExpandableNotifierState
extends State<HeaderBodyExpandableNotifier> {
class _HeaderBodyExpandableNotifierState extends State<HeaderBodyExpandableNotifier> {
@override
void initState() {
super.initState();
@ -50,7 +47,7 @@ class _HeaderBodyExpandableNotifierState
),
// header: widget.headerWidget,
collapsed: Container(),
expanded: widget.bodyWidget!,
expanded: widget.bodyWidget,
builder: (_, collapsed, expanded) {
return Padding(
padding: EdgeInsets.only(left: 0, right: 0, bottom: 0),

Loading…
Cancel
Save