Null Safety Update

ipd-changes-for-vida-plus
Aamir Muhammad 3 years ago
parent 597d5a3498
commit 76f8b37d1e

@ -4,19 +4,12 @@ class MySelectedAllergy {
MasterKeyModel? selectedAllergySeverity; MasterKeyModel? selectedAllergySeverity;
MasterKeyModel? selectedAllergy; MasterKeyModel? selectedAllergy;
String? remark; String? remark;
bool? isChecked; bool isChecked;
bool? isExpanded; bool isExpanded;
bool? isLocal; bool isLocal;
int? createdBy; int? createdBy;
bool? hasValidationError; bool hasValidationError;
MySelectedAllergy( MySelectedAllergy(
{this.selectedAllergySeverity, {this.selectedAllergySeverity, this.selectedAllergy, this.remark, this.isChecked = false, this.isExpanded = true, this.isLocal = true, this.createdBy, this.hasValidationError = false});
this.selectedAllergy,
this.remark,
this.isChecked,
this.isExpanded = true,
this.isLocal = true,
this.createdBy,
this.hasValidationError = false});
} }

@ -3,11 +3,11 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
class MySelectedExamination { class MySelectedExamination {
MasterKeyModel? selectedExamination; MasterKeyModel? selectedExamination;
String? remark; String? remark;
bool? isNormal; bool isNormal;
bool? isAbnormal; bool isAbnormal;
bool? notExamined; bool notExamined;
bool? isNew; bool isNew;
bool? isLocal; bool isLocal;
int? createdBy; int? createdBy;
String? createdOn; String? createdOn;
String? editedOn; String? editedOn;

@ -7,8 +7,6 @@ import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import './config/size_config.dart'; import './config/size_config.dart';

@ -23,11 +23,11 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
class EndCallScreen extends StatefulWidget { class EndCallScreen extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion? patient;
const EndCallScreen({ const EndCallScreen({
Key? key, Key? key,
required this.patient, this.patient,
}) : super(key: key); }) : super(key: key);
@override @override
@ -49,7 +49,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.patient != null) patient = widget.patient; if (widget.patient != null) patient = widget.patient!;
} }
@override @override
@ -233,11 +233,11 @@ class _EndCallScreenState extends State<EndCallScreen> {
isInPatient: cardsList[index].isInPatient, isInPatient: cardsList[index].isInPatient,
isDischargedPatient: cardsList[index].isDischargedPatient, isDischargedPatient: cardsList[index].isDischargedPatient,
isDisable: cardsList[index].isDisable, isDisable: cardsList[index].isDisable,
onTap: cardsList[index].onTap, onTap: cardsList[index].onTap!,
isLoading: cardsList[index].isLoading, isLoading: cardsList[index].isLoading,
isDartIcon: cardsList[index].isDartIcon, isDartIcon: cardsList[index].isDartIcon,
dartIcon: cardsList[index].dartIcon, dartIcon: cardsList[index].dartIcon!,
color: cardsList[index].color, color: cardsList[index].color!,
), ),
), ),
], ],

@ -29,7 +29,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
//appBarTitle: 'Discharged Patient', //appBarTitle: 'Discharged Patient',
//subtitle: "Last Three Months", //subtitle: "Last Three Months",
backgroundColor: Colors.grey[200], backgroundColor: Colors.grey[200]!,
isShowAppBar: false, isShowAppBar: false,
baseViewModel: model, baseViewModel: model,
body: model.myDischargedPatient.isEmpty body: model.myDischargedPatient.isEmpty
@ -58,7 +58,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
DoctorApp.filter_1, DoctorApp.filter_1,
color: Colors.black, color: Colors.black,
), ),
iconSize: 20, iconSize: 20, onPressed: () { },
), ),
), ),
SizedBox( SizedBox(
@ -155,17 +155,17 @@ class _DischargedPatientState extends State<DischargedPatient> {
.filterData[ .filterData[
index] index]
.nationalityName .nationalityName
.trim() !.trim()
: model.filterData[index].nationality != : model.filterData[index].nationality !=
null null
? model ? model
.filterData[ .filterData[
index] index]
.nationality .nationality
.trim() !.trim()
: model.filterData[index].nationalityId != : model.filterData[index].nationalityId !=
null null
? model.filterData[index].nationalityId ? model.filterData[index].nationalityId!
: "", : "",
fontWeight: fontWeight:
FontWeight FontWeight
@ -187,7 +187,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
.network( .network(
model.filterData[index].nationalityFlagURL != model.filterData[index].nationalityFlagURL !=
null null
? model.filterData[index].nationalityFlagURL ? model.filterData[index].nationalityFlagURL!
: '', : '',
height: height:
25, 25,
@ -196,7 +196,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
errorBuilder: (BuildContext context, errorBuilder: (BuildContext context,
Object Object
exception, exception,
StackTrace StackTrace?
stackTrace) { stackTrace) {
return AppText( return AppText(
'', '',
@ -254,7 +254,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
style: new TextStyle( style: new TextStyle(
fontSize: 2.0 * fontSize: 2.0 *
SizeConfig SizeConfig
.textMultiplier, .textMultiplier!,
color: Colors color: Colors
.black), .black),
children: < children: <
@ -292,7 +292,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
new TextStyle( new TextStyle(
fontSize: 2.0 * fontSize: 2.0 *
SizeConfig SizeConfig
.textMultiplier, .textMultiplier!,
color: Colors color: Colors
.black, .black,
fontFamily: fontFamily:
@ -330,7 +330,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
new TextStyle( new TextStyle(
fontSize: 2.0 * fontSize: 2.0 *
SizeConfig SizeConfig
.textMultiplier, .textMultiplier!,
color: Colors color: Colors
.black, .black,
fontFamily: fontFamily:
@ -369,7 +369,7 @@ class _DischargedPatientState extends State<DischargedPatient> {
.w300, .w300,
), ),
AppText( AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}", "${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate!)).inDays + 1}",
fontSize: fontSize:
15, 15,
fontWeight: fontWeight:

@ -17,7 +17,7 @@ import 'package:url_launcher/url_launcher.dart';
class ECGPage extends StatelessWidget { class ECGPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patient-type']; String patientType = routeArgs['patient-type'];
String arrivalType = routeArgs['arrival-type']; String arrivalType = routeArgs['arrival-type'];
@ -60,7 +60,7 @@ class ECGPage extends StatelessWidget {
(index) => InkWell( (index) => InkWell(
onTap: () async { onTap: () async {
await launch(model await launch(model
.patientMuseResultsModelList[index].imageURL); .patientMuseResultsModelList[index].imageURL!);
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
@ -92,7 +92,7 @@ class ECGPage extends StatelessWidget {
text: TextSpan( text: TextSpan(
style: TextStyle( style: TextStyle(
fontSize: 1.6 * fontSize: 1.6 *
SizeConfig.textMultiplier, SizeConfig.textMultiplier!,
color: Colors.black), color: Colors.black),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
@ -122,15 +122,15 @@ class ECGPage extends StatelessWidget {
CrossAxisAlignment.end, CrossAxisAlignment.end,
children: [ children: [
AppText( AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime, isArabic: projectViewModel.isArabic)}', '${AppDateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime!, isArabic: projectViewModel.isArabic)}',
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
AppText( AppText(
'${AppDateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime)}', '${AppDateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime!)}',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.grey[700], color: Colors.grey[700]!,
fontSize: 14, fontSize: 14,
), ),
], ],

@ -50,9 +50,8 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
), ),
Expanded( Expanded(
child: AppText( child: AppText(
(Utils.capitalize( (Utils.capitalize("${referredPatient.firstName} ${referredPatient.lastName}")),
"${referredPatient.firstName} ${referredPatient.lastName}")), fontSize: SizeConfig.textMultiplier! * 2.5,
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -68,20 +67,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
PatiantInformtion patient = PatiantInformtion patient = model.getPatientFromDischargeReferralPatient(referredPatient);
model.getPatientFromDischargeReferralPatient( Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
referredPatient);
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patient, "patient": patient,
"patientType": "1", "patientType": "1",
"isInpatient": true, "isInpatient": true,
"arrivalType": "1", "arrivalType": "1",
"isDischargedPatient": true, "isDischargedPatient": true,
"from": AppDateUtils.convertDateToFormat( "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
DateTime.now(), 'yyyy-MM-dd'), "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
"to": AppDateUtils.convertDateToFormat(
DateTime.now(), 'yyyy-MM-dd'),
}); });
}, },
child: Icon( child: Icon(
@ -112,27 +106,26 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
AppText( AppText(
"${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}", "${model.getReferralStatusNameByCode(referredPatient.referralStatus!, context)}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 1.9 * SizeConfig.textMultiplier, fontSize: 1.9 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: referredPatient.referralStatus == 1 color: referredPatient.referralStatus == 1
? AppGlobal.inProgressColor ? AppGlobal.inProgressColor
: referredPatient.referralStatus == 46 : referredPatient.referralStatus == 46
? AppGlobal.appGreenColor ? AppGlobal.appGreenColor
: Colors.red[700], : Colors.red[700]!,
), ),
AppText( AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(
referredPatient.referralDate, referredPatient.referralDate!,
), ),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 2.0 * SizeConfig.textMultiplier, fontSize: 2.0 * SizeConfig.textMultiplier!,
color: Color(0XFF28353E), color: Color(0XFF28353E),
) )
], ],
@ -145,19 +138,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Admission Date: ", "Admission Date: ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
AppDateUtils AppDateUtils.convertDateFromServerFormat(referredPatient.admissionDate!, "dd MMM,yyyy"),
.convertDateFromServerFormat(
referredPatient.admissionDate,
"dd MMM,yyyy"),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -171,19 +160,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Discharge Date: ", "Discharge Date: ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
AppDateUtils AppDateUtils.convertDateFromServerFormat(referredPatient.dischargeDate!, "dd MMM,yyyy"),
.convertDateFromServerFormat(
referredPatient.dischargeDate,
"dd MMM,yyyy"),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -197,16 +182,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Number of Days: ", "Number of Days: ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
"${AppDateUtils.convertStringToDate(referredPatient.dischargeDate).difference(AppDateUtils.convertStringToDate(referredPatient.admissionDate)).inDays + 1}", "${AppDateUtils.convertStringToDate(referredPatient.dischargeDate!).difference(AppDateUtils.convertStringToDate(referredPatient.admissionDate!)).inDays + 1}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -220,44 +204,38 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Referring Doctor ", "Referring Doctor ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient.referringDoctorName, referredPatient.referringDoctorName!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).fileNumber,
.fileNumber,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.7 * SizeConfig.textMultiplier!,
1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
"${referredPatient.patientID}", "${referredPatient.patientID}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -265,60 +243,48 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
"${TranslationBase.of(context).refClinic}: ", "${TranslationBase.of(context).refClinic}: ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
referredPatient referredPatient.referringClinicDescription!,
.referringClinicDescription,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * fontSize: 1.8 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).frequency + ": ",
.frequency +
": ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient referredPatient.frequencyDescription!,
.frequencyDescription,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * fontSize: 1.8 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -334,20 +300,18 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context).priority + TranslationBase.of(context).priority + ": ",
": ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient.priorityDescription, referredPatient.priorityDescription!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -361,17 +325,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Referring Clinic ", "Referring Clinic ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient referredPatient.referringClinicDescription!,
.referringClinicDescription,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -385,7 +347,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Frequency ", "Frequency ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
@ -393,8 +355,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
referredPatient.frequency.toString(), referredPatient.frequency.toString(),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -408,7 +369,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
"Priority ", "Priority ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
@ -416,8 +377,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
referredPatient.frequency.toString(), referredPatient.frequency.toString(),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -428,24 +388,18 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).maxResponseTime + ": ",
.maxResponseTime +
": ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
AppDateUtils AppDateUtils.convertDateFromServerFormat(referredPatient.mAXResponseTime!, "dd MMM,yyyy"),
.convertDateFromServerFormat(
referredPatient.mAXResponseTime,
"dd MMM,yyyy"),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -455,8 +409,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: margin: EdgeInsets.only(left: 10, right: 0),
EdgeInsets.only(left: 10, right: 0),
child: Image.asset( child: Image.asset(
'assets/images/patient/ic_ref_arrow_left.png', 'assets/images/patient/ic_ref_arrow_left.png',
height: 50, height: 50,
@ -500,30 +453,22 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
Expanded( Expanded(
flex: 4, flex: 4,
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 10, top: 30, right: 10, bottom: 0),
left: 10,
top: 30,
right: 10,
bottom: 0),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
"${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}", "${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontSize: 1.5 * fontSize: 1.5 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
referredPatient referredPatient.referringClinicDescription!,
.referringClinicDescription,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.3 * fontSize: 1.3 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -563,14 +508,14 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
TranslationBase.of(context).remarks, TranslationBase.of(context).remarks,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 2.4 * SizeConfig.textMultiplier, fontSize: 2.4 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
AppText( AppText(
referredPatient.referringDoctorRemarks, referredPatient.referringDoctorRemarks!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
SizedBox( SizedBox(

@ -26,7 +26,7 @@ class _ReferralDischargedPatientPageState
onModelReady: (model) => model.gtMyDischargeReferralPatient(), onModelReady: (model) => model.gtMyDischargeReferralPatient(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
appBarTitle: 'Referral Discharged ', appBarTitle: 'Referral Discharged ',
backgroundColor: Colors.grey[200], backgroundColor: Colors.grey[200]!,
isShowAppBar: false, isShowAppBar: false,
baseViewModel: model, baseViewModel: model,
body: model.myDischargeReferralPatient.isEmpty body: model.myDischargeReferralPatient.isEmpty
@ -63,27 +63,27 @@ class _ReferralDischargedPatientPageState
model.getReferralStatusNameByCode( model.getReferralStatusNameByCode(
model model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referralStatus, .referralStatus!,
context), context),
referralStatusCode: model referralStatusCode: model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referralStatus, .referralStatus!,
patientName: model patientName: model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.firstName + .firstName! +
" " + " " +
model.myDischargeReferralPatient[index] model.myDischargeReferralPatient[index]
.lastName, .lastName!,
patientGender: model patientGender: model
.myDischargeReferralPatient[index].gender, .myDischargeReferralPatient[index].gender!,
referredDate: referredDate:
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(
model model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referralDate), .referralDate!),
referredTime: AppDateUtils.getTimeHHMMA(model referredTime: AppDateUtils.getTimeHHMMA(model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referralDate), .referralDate!),
patientID: patientID:
"${model.myDischargeReferralPatient[index].patientID}", "${model.myDischargeReferralPatient[index].patientID}",
isSameBranch: false, isSameBranch: false,
@ -93,20 +93,20 @@ class _ReferralDischargedPatientPageState
"${model.myDischargeReferralPatient[index].referringClinicDescription}", "${model.myDischargeReferralPatient[index].referringClinicDescription}",
remark: model remark: model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referringDoctorRemarks, .referringDoctorRemarks!,
nationality: model nationality: model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.nationalityName, .nationalityName!,
nationalityFlag: '', nationalityFlag: '',
//model.myDischargeReferralPatient[index].nationalityFlagURL, //TODO From backend //model.myDischargeReferralPatient[index].nationalityFlagURL, //TODO From backend
doctorAvatar: '', doctorAvatar: '',
//model.myDischargeReferralPatient[index].doctorImageURL, //TODO From backend //model.myDischargeReferralPatient[index].doctorImageURL, //TODO From backend
referralDoctorName: model referralDoctorName: model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referringDoctorName, .referringDoctorName!,
clinicDescription: model clinicDescription: model
.myDischargeReferralPatient[index] .myDischargeReferralPatient[index]
.referringClinicDescription, .referringClinicDescription!,
infoIcon: Icon(FontAwesomeIcons.arrowRight, infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black), size: 25, color: Colors.black),
), ),

@ -20,7 +20,7 @@ import '../base/base_view.dart';
class InsuranceApprovalScreenNew extends StatefulWidget { class InsuranceApprovalScreenNew extends StatefulWidget {
final int appointmentNo; final int appointmentNo;
InsuranceApprovalScreenNew({this.appointmentNo}); InsuranceApprovalScreenNew({this.appointmentNo = 0});
@override @override
_InsuranceApprovalScreenNewState createState() => _InsuranceApprovalScreenNewState createState() =>
@ -32,7 +32,7 @@ class _InsuranceApprovalScreenNewState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
patient = routeArgs['patient']; patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
@ -42,10 +42,10 @@ class _InsuranceApprovalScreenNewState
? (model) => model.getInsuranceInPatient(mrn: patient.patientId) ? (model) => model.getInsuranceInPatient(mrn: patient.patientId)
: patient.appointmentNo != null : patient.appointmentNo != null
? (model) => model.getInsuranceApproval(patient, ? (model) => model.getInsuranceApproval(patient,
appointmentNo: int.parse(patient?.appointmentNo.toString()), appointmentNo: int.parse(patient.appointmentNo!.toString()),
projectId: patient.projectId) projectId: patient.projectId)
: (model) => model.getInsuranceApproval(patient), : (model) => model.getInsuranceApproval(patient),
builder: (BuildContext context, InsuranceViewModel model, Widget child) => builder: (BuildContext context, InsuranceViewModel model, Widget? child) =>
AppScaffold( AppScaffold(
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient,
@ -58,9 +58,9 @@ class _InsuranceApprovalScreenNewState
? SingleChildScrollView( ? SingleChildScrollView(
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: SizeConfig.screenWidth * 0.004, left: SizeConfig.screenWidth! * 0.004,
right: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth! * 0.004,
top: SizeConfig.screenWidth * 0.04, top: SizeConfig.screenWidth! * 0.04,
), ),
child: model.insuranceApprovalInPatient.length != 0 child: model.insuranceApprovalInPatient.length != 0
? Column( ? Column(
@ -93,13 +93,13 @@ class _InsuranceApprovalScreenNewState
patientOut: "In Patient", patientOut: "In Patient",
profileUrl: model profileUrl: model
.insuranceApprovalInPatient[index] .insuranceApprovalInPatient[index]
.doctorImage, .doctorImage!,
clinic: model clinic: model
.insuranceApprovalInPatient[index] .insuranceApprovalInPatient[index]
.clinicName, .clinicName!,
doctorName: model doctorName: model
.insuranceApprovalInPatient[index] .insuranceApprovalInPatient[index]
.doctorName, .doctorName!,
approvalNo: model approvalNo: model
.insuranceApprovalInPatient[index] .insuranceApprovalInPatient[index]
.approvalNo .approvalNo
@ -111,7 +111,7 @@ class _InsuranceApprovalScreenNewState
'', '',
branch2: model branch2: model
.insuranceApprovalInPatient[index] .insuranceApprovalInPatient[index]
.projectName, .projectName!,
), ),
), ),
), ),
@ -127,9 +127,9 @@ class _InsuranceApprovalScreenNewState
: SingleChildScrollView( : SingleChildScrollView(
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: SizeConfig.screenWidth * 0.004, left: SizeConfig.screenWidth! * 0.004,
right: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth! * 0.004,
top: SizeConfig.screenWidth * 0.04, top: SizeConfig.screenWidth! * 0.04,
), ),
child: model.insuranceApproval.length != 0 child: model.insuranceApproval.length != 0
? Column( ? Column(
@ -168,13 +168,13 @@ class _InsuranceApprovalScreenNewState
}, },
child: DoctorCardInsurance( child: DoctorCardInsurance(
patientOut: model.insuranceApproval[index] patientOut: model.insuranceApproval[index]
.patientDescription, .patientDescription!,
profileUrl: model profileUrl: model
.insuranceApproval[index].doctorImage, .insuranceApproval[index].doctorImage!,
clinic: model clinic: model
.insuranceApproval[index].clinicName, .insuranceApproval[index].clinicName!,
doctorName: model doctorName: model
.insuranceApproval[index].doctorName, .insuranceApproval[index].doctorName!,
approvalNo: model approvalNo: model
.insuranceApproval[index].approvalNo .insuranceApproval[index].approvalNo
.toString(), .toString(),
@ -184,7 +184,7 @@ class _InsuranceApprovalScreenNewState
.approvalStatusDescption ?? .approvalStatusDescption ??
'', '',
branch2: model branch2: model
.insuranceApproval[index].projectName, .insuranceApproval[index].projectName!,
), ),
), ),
), ),

File diff suppressed because it is too large Load Diff

@ -10,23 +10,21 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class OutPatientPrescriptionDetailsScreen extends StatefulWidget { class OutPatientPrescriptionDetailsScreen extends StatefulWidget {
final PrescriptionResModel prescriptionResModel; final PrescriptionResModel? prescriptionResModel;
OutPatientPrescriptionDetailsScreen({Key key, this.prescriptionResModel}); OutPatientPrescriptionDetailsScreen({Key? key, this.prescriptionResModel});
@override @override
_OutPatientPrescriptionDetailsScreenState createState() => _OutPatientPrescriptionDetailsScreenState createState() => _OutPatientPrescriptionDetailsScreenState();
_OutPatientPrescriptionDetailsScreenState();
} }
class _OutPatientPrescriptionDetailsScreenState class _OutPatientPrescriptionDetailsScreenState extends State<OutPatientPrescriptionDetailsScreen> {
extends State<OutPatientPrescriptionDetailsScreen> {
getPrescriptionReport(BuildContext context, PatientViewModel model) { getPrescriptionReport(BuildContext context, PatientViewModel model) {
RequestPrescriptionReport prescriptionReqModel = RequestPrescriptionReport( RequestPrescriptionReport prescriptionReqModel = RequestPrescriptionReport(
appointmentNo: widget.prescriptionResModel.appointmentNo, appointmentNo: widget.prescriptionResModel!.appointmentNo,
episodeID: widget.prescriptionResModel.episodeID, episodeID: widget.prescriptionResModel!.episodeID,
setupID: widget.prescriptionResModel.setupID, setupID: widget.prescriptionResModel!.setupID,
patientTypeID: widget.prescriptionResModel.patientID); patientTypeID: widget.prescriptionResModel!.patientID);
model.getPrescriptionReport(prescriptionReqModel.toJson()); model.getPrescriptionReport(prescriptionReqModel.toJson());
} }

@ -9,18 +9,18 @@ import '../../../../config/config.dart';
class PageStepperWidget extends StatelessWidget { class PageStepperWidget extends StatelessWidget {
final int stepsCount; final int stepsCount;
final int currentStepIndex; final int currentStepIndex;
final Size screenSize; final Size? screenSize;
final List<String> stepsTitles; final List<String>? stepsTitles;
PageStepperWidget( PageStepperWidget(
{this.stepsCount, {this.stepsCount = 0,
this.currentStepIndex, this.currentStepIndex = 0,
this.screenSize, this.screenSize,
this.stepsTitles}); this.stepsTitles});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double dividerWidth = (screenSize.width / stepsCount) - (10 * stepsCount); double dividerWidth = (screenSize!.width / stepsCount) - (10 * stepsCount);
return Container( return Container(
margin: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), margin: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
@ -37,7 +37,7 @@ class PageStepperWidget extends StatelessWidget {
i == stepsCount, i == stepsCount,
i < currentStepIndex, i < currentStepIndex,
dividerWidth, dividerWidth,
stepsTitles: stepsTitles, stepsTitles: stepsTitles!,
) )
else else
StepWidget( StepWidget(
@ -46,7 +46,7 @@ class PageStepperWidget extends StatelessWidget {
i == stepsCount, i == stepsCount,
i < currentStepIndex, i < currentStepIndex,
dividerWidth, dividerWidth,
stepsTitles: stepsTitles, stepsTitles: stepsTitles!,
) )
], ],
) )
@ -62,7 +62,7 @@ class StepWidget extends StatelessWidget {
final bool isFinalStep; final bool isFinalStep;
final bool isStepFinish; final bool isStepFinish;
final double dividerWidth; final double dividerWidth;
final List<String> stepsTitles; final List<String>? stepsTitles;
StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish,
this.dividerWidth, this.dividerWidth,
@ -132,11 +132,11 @@ class StepWidget extends StatelessWidget {
AppText( AppText(
stepsTitles == null stepsTitles == null
? "${TranslationBase.of(context).step} $index" ? "${TranslationBase.of(context).step} $index"
: "${stepsTitles[index - 1]}", : "${stepsTitles![index - 1]}",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.black, color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.black,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
Container( Container(
margin: EdgeInsets.symmetric(vertical: 4), margin: EdgeInsets.symmetric(vertical: 4),
@ -167,7 +167,7 @@ class StepWidget extends StatelessWidget {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.4, fontSize: SizeConfig.textMultiplier! * 1.4,
color: status == StepStatus.InProgress color: status == StepStatus.InProgress
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
: status == StepStatus.Locked : status == StepStatus.Locked

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/widgets/medication_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/widgets/medication_widget.dart';
@ -14,12 +15,11 @@ import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../../routes.dart';
class UcafDetailScreen extends StatefulWidget { class UcafDetailScreen extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final UcafViewModel model; final UcafViewModel model;
final Function changeLoadingState; final Function? changeLoadingState;
UcafDetailScreen(this.patient, this.model, {this.changeLoadingState}); UcafDetailScreen(this.patient, this.model, {this.changeLoadingState});
@ -32,7 +32,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
final PatiantInformtion patient; final PatiantInformtion patient;
final UcafViewModel model; final UcafViewModel model;
UcafViewModel ucafModel; UcafViewModel ucafModel = UcafViewModel();
int _activeTap = 0; int _activeTap = 0;
@ -41,9 +41,9 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
@override @override
void initState() { void initState() {
model.saveUCAFOnTap = () async { model.saveUCAFOnTap = () async {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
await ucafModel.postUCAF(patient); await ucafModel.postUCAF(patient);
widget.changeLoadingState(false); widget.changeLoadingState!(false);
if (ucafModel.state == ViewState.Idle) { if (ucafModel.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
TranslationBase.of(context).postUcafSuccessMsg); TranslationBase.of(context).postUcafSuccessMsg);
@ -67,7 +67,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
model.resetDataInFirst(firstPage: false); model.resetDataInFirst(firstPage: false);
await model.getLanguage(); await model.getLanguage();
await model.getPatientAssessment(patient); await model.getPatientAssessment(patient);
widget.changeLoadingState(false); widget.changeLoadingState!(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -134,18 +134,18 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
onTap: () async { onTap: () async {
print(__treatmentSteps.indexOf(item)); print(__treatmentSteps.indexOf(item));
if (__treatmentSteps.indexOf(item) == 0) { if (__treatmentSteps.indexOf(item) == 0) {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
await model.getPatientAssessment(patient); await model.getPatientAssessment(patient);
widget.changeLoadingState(false); widget.changeLoadingState!(false);
} else if (__treatmentSteps.indexOf(item) == 1) { } else if (__treatmentSteps.indexOf(item) == 1) {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
await model.getPrescription(patient); await model.getPrescription(patient);
widget.changeLoadingState(false); widget.changeLoadingState!(false);
} }
if (__treatmentSteps.indexOf(item) == 2) { if (__treatmentSteps.indexOf(item) == 2) {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
await model.getOrderProcedures(patient); await model.getOrderProcedures(patient);
widget.changeLoadingState(false); widget.changeLoadingState!(false);
} }
setState(() { setState(() {
_activeTap = __treatmentSteps.indexOf(item); _activeTap = __treatmentSteps.indexOf(item);
@ -181,18 +181,18 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
} }
break; break;
case 1: case 1:
if (model.prescriptionList != null && model.prescriptionList.entityList != null && model.prescriptionList.entityList.isNotEmpty) { if (model.prescriptionList != null && model.prescriptionList.entityList != null && model.prescriptionList.entityList!.isNotEmpty) {
return [ return [
ListView.builder( ListView.builder(
itemCount: model.prescriptionList != null itemCount: model.prescriptionList != null
? model.prescriptionList.entityList.length ? model.prescriptionList.entityList!.length
: 0, : 0,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
physics: ScrollPhysics(), physics: ScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return MedicationWidget( return MedicationWidget(
model, model.prescriptionList.entityList[index]); model, model.prescriptionList.entityList![index]);
}) })
];} else { ];} else {

@ -7,15 +7,14 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../../../../widgets/shared/errors/error_message.dart';
class UCAFInputScreen extends StatefulWidget { class UCAFInputScreen extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final Function changeLoadingState; final Function? changeLoadingState;
UCAFInputScreen(this.patient, {this.changeLoadingState}); UCAFInputScreen(this.patient, {this.changeLoadingState});
@ -63,7 +62,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
onModelReady: (model) async { onModelReady: (model) async {
model.resetDataInFirst(); model.resetDataInFirst();
await model.getUCAFData(patient); await model.getUCAFData(patient);
widget.changeLoadingState(false); widget.changeLoadingState!(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -100,7 +99,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
AppText( AppText(
"BP (H/L)", "BP (H/L)",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.8, SizeConfig.textMultiplier! * 1.8,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
@ -110,7 +109,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
AppText( AppText(
"${model.bloodPressure}", "${model.bloodPressure}",
fontSize: fontSize:
SizeConfig.textMultiplier * 2, SizeConfig.textMultiplier! * 2,
color: Colors.grey.shade800, color: Colors.grey.shade800,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -123,7 +122,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
AppText( AppText(
"${TranslationBase.of(context).temperature}", "${TranslationBase.of(context).temperature}",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.8, SizeConfig.textMultiplier! * 1.8,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
@ -134,7 +133,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
child: AppText( child: AppText(
"${model.temperatureCelcius}(C), ${(double.parse(model.temperatureCelcius) * (9 / 5) + 32).toStringAsFixed(2)}(F)", "${model.temperatureCelcius}(C), ${(double.parse(model.temperatureCelcius) * (9 / 5) + 32).toStringAsFixed(2)}(F)",
fontSize: fontSize:
SizeConfig.textMultiplier * 2, SizeConfig.textMultiplier! * 2,
color: Colors.grey.shade800, color: Colors.grey.shade800,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -149,7 +148,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
AppText( AppText(
"${TranslationBase.of(context).pulseBeats}:", "${TranslationBase.of(context).pulseBeats}:",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.8, SizeConfig.textMultiplier! * 1.8,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
@ -159,7 +158,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
AppText( AppText(
"${model.hartRat}", "${model.hartRat}",
fontSize: fontSize:
SizeConfig.textMultiplier * 2, SizeConfig.textMultiplier! * 2,
color: Colors.grey.shade800, color: Colors.grey.shade800,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -172,7 +171,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Utils.convertToTitleCase(TranslationBase.of(context) Utils.convertToTitleCase(TranslationBase.of(context)
.chiefComplaintsAndSymptoms), .chiefComplaintsAndSymptoms),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 2.2, fontSize: SizeConfig.textMultiplier! * 2.2,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
@ -184,7 +183,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
TranslationBase.of(context).instruction, TranslationBase.of(context).instruction,
dropDownText: Utils.parseHtmlString(model dropDownText: Utils.parseHtmlString(model
.patientChiefComplaintList[0] .patientChiefComplaintList[0]
.chiefComplaint + '\n'), .chiefComplaint! + '\n'),
controller: _additionalComplaintsController, controller: _additionalComplaintsController,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
enabled: false, enabled: false,

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page_stepper_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page_stepper_widget.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
@ -9,13 +10,11 @@ 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/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../../routes.dart';
import 'ucaf_detail_screen.dart'; import 'ucaf_detail_screen.dart';
import 'ucaf_input_screen.dart'; import 'ucaf_input_screen.dart';
class UCAFPagerScreen extends StatefulWidget { class UCAFPagerScreen extends StatefulWidget {
const UCAFPagerScreen({Key key}) : super(key: key); const UCAFPagerScreen({Key? key}) : super(key: key);
@override @override
_UCAFPagerScreenState createState() => _UCAFPagerScreenState(); _UCAFPagerScreenState createState() => _UCAFPagerScreenState();
@ -23,17 +22,17 @@ class UCAFPagerScreen extends StatefulWidget {
class _UCAFPagerScreenState extends State<UCAFPagerScreen> class _UCAFPagerScreenState extends State<UCAFPagerScreen>
with TickerProviderStateMixin { with TickerProviderStateMixin {
PageController _controller; PageController? _controller;
int _currentIndex = 0; int _currentIndex = 0;
bool _isLoading = true; bool _isLoading = true;
PatiantInformtion patient; PatiantInformtion? patient;
String patientType; String? patientType;
String arrivalType; String? arrivalType;
changePageViewIndex(pageIndex, {isChangeState = true}) { changePageViewIndex(pageIndex, {isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
_controller.jumpToPage(pageIndex); _controller!.jumpToPage(pageIndex);
setState(() { setState(() {
_currentIndex = pageIndex; _currentIndex = pageIndex;
}); });
@ -53,7 +52,7 @@ class _UCAFPagerScreenState extends State<UCAFPagerScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
patientType = routeArgs['patientType']; patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType']; arrivalType = routeArgs['arrivalType'];
@ -64,7 +63,7 @@ class _UCAFPagerScreenState extends State<UCAFPagerScreen>
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
isLoading: _isLoading, isLoading: _isLoading,
appBar: PatientProfileAppBar(patient), appBar: PatientProfileAppBar(patient!),
appBarTitle: TranslationBase.of(context).ucaf, appBarTitle: TranslationBase.of(context).ucaf,
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -101,11 +100,11 @@ class _UCAFPagerScreenState extends State<UCAFPagerScreen>
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
UCAFInputScreen( UCAFInputScreen(
patient, patient!,
changeLoadingState: changeLoadingState, changeLoadingState: changeLoadingState,
), ),
UcafDetailScreen( UcafDetailScreen(
patient, patient!,
model, model,
changeLoadingState: changeLoadingState, changeLoadingState: changeLoadingState,
), ),
@ -178,7 +177,7 @@ class _UCAFPagerScreenState extends State<UCAFPagerScreen>
color: AppGlobal.appRedColor, color: AppGlobal.appRedColor,
fontColor: Colors.white, fontColor: Colors.white,
onPressed: () { onPressed: () {
model.saveUCAFOnTap(); model.saveUCAFOnTap!();
}, },
), ),
), ),

@ -34,20 +34,20 @@ class DiagnosisWidget extends StatelessWidget {
label: "${TranslationBase.of(context).diagnoseType}: ", label: "${TranslationBase.of(context).diagnoseType}: ",
value: diagnosisType != null value: diagnosisType != null
? model.selectedLanguage == 'ar' ? model.selectedLanguage == 'ar'
? diagnosisType.nameAr ? diagnosisType.nameAr!
: diagnosisType.nameEn : diagnosisType.nameEn!
: "-", : "-",
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
CustomRow( CustomRow(
label: "", label: "",
value: diagnosis.asciiDesc, value: diagnosis.asciiDesc!,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
isExpanded: true, isExpanded: true,
), ),
SizedBox( SizedBox(
@ -57,8 +57,8 @@ class DiagnosisWidget extends StatelessWidget {
CustomRow( CustomRow(
label: "${TranslationBase.of(context).condition}: ", label: "${TranslationBase.of(context).condition}: ",
value: "${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}", value: "${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}",
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -68,8 +68,8 @@ class DiagnosisWidget extends StatelessWidget {
CustomRow( CustomRow(
label: "${TranslationBase.of(context).icd}:", label: "${TranslationBase.of(context).icd}:",
value: "${diagnosis.icdCode10ID}", value: "${diagnosis.icdCode10ID}",
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(

@ -26,8 +26,8 @@ class MedicationWidget extends StatelessWidget {
label: "${TranslationBase.of(context).id}: ", label: "${TranslationBase.of(context).id}: ",
value: "${prescription.medicineCode}", value: "${prescription.medicineCode}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
width: 16, width: 16,
@ -36,8 +36,8 @@ class MedicationWidget extends StatelessWidget {
label: "${TranslationBase.of(context).price}: ", label: "${TranslationBase.of(context).price}: ",
value: "${prescription.medicationPrice}", value: "${prescription.medicationPrice}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
width: 16, width: 16,
@ -46,8 +46,8 @@ class MedicationWidget extends StatelessWidget {
label: "${TranslationBase.of(context).quantity}: ", label: "${TranslationBase.of(context).quantity}: ",
value: "${prescription.quantity}", value: "${prescription.quantity}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
], ],
), ),
@ -58,8 +58,8 @@ class MedicationWidget extends StatelessWidget {
label: "${TranslationBase.of(context).durDays}: ", label: "${TranslationBase.of(context).durDays}: ",
value: "${prescription.doseDurationDays}", value: "${prescription.doseDurationDays}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -68,8 +68,8 @@ class MedicationWidget extends StatelessWidget {
label: " ", label: " ",
value: Utils.convertToTitleCase("${prescription.medicationName}"), value: Utils.convertToTitleCase("${prescription.medicationName}"),
isExpanded: true, isExpanded: true,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -79,8 +79,8 @@ class MedicationWidget extends StatelessWidget {
label: " ", label: " ",
value: Utils.convertToTitleCase("${prescription.doseDetail}"), value: Utils.convertToTitleCase("${prescription.doseDetail}"),
isExpanded: true, isExpanded: true,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
], ],
)); ));

@ -26,16 +26,16 @@ class ProceduresWidget extends StatelessWidget {
label: "${TranslationBase.of(context).codeNo}: ", label: "${TranslationBase.of(context).codeNo}: ",
value: "${procedure.achiCode}", value: "${procedure.achiCode}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox(width: 10,), SizedBox(width: 10,),
CustomRow( CustomRow(
label: "${TranslationBase.of(context).quantity}: ", label: "${TranslationBase.of(context).quantity}: ",
value: "${procedure.lineItemNo}", value: "${procedure.lineItemNo}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
], ],
), ),
@ -45,8 +45,8 @@ class ProceduresWidget extends StatelessWidget {
CustomRow( CustomRow(
label: "", label: "",
value: "${procedure.procedureName}", value: "${procedure.procedureName}",
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -58,9 +58,9 @@ class ProceduresWidget extends StatelessWidget {
label: "${TranslationBase.of(context).covered}: ", label: "${TranslationBase.of(context).covered}: ",
value: "${procedure.isCovered}", value: "${procedure.isCovered}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
valueColor: procedure.isCovered valueColor: procedure.isCovered!
? AppGlobal.appGreenColor ? AppGlobal.appGreenColor
: AppGlobal.appRedColor, : AppGlobal.appRedColor,
), ),
@ -68,8 +68,8 @@ class ProceduresWidget extends StatelessWidget {
label: "${TranslationBase.of(context).approvalRequired}: ", label: "${TranslationBase.of(context).approvalRequired}: ",
value: "${procedure.isApprovalRequired}", value: "${procedure.isApprovalRequired}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
), ),
@ -83,9 +83,9 @@ class ProceduresWidget extends StatelessWidget {
label: "${TranslationBase.of(context).uncoveredByDoctor}: ", label: "${TranslationBase.of(context).uncoveredByDoctor}: ",
value: "${procedure.isUncoveredByDoctor}", value: "${procedure.isUncoveredByDoctor}",
isExpanded: false, isExpanded: false,
valueSize: SizeConfig.textMultiplier * 1.8, valueSize: SizeConfig.textMultiplier! * 1.8,
labelSize: SizeConfig.textMultiplier * 1.6, labelSize: SizeConfig.textMultiplier! * 1.6,
valueColor: procedure.isCovered valueColor: procedure.isCovered!
? AppGlobal.appGreenColor ? AppGlobal.appGreenColor
: AppGlobal.appRedColor, : AppGlobal.appRedColor,
), ),

@ -9,9 +9,9 @@ import 'line_chart_curved_lab_history.dart';
class LabResultHistoryChartAndDetails extends StatelessWidget { class LabResultHistoryChartAndDetails extends StatelessWidget {
LabResultHistoryChartAndDetails({ LabResultHistoryChartAndDetails({
Key key, Key? key,
@required this.labResultHistory, required this.labResultHistory,
@required this.name, required this.name,
}) : super(key: key); }) : super(key: key);
final List<LabResultHistory> labResultHistory; final List<LabResultHistory> labResultHistory;
@ -43,7 +43,7 @@ class LabResultHistoryChartAndDetails extends StatelessWidget {
children: [ children: [
AppText( AppText(
TranslationBase.of(context).graphDetails, TranslationBase.of(context).graphDetails,
fontSize: SizeConfig.textMultiplier * 2.1, fontSize: SizeConfig.textMultiplier! * 2.1,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox( SizedBox(

@ -12,7 +12,7 @@ class LabResultHistoryDetailsWidget extends StatefulWidget {
final List<LabResultHistory> labResultHistory; final List<LabResultHistory> labResultHistory;
LabResultHistoryDetailsWidget({ LabResultHistoryDetailsWidget({
this.labResultHistory, required this.labResultHistory,
}); });
@override @override
@ -39,7 +39,7 @@ class _VitalSignDetailsWidgetState
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: AppText( child: AppText(
TranslationBase.of(context).date, TranslationBase.of(context).date,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -51,7 +51,7 @@ class _VitalSignDetailsWidgetState
child: Container( child: Container(
child: AppText( child: AppText(
TranslationBase.of(context).labResult, TranslationBase.of(context).labResult,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
// height: 60 // height: 60
@ -67,7 +67,7 @@ class _VitalSignDetailsWidgetState
), ),
Table( Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(
inside: BorderSide(width: 1.0, color: Colors.grey[300]), inside: BorderSide(width: 1.0, color: Colors.grey[300]!),
), ),
children: fullData(projectViewModel), children: fullData(projectViewModel),
), ),
@ -80,7 +80,7 @@ class _VitalSignDetailsWidgetState
List<TableRow> fullData(ProjectViewModel projectViewModel) { List<TableRow> fullData(ProjectViewModel projectViewModel) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
widget.labResultHistory.forEach((vital) { widget.labResultHistory.forEach((vital) {
var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime); var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime!);
tableRow.add(TableRow(children: [ tableRow.add(TableRow(children: [
Container( Container(
child: Container( child: Container(
@ -88,7 +88,7 @@ class _VitalSignDetailsWidgetState
color: Colors.white, color: Colors.white,
child: AppText( child: AppText(
'${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}', '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}',
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -99,7 +99,7 @@ class _VitalSignDetailsWidgetState
color: Colors.white, color: Colors.white,
child: AppText( child: AppText(
'${vital.resultValue}', '${vital.resultValue}',
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),

@ -9,14 +9,13 @@ class LineChartCurvedLabHistory extends StatefulWidget {
final String title; final String title;
final List<LabResultHistory> labResultHistory; final List<LabResultHistory> labResultHistory;
LineChartCurvedLabHistory({this.title, this.labResultHistory}); LineChartCurvedLabHistory({required this.title, required this.labResultHistory});
@override @override
State<StatefulWidget> createState() => LineChartCurvedLabHistoryState(); State<StatefulWidget> createState() => LineChartCurvedLabHistoryState();
} }
class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> { class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
bool isShowingMainData;
List<int> xAxixs = []; List<int> xAxixs = [];
int indexes = 0; int indexes = 0;
@ -24,7 +23,6 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
void initState() { void initState() {
super.initState(); super.initState();
getXaxix(); getXaxix();
isShowingMainData = true;
} }
getXaxix() { getXaxix() {
@ -56,7 +54,7 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
), ),
AppText( AppText(
widget.title, widget.title,
fontSize: SizeConfig.textMultiplier * 2.1, fontSize: SizeConfig.textMultiplier! * 2.1,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -69,7 +67,7 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
padding: const EdgeInsets.only(right: 16.0, left: 8.0), padding: const EdgeInsets.only(right: 16.0, left: 8.0),
child: LineChart( child: LineChart(
sampleData1(), sampleData1(),
swapAnimationDuration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
), ),
), ),
), ),
@ -90,56 +88,73 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white, tooltipBgColor: Colors.white,
), ),
touchCallback: (LineTouchResponse touchResponse) {}, touchCallback: (event, touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData( gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true, showTitles: true,
getTextStyles: (context, value) { reservedSize: 28,
return TextStyle( // rotateAngle: -65,
color: Colors.black, getTitlesWidget: (value, meta) {
fontSize: 10, DateTime date = AppDateUtils.convertStringToDate(widget.labResultHistory[value.toInt()].verifiedOnDateTime!);
);
},
margin: 28,
rotateAngle: -65,
getTitles: (value) {
print(value);
DateTime date = AppDateUtils.convertStringToDate(
widget.labResultHistory[value.toInt()].verifiedOnDateTime);
if (widget.labResultHistory.length < 8) { if (widget.labResultHistory.length < 8) {
if (widget.labResultHistory.length > value.toInt()) { if (widget.labResultHistory.length > value.toInt()) {
return '${date.day}/ ${date.year}'; return Text(
'${date.day}/ ${date.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
} else } else
return ''; return Text("");
} else { } else {
if (value.toInt() == 0) return '${date.day}/ ${date.year}'; if (value.toInt() == 0)
return Text(
'${date.day}/ ${date.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
if (value.toInt() == widget.labResultHistory.length - 1) if (value.toInt() == widget.labResultHistory.length - 1)
return '${date.day}/ ${date.year}'; return Text(
'${date.day}/ ${date.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
if (xAxixs.contains(value.toInt())) { if (xAxixs.contains(value.toInt())) {
return '${date.day}/ ${date.year}'; return Text(
'${date.day}/ ${date.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
} }
} }
return ''; return Text("");
}, },
), )),
leftTitles: SideTitles( leftTitles: AxisTitles(
showTitles: true, sideTitles: SideTitles(
getTextStyles: (context, value) { showTitles: true,
return TextStyle( getTitlesWidget: (value, meta) {
color: Colors.black, return Text('${value.toInt()}',
fontSize: 10, style: TextStyle(
); color: Colors.black,
}, fontSize: 10,
getTitles: (value) { ));
return '${value.toInt()}'; },
}, reservedSize: 8,
margin: 8, //reservedSize: 30,
//reservedSize: 30, ),
), ),
), ),
borderData: FlBorderData( borderData: FlBorderData(
@ -172,7 +187,7 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
double max = 0; double max = 0;
widget.labResultHistory.forEach((element) { widget.labResultHistory.forEach((element) {
try { try {
double resultValueDouble = double.parse(element.resultValue); double resultValueDouble = double.parse(element.resultValue!);
if (resultValueDouble > max) max = resultValueDouble; if (resultValueDouble > max) max = resultValueDouble;
} catch (e) { } catch (e) {
print(e); print(e);
@ -185,10 +200,10 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
double getMinY() { double getMinY() {
double min = 0; double min = 0;
try { try {
min = double.parse(widget.labResultHistory[0].resultValue); min = double.parse(widget.labResultHistory[0].resultValue!);
widget.labResultHistory.forEach((element) { widget.labResultHistory.forEach((element) {
double resultValueDouble = double.parse(element.resultValue); double resultValueDouble = double.parse(element.resultValue!);
if (resultValueDouble < min) min = resultValueDouble; if (resultValueDouble < min) min = resultValueDouble;
}); });
} catch (e) { } catch (e) {
@ -203,8 +218,7 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
List<FlSpot> spots = []; List<FlSpot> spots = [];
for (int index = 0; index < widget.labResultHistory.length; index++) { for (int index = 0; index < widget.labResultHistory.length; index++) {
try { try {
var resultValueDouble = var resultValueDouble = double.parse(widget.labResultHistory[index].resultValue!);
double.parse(widget.labResultHistory[index].resultValue);
spots.add(FlSpot(index.toDouble(), resultValueDouble)); spots.add(FlSpot(index.toDouble(), resultValueDouble));
} catch (e) { } catch (e) {
print(e); print(e);
@ -215,7 +229,7 @@ class LineChartCurvedLabHistoryState extends State<LineChartCurvedLabHistory> {
final LineChartBarData lineChartBarData1 = LineChartBarData( final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [Colors.red], color: Colors.red,
barWidth: 3, barWidth: 3,
isStrokeCapRound: true, isStrokeCapRound: true,
curveSmoothness: 0.12, curveSmoothness: 0.12,

@ -17,7 +17,7 @@ class FlowChartPage extends StatelessWidget {
final bool isInpatient; final bool isInpatient;
FlowChartPage( FlowChartPage(
{this.patientLabOrder, this.filterName, this.patient, this.isInpatient}); {required this.patientLabOrder, required this.filterName, required this.patient, required this.isInpatient});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -12,7 +12,7 @@ class LabResultDetailsWidget extends StatefulWidget {
final List<LabOrderResult> labResult; final List<LabOrderResult> labResult;
LabResultDetailsWidget({ LabResultDetailsWidget({
this.labResult, required this.labResult,
}); });
@override @override
@ -38,7 +38,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: AppText( child: AppText(
TranslationBase.of(context).date, TranslationBase.of(context).date,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -51,7 +51,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
child: Container( child: Container(
child: AppText( child: AppText(
TranslationBase.of(context).labResult, TranslationBase.of(context).labResult,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -68,7 +68,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
), ),
Table( Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(
inside: BorderSide(width: 1.0, color: Colors.grey[300]), inside: BorderSide(width: 1.0, color: Colors.grey[300]!),
), ),
children: fullData(projectViewModel), children: fullData(projectViewModel),
), ),
@ -81,7 +81,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
List<TableRow> fullData(ProjectViewModel projectViewModel) { List<TableRow> fullData(ProjectViewModel projectViewModel) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
widget.labResult.forEach((vital) { widget.labResult.forEach((vital) {
var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime); var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime!);
tableRow.add(TableRow(children: [ tableRow.add(TableRow(children: [
Container( Container(
child: Container( child: Container(
@ -89,7 +89,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
color: Colors.white, color: Colors.white,
child: AppText( child: AppText(
'${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}', '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}',
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -101,7 +101,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
color: Colors.white, color: Colors.white,
child: AppText( child: AppText(
'${vital.resultValue}', '${vital.resultValue}',
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),

@ -18,15 +18,8 @@ class LabResultWidget extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final bool isInpatient; final bool isInpatient;
LabResultWidget( LabResultWidget({Key? key, required this.filterName, required this.patientLabResultList, required this.patientLabOrder, required this.patient, required this.isInpatient}) : super(key: key);
{Key key, late ProjectViewModel projectViewModel;
this.filterName,
this.patientLabResultList,
this.patientLabOrder,
this.patient,
this.isInpatient})
: super(key: key);
ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -45,7 +38,7 @@ class LabResultWidget extends StatelessWidget {
children: [ children: [
AppText( AppText(
filterName, filterName,
fontSize: SizeConfig.textMultiplier * 2.0, fontSize: SizeConfig.textMultiplier! * 2.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
], ],
@ -63,7 +56,7 @@ class LabResultWidget extends StatelessWidget {
child: AppText( child: AppText(
TranslationBase.of(context).description, TranslationBase.of(context).description,
color: Colors.black, color: Colors.black,
fontSize: SizeConfig.textMultiplier * 2.0, fontSize: SizeConfig.textMultiplier! * 2.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
@ -75,7 +68,7 @@ class LabResultWidget extends StatelessWidget {
child: AppText( child: AppText(
TranslationBase.of(context).value, TranslationBase.of(context).value,
color: Colors.black, color: Colors.black,
fontSize: SizeConfig.textMultiplier * 2.0, fontSize: SizeConfig.textMultiplier! * 2.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
@ -86,7 +79,7 @@ class LabResultWidget extends StatelessWidget {
child: Center( child: Center(
child: AppText( child: AppText(
TranslationBase.of(context).range, TranslationBase.of(context).range,
fontSize: SizeConfig.textMultiplier * 2.0, fontSize: SizeConfig.textMultiplier! * 2.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
@ -128,9 +121,9 @@ class LabResultWidget extends StatelessWidget {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Center( child: Center(
child: AppText( child: AppText(
patientLabResultList[index].description, patientLabResultList[index].description!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
isCopyable: true, isCopyable: true,
), ),
), ),
@ -140,20 +133,14 @@ class LabResultWidget extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
if (patientLabResultList[index] if (patientLabResultList[index].checkResultStatus() != 0)
.checkResultStatus() !=
0)
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.red.shade700, color: Colors.red.shade700,
), ),
child: Icon( child: Icon(
patientLabResultList[index] patientLabResultList[index].checkResultStatus() == 1 ? Icons.arrow_upward : Icons.arrow_downward,
.checkResultStatus() ==
1
? Icons.arrow_upward
: Icons.arrow_downward,
color: Colors.white, color: Colors.white,
size: 16, size: 16,
), ),
@ -161,19 +148,13 @@ class LabResultWidget extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 4),
vertical: 10, horizontal: 4),
child: Center( child: Center(
child: AppText( child: AppText(
patientLabResultList[index] patientLabResultList[index].resultValue ?? "" + " " + "${patientLabResultList[index].uOM ?? ""}",
.resultValue ??
"" +
" " +
"${patientLabResultList[index].uOM ?? ""}",
textAlign: TextAlign.center, textAlign: TextAlign.center,
isCopyable: true, isCopyable: true,
fontSize: fontSize: SizeConfig.textMultiplier! * 1.8,
SizeConfig.textMultiplier * 1.8,
), ),
), ),
), ),
@ -187,9 +168,9 @@ class LabResultWidget extends StatelessWidget {
// color: Colors.white, // color: Colors.white,
child: Center( child: Center(
child: AppText( child: AppText(
patientLabResultList[index].referanceRange, patientLabResultList[index].referanceRange!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
isCopyable: true, isCopyable: true,
), ),
), ),
@ -203,8 +184,7 @@ class LabResultWidget extends StatelessWidget {
context, context,
FadePage( FadePage(
page: FlowChartPage( page: FlowChartPage(
filterName: patientLabResultList[index] filterName: patientLabResultList[index].description!,
.description,
patientLabOrder: patientLabOrder, patientLabOrder: patientLabOrder,
patient: patient, patient: patient,
isInpatient: isInpatient, isInpatient: isInpatient,
@ -219,7 +199,7 @@ class LabResultWidget extends StatelessWidget {
TranslationBase.of(context).showMoreBtn, TranslationBase.of(context).showMoreBtn,
textDecoration: TextDecoration.underline, textDecoration: TextDecoration.underline,
color: Colors.red.shade700, color: Colors.red.shade700,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
], ],
@ -290,7 +270,7 @@ class LabResultWidget extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: AppText( child: AppText(
lab.description, lab.description!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -302,7 +282,7 @@ class LabResultWidget extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: AppText( child: AppText(
lab.resultValue + " " + lab.uOM, lab.resultValue! + " " + lab.uOM!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -314,7 +294,7 @@ class LabResultWidget extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: AppText( child: AppText(
lab.referanceRange, lab.referanceRange!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),

@ -17,12 +17,12 @@ class LaboratoryResultPage extends StatefulWidget {
final bool isInpatient; final bool isInpatient;
LaboratoryResultPage( LaboratoryResultPage(
{Key key, {Key? key,
this.patientLabOrders, required this.patientLabOrders,
this.patient, required this.patient,
this.patientType, required this.patientType,
this.arrivalType, required this.arrivalType,
this.isInpatient}); required this.isInpatient});
@override @override
_LaboratoryResultPageState createState() => _LaboratoryResultPageState(); _LaboratoryResultPageState createState() => _LaboratoryResultPageState();
@ -42,7 +42,7 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
widget.patient, widget.patient,
isInpatient: widget.isInpatient, isInpatient: widget.isInpatient,
isFromLabResult: true, isFromLabResult: true,
appointmentDate: widget.patientLabOrders.orderDate, appointmentDate: widget.patientLabOrders.orderDate!,
), ),
baseViewModel: model, baseViewModel: model,
body: AppScaffold( body: AppScaffold(
@ -50,11 +50,11 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
body: SingleChildScrollView( body: SingleChildScrollView(
child: LaboratoryResultWidget( child: LaboratoryResultWidget(
onTap: () async {}, onTap: () async {},
billNo: widget.patientLabOrders.invoiceNo, billNo: widget.patientLabOrders.invoiceNo!,
details: model.patientLabSpecialResult.length > 0 details: model.patientLabSpecialResult.length > 0
? model.patientLabSpecialResult[0].resultDataHTML ? model.patientLabSpecialResult[0].resultDataHTML!
: null, : "",
orderNo: widget.patientLabOrders.orderNo, orderNo: widget.patientLabOrders.orderNo!,
patientLabOrder: widget.patientLabOrders, patientLabOrder: widget.patientLabOrders,
patient: widget.patient, patient: widget.patient,
isInpatient: widget.patientType == "1", isInpatient: widget.patientType == "1",

@ -16,16 +16,16 @@ import 'package:flutter_html/flutter_html.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class LaboratoryResultWidget extends StatefulWidget { class LaboratoryResultWidget extends StatefulWidget {
final GestureTapCallback onTap; final GestureTapCallback? onTap;
final String billNo; final String? billNo;
final String details; final String? details;
final String orderNo; final String? orderNo;
final PatientLabOrders patientLabOrder; final PatientLabOrders? patientLabOrder;
final PatiantInformtion patient; final PatiantInformtion? patient;
final bool isInpatient; final bool? isInpatient;
const LaboratoryResultWidget( const LaboratoryResultWidget(
{Key key, {Key? key,
this.onTap, this.onTap,
this.billNo, this.billNo,
this.details, this.details,
@ -42,7 +42,7 @@ class LaboratoryResultWidget extends StatefulWidget {
class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> { class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
bool _isShowMoreGeneral = true; bool _isShowMoreGeneral = true;
bool _isShowMore = true; bool _isShowMore = true;
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -97,7 +97,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
TranslationBase.of(context) TranslationBase.of(context)
.generalResult, .generalResult,
fontSize: fontSize:
SizeConfig.textMultiplier * 2.3, SizeConfig.textMultiplier! * 2.3,
bold: false, bold: false,
))), ))),
Container( Container(
@ -141,15 +141,15 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return LabResultWidget( return LabResultWidget(
patientLabOrder: patientLabOrder:
widget.patientLabOrder, widget.patientLabOrder!,
filterName: model filterName: model
.labResultLists[index] .labResultLists[index]
.filterName, .filterName,
patientLabResultList: model patientLabResultList: model
.labResultLists[index] .labResultLists[index]
.patientLabResultList, .patientLabResultList,
patient: widget.patient, patient: widget.patient!,
isInpatient: widget.isInpatient, isInpatient: widget.isInpatient!,
); );
}), }),
], ],
@ -168,7 +168,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
SizedBox( SizedBox(
height: 15, height: 15,
), ),
if (widget.details != null && widget.details.isNotEmpty) if (widget.details != null && widget.details!.isNotEmpty)
Column( Column(
children: [ children: [
InkWell( InkWell(
@ -196,7 +196,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
TranslationBase.of(context) TranslationBase.of(context)
.specialResult, .specialResult,
fontSize: fontSize:
SizeConfig.textMultiplier * 2.3, SizeConfig.textMultiplier! * 2.3,
bold: false, bold: false,
))), ))),
Container( Container(
@ -228,7 +228,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
duration: Duration(milliseconds: 7000), duration: Duration(milliseconds: 7000),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
child: !Utils.isTextHtml(widget.details) child: !Utils.isTextHtml(widget.details!)
? AppText( ? AppText(
widget.details ?? widget.details ??
TranslationBase.of(context) TranslationBase.of(context)

@ -24,17 +24,17 @@ class LabsHomePage extends StatefulWidget {
} }
class _LabsHomePageState extends State<LabsHomePage> { class _LabsHomePageState extends State<LabsHomePage> {
String patientType; String? patientType;
String arrivalType; String? arrivalType;
PatiantInformtion patient; PatiantInformtion? patient;
bool isInpatient; bool? isInpatient;
bool isFromLiveCare; bool? isFromLiveCare;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
patientType = routeArgs['patientType']; patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType']; arrivalType = routeArgs['arrivalType'];
@ -48,14 +48,14 @@ class _LabsHomePageState extends State<LabsHomePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getLabs(patient, isInpatient: false), onModelReady: (model) => model.getLabs(patient!, isInpatient: false),
builder: (context, ProcedureViewModel model, widget) => AppScaffold( builder: (context, ProcedureViewModel model, widget) => AppScaffold(
baseViewModel: model, baseViewModel: model,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100]!,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient!,
isInpatient: isInpatient, isInpatient: isInpatient!,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -68,22 +68,22 @@ class _LabsHomePageState extends State<LabsHomePage> {
height: 12, height: 12,
), ),
if ((model.patientLabOrdersList.isNotEmpty && if ((model.patientLabOrdersList.isNotEmpty &&
patient.patientStatusType != 43)|| (patient.patientStatusType != null && patient!.patientStatusType != 43)|| (patient!.patientStatusType != null &&
patient.patientStatusType == 43)) patient!.patientStatusType == 43))
ServiceTitle( ServiceTitle(
title: TranslationBase.of(context).lab, title: TranslationBase.of(context).lab,
subTitle: TranslationBase.of(context).result, subTitle: TranslationBase.of(context).result,
), ),
if ((patient.patientStatusType != null && if ((patient!.patientStatusType != null &&
patient.patientStatusType == 43) || patient!.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null)) (isFromLiveCare! && patient!.appointmentNo != null))
AddNewOrder( AddNewOrder(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => BaseAddProcedureTabPage( builder: (context) => BaseAddProcedureTabPage(
patient: patient, patient: patient!,
previousProcedureViewModel: model, previousProcedureViewModel: model,
procedureType: ProcedureType.LAB_RESULT, procedureType: ProcedureType.LAB_RESULT,
), ),
@ -116,10 +116,10 @@ class _LabsHomePageState extends State<LabsHomePage> {
width: 20, width: 20,
decoration: BoxDecoration( decoration: BoxDecoration(
color: model.patientLabOrdersList[index] color: model.patientLabOrdersList[index]
.isLiveCareAppointment .isLiveCareAppointment!
? Colors.red[900] ? Colors.red[900]
: !model.patientLabOrdersList[index] : !model.patientLabOrdersList[index]
.isInOutPatient .isInOutPatient!
? Colors.black ? Colors.black
: Color(0xffa9a089), : Color(0xffa9a089),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -141,12 +141,12 @@ class _LabsHomePageState extends State<LabsHomePage> {
child: Center( child: Center(
child: Text( child: Text(
model.patientLabOrdersList[index] model.patientLabOrdersList[index]
.isLiveCareAppointment .isLiveCareAppointment!
? TranslationBase.of(context) ? TranslationBase.of(context)
.liveCare .liveCare
.toUpperCase() .toUpperCase()
: !model.patientLabOrdersList[index] : !model.patientLabOrdersList[index]
.isInOutPatient .isInOutPatient!
? TranslationBase.of(context) ? TranslationBase.of(context)
.inPatientLabel .inPatientLabel
.toUpperCase() .toUpperCase()
@ -170,26 +170,26 @@ class _LabsHomePageState extends State<LabsHomePage> {
page: LaboratoryResultPage( page: LaboratoryResultPage(
patientLabOrders: patientLabOrders:
model.patientLabOrdersList[index], model.patientLabOrdersList[index],
patient: patient, patient: patient!,
isInpatient: isInpatient, isInpatient: isInpatient!,
arrivalType: arrivalType, arrivalType: arrivalType!,
patientType: patientType, patientType: patientType!,
), ),
), ),
), ),
doctorName: doctorName:
Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName), Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName!),
invoiceNO: invoiceNO:
' ${model.patientLabOrdersList[index].invoiceNo}', ' ${model.patientLabOrdersList[index].invoiceNo}',
profileUrl: model profileUrl: model
.patientLabOrdersList[index].doctorImageURL, .patientLabOrdersList[index].doctorImageURL!,
branch: branch:
model.patientLabOrdersList[index].projectName, model.patientLabOrdersList[index].projectName!,
clinic: clinic:
Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription), Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription!),
appointmentDate: appointmentDate:
model.patientLabOrdersList[index].createdOn, model.patientLabOrdersList[index].createdOn!,
orderNo: model.patientLabOrdersList[index].orderNo, orderNo: model.patientLabOrdersList[index].orderNo!,
isShowTime: false, isShowTime: false,
), ),
), ),
@ -198,7 +198,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
), ),
), ),
if (model.patientLabOrdersList.isEmpty && if (model.patientLabOrdersList.isEmpty &&
patient.patientStatusType != 43) patient!.patientStatusType != 43)
Center( Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable, error: TranslationBase.of(context).noDataAvailable,

@ -18,24 +18,24 @@ import 'package:provider/provider.dart';
import '../../../../../widgets/shared/errors/error_message.dart'; import '../../../../../widgets/shared/errors/error_message.dart';
class AllLabSpecialResult extends StatefulWidget { class AllLabSpecialResult extends StatefulWidget {
const AllLabSpecialResult({Key key}) : super(key: key); const AllLabSpecialResult({Key? key}) : super(key: key);
@override @override
_AllLabSpecialResultState createState() => _AllLabSpecialResultState(); _AllLabSpecialResultState createState() => _AllLabSpecialResultState();
} }
class _AllLabSpecialResultState extends State<AllLabSpecialResult> { class _AllLabSpecialResultState extends State<AllLabSpecialResult> {
String patientType; String? patientType;
String arrivalType; String? arrivalType;
PatiantInformtion patient; PatiantInformtion? patient;
bool isInpatient; bool? isInpatient;
bool isFromLiveCare; bool? isFromLiveCare;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
patientType = routeArgs['patientType']; patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType']; arrivalType = routeArgs['arrivalType'];
@ -50,14 +50,14 @@ class _AllLabSpecialResultState extends State<AllLabSpecialResult> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => onModelReady: (model) =>
model.getAllSpecialLabResult(patientId: patient.patientMRN), model.getAllSpecialLabResult(patientId: patient!.patientMRN!),
builder: (context, LabsViewModel model, widget) => AppScaffold( builder: (context, LabsViewModel model, widget) => AppScaffold(
baseViewModel: model, baseViewModel: model,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100]!,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient!,
isInpatient: isInpatient, isInpatient: isInpatient!,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -102,10 +102,10 @@ class _AllLabSpecialResultState extends State<AllLabSpecialResult> {
height: 160, height: 160,
decoration: BoxDecoration( decoration: BoxDecoration(
color: model.allSpecialLabList[index] color: model.allSpecialLabList[index]
.isLiveCareAppointment .isLiveCareAppointment!
? Colors.red[900] ? Colors.red[900]!
: !model.allSpecialLabList[index] : !model.allSpecialLabList[index]
.isInOutPatient .isInOutPatient!
? Colors.black ? Colors.black
: Color(0xffa9a089), : Color(0xffa9a089),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -127,12 +127,12 @@ class _AllLabSpecialResultState extends State<AllLabSpecialResult> {
child: Center( child: Center(
child: Text( child: Text(
model.allSpecialLabList[index] model.allSpecialLabList[index]
.isLiveCareAppointment .isLiveCareAppointment!
? TranslationBase.of(context) ? TranslationBase.of(context)
.liveCare .liveCare
.toUpperCase() .toUpperCase()
: !model.allSpecialLabList[index] : !model.allSpecialLabList[index]
.isInOutPatient .isInOutPatient!
? TranslationBase.of(context) ? TranslationBase.of(context)
.inPatientLabel .inPatientLabel
.toUpperCase() .toUpperCase()
@ -151,26 +151,26 @@ class _AllLabSpecialResultState extends State<AllLabSpecialResult> {
FadePage( FadePage(
page: SpecialLabResultDetailsPage( page: SpecialLabResultDetailsPage(
resultData: model.allSpecialLabList[index] resultData: model.allSpecialLabList[index]
.resultDataHTML, .resultDataHTML!,
patient: patient, patient: patient!,
), ),
), ),
), ),
doctorName: doctorName:
Utils.convertToTitleCase(model.allSpecialLabList[index].doctorName), Utils.convertToTitleCase(model.allSpecialLabList[index].doctorName!),
invoiceNO: invoiceNO:
' ${model.allSpecialLabList[index].invoiceNo}', ' ${model.allSpecialLabList[index].invoiceNo}',
profileUrl: model profileUrl: model
.allSpecialLabList[index].doctorImageURL, .allSpecialLabList[index].doctorImageURL!,
branch: branch:
model.allSpecialLabList[index].projectName, model.allSpecialLabList[index].projectName!,
clinic: clinic:
Utils.convertToTitleCase(model.allSpecialLabList[index].clinicDescription), Utils.convertToTitleCase(model.allSpecialLabList[index].clinicDescription!),
appointmentDate: appointmentDate:
AppDateUtils.getDateTimeFromServerFormat( AppDateUtils.getDateTimeFromServerFormat(
model.allSpecialLabList[index].createdOn, model.allSpecialLabList[index].createdOn,
), ),
orderNo: model.allSpecialLabList[index].orderNo, orderNo: model.allSpecialLabList[index].orderNo!,
isShowTime: false, isShowTime: false,
), ),
), ),

@ -13,7 +13,7 @@ class SpecialLabResultDetailsPage extends StatelessWidget {
final String resultData; final String resultData;
final PatiantInformtion patient; final PatiantInformtion patient;
const SpecialLabResultDetailsPage({Key key, this.resultData, this.patient}) const SpecialLabResultDetailsPage({Key? key, required this.resultData, required this.patient})
: super(key: key); : super(key: key);
@override @override

@ -16,24 +16,15 @@ import 'package:permission_handler/permission_handler.dart';
import '../../../../config/config.dart'; import '../../../../config/config.dart';
class AddVerifyMedicalReport extends StatefulWidget { class AddVerifyMedicalReport extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion? patient;
final String patientType; final String? patientType;
final String arrivalType; final String? arrivalType;
final MedicalReportModel medicalReport; final MedicalReportModel? medicalReport;
final PatientMedicalReportViewModel model; final PatientMedicalReportViewModel? model;
final MedicalReportStatus status; final MedicalReportStatus? status;
final String medicalNote; final String? medicalNote;
const AddVerifyMedicalReport( const AddVerifyMedicalReport({Key? key, this.patient, this.patientType, this.arrivalType, this.medicalReport, this.model, this.status, this.medicalNote}) : super(key: key);
{Key key,
this.patient,
this.patientType,
this.arrivalType,
this.medicalReport,
this.model,
this.status,
this.medicalNote})
: super(key: key);
@override @override
_AddVerifyMedicalReportState createState() => _AddVerifyMedicalReportState(); _AddVerifyMedicalReportState createState() => _AddVerifyMedicalReportState();
@ -53,9 +44,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.status == MedicalReportStatus.ADD appBarTitle: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).medicalReportAdd : TranslationBase.of(context).medicalReportVerify,
? TranslationBase.of(context).medicalReportAdd
: TranslationBase.of(context).medicalReportVerify,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Column( body: Column(
children: [ children: [
@ -72,26 +61,14 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
children: [ children: [
if (model.medicalReportTemplate.length > 0) if (model.medicalReportTemplate.length > 0)
HtmlRichEditor( HtmlRichEditor(
initialText: (widget.medicalReport != initialText: (widget.medicalReport != null
null ? widget.medicalNote!
? widget.medicalNote : widget.model!.medicalReportTemplate[0].templateText!.length > 0
: widget ? widget.model!.medicalReportTemplate[0].templateText!
.model
.medicalReportTemplate[
0]
.templateText
.length >
0
? widget
.model
.medicalReportTemplate[0]
.templateText
: ""), : ""),
controller: _controller, controller: _controller,
hint: "Write the medical report ", hint: "Write the medical report ",
height: height: MediaQuery.of(context).size.height * 0.75,
MediaQuery.of(context).size.height *
0.75,
), ),
], ],
), ),
@ -109,43 +86,30 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
children: [ children: [
Expanded( Expanded(
child: AppButton( child: AppButton(
title: widget.status == MedicalReportStatus.ADD title: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).save : TranslationBase.of(context).save,
? TranslationBase.of(context).save
: TranslationBase.of(context).save,
color: Color(0xffEAEAEA), color: Color(0xffEAEAEA),
fontColor: Colors.black, fontColor: Colors.black,
// disabled: progressNoteController.text.isEmpty, // disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
txtOfMedicalReport = await _controller.getText(); txtOfMedicalReport = (await _controller.getText())!;
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
widget.medicalReport != null widget.medicalReport != null
? await widget.model.updateMedicalReport( ? await widget.model!.updateMedicalReport(widget.patient!, txtOfMedicalReport, widget.medicalReport != null ? widget.medicalReport!.lineItemNo! : 0,
widget.patient, widget.medicalReport != null ? widget.medicalReport!.invoiceNo! : "")
txtOfMedicalReport, : await widget.model!.addMedicalReport(widget.patient!, txtOfMedicalReport);
widget.medicalReport != null
? widget.medicalReport.lineItemNo
: null,
widget.medicalReport != null
? widget.medicalReport.invoiceNo
: null)
: await widget.model.addMedicalReport(
widget.patient, txtOfMedicalReport);
//model.getMedicalReportList(patient); //model.getMedicalReportList(patient);
Navigator.pop(context); Navigator.pop(context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == if (widget.model!.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(widget.model!.error);
DrAppToastMsg.showErrorToast(
widget.model.error);
} }
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Please enter medical note");
"Please enter medical note");
} }
}, },
), ),
@ -156,28 +120,21 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
if (widget.medicalReport != null) if (widget.medicalReport != null)
Expanded( Expanded(
child: AppButton( child: AppButton(
title: widget.status == MedicalReportStatus.ADD title: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).add : TranslationBase.of(context).verify,
? TranslationBase.of(context).add
: TranslationBase.of(context).verify,
color: AppGlobal.appGreenColor, color: AppGlobal.appGreenColor,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
txtOfMedicalReport = txtOfMedicalReport = (await _controller.getText())!;
await _controller.getText();
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.model.verifyMedicalReport( await widget.model!.verifyMedicalReport(widget.patient!, widget.medicalReport!);
widget.patient, widget.medicalReport);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context); Navigator.pop(context);
if (widget.model.state == if (widget.model!.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(widget.model!.error);
DrAppToastMsg.showErrorToast(
widget.model.error);
} }
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Please enter medical note");
"Please enter medical note");
} }
}, },
), ),

@ -17,7 +17,7 @@ class MedicalReportDetailPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
@ -43,13 +43,13 @@ class MedicalReportDetailPage extends StatelessWidget {
children: [ children: [
AppText( AppText(
"${TranslationBase.of(context).medical}", "${TranslationBase.of(context).medical}",
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
TranslationBase.of(context).report, TranslationBase.of(context).report,
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier! * 3,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
) )

@ -34,7 +34,7 @@ class MedicalReportPage extends StatefulWidget {
class _MedicalReportPageState extends State<MedicalReportPage> { class _MedicalReportPageState extends State<MedicalReportPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
@ -64,13 +64,13 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
children: [ children: [
AppText( AppText(
"${TranslationBase.of(context).medical}", "${TranslationBase.of(context).medical}",
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
TranslationBase.of(context).report, TranslationBase.of(context).report,
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier! * 3,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
) )
@ -159,7 +159,7 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
1 1
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
: AppGlobal.appGreenColor, : AppGlobal.appGreenColor,
fontSize: 1.4 * SizeConfig.textMultiplier, fontSize: 1.4 * SizeConfig.textMultiplier!,
bold: true, bold: true,
), ),
AppText( AppText(
@ -170,7 +170,7 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
: model.medicalReportList[index] : model.medicalReportList[index]
.doctorName ?? .doctorName ??
"", "",
fontSize: 1.9 * SizeConfig.textMultiplier, fontSize: 1.9 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
@ -180,16 +180,16 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
AppText( AppText(
'${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "dd MMM yyyy")}', '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn!, "dd MMM yyyy")}',
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.6 * SizeConfig.textMultiplier, fontSize: 1.6 * SizeConfig.textMultiplier!,
), ),
AppText( AppText(
'${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "hh:mm a")}', '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn!, "hh:mm a")}',
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.5 * SizeConfig.textMultiplier, fontSize: 1.5 * SizeConfig.textMultiplier!,
), ),
], ],
), ),
@ -204,11 +204,11 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
child: LargeAvatar( child: LargeAvatar(
name: projectViewModel.isArabic name: projectViewModel.isArabic
? model ? model
.medicalReportList[index].doctorNameN .medicalReportList[index].doctorNameN!
: model : model
.medicalReportList[index].doctorName, .medicalReportList[index].doctorName!,
url: model url: model
.medicalReportList[index].doctorImageURL, .medicalReportList[index].doctorImageURL!,
), ),
width: 50, width: 50,
height: 50, height: 50,
@ -222,21 +222,21 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
AppText( AppText(
projectViewModel.isArabic projectViewModel.isArabic
? model.medicalReportList[index] ? model.medicalReportList[index]
.projectNameN .projectNameN!
: model.medicalReportList[index] : model.medicalReportList[index]
.projectName, .projectName!,
fontSize: fontSize:
1.6 * SizeConfig.textMultiplier, 1.6 * SizeConfig.textMultiplier!,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
projectViewModel.isArabic projectViewModel.isArabic
? model.medicalReportList[index] ? model.medicalReportList[index]
.clinicNameN .clinicNameN!
: model.medicalReportList[index] : model.medicalReportList[index]
.clinicName, .clinicName!,
fontSize: fontSize:
1.6 * SizeConfig.textMultiplier, 1.6 * SizeConfig.textMultiplier!,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
], ],

@ -32,22 +32,21 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class ProgressNoteScreen extends StatefulWidget { class ProgressNoteScreen extends StatefulWidget {
final int visitType; final int visitType;
const ProgressNoteScreen({Key key, this.visitType}) : super(key: key); const ProgressNoteScreen({Key? key, required this.visitType}) : super(key: key);
@override @override
_ProgressNoteState createState() => _ProgressNoteState(); _ProgressNoteState createState() => _ProgressNoteState();
} }
class _ProgressNoteState extends State<ProgressNoteScreen> { class _ProgressNoteState extends State<ProgressNoteScreen> {
List<NoteModel> notesList; List<NoteModel>? notesList;
var filteredNotesList; var filteredNotesList;
bool isDischargedPatient = false; bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
getProgressNoteList(BuildContext context, PatientViewModel model, getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async {
{bool isLocalBusy = false}) async { final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
@ -56,15 +55,12 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest( ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
visitType: widget.visitType, visitType: widget.visitType,
// if equal 5 then this will return progress note // if equal 5 then this will return progress note
admissionNo: int.parse(patient.admissionNo), admissionNo: int.parse(patient.admissionNo!),
projectID: patient.projectId, projectID: patient.projectId,
tokenID: token, tokenID: token,
patientTypeID: patient.patientType, patientTypeID: patient.patientType,
languageID: 2); languageID: 2);
model model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) {
.getPatientProgressNote(progressNoteRequest.toJson(),
isLocalBusy: isLocalBusy)
.then((c) {
notesList = model.patientProgressNoteList; notesList = model.patientProgressNoteList;
}); });
} }
@ -73,11 +69,10 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context); authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
if (routeArgs.containsKey('isDischargedPatient')) if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient'];
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<PatientViewModel>( return BaseView<PatientViewModel>(
onModelReady: (model) => getProgressNoteList(context, model), onModelReady: (model) => getProgressNoteList(context, model),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -88,513 +83,340 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
patient, patient,
isInpatient: true, isInpatient: true,
), ),
body: Container( body: Container(
color: Colors.grey[200], color: Colors.grey[200],
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
if (!isDischargedPatient) if (!isDischargedPatient)
AddNewOrder( AddNewOrder(
onTap: () async { onTap: () async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
eventCategory: "Progress Note Screen", eventCategory: "Progress Note Screen",
eventAction: "Update Progress Note", eventAction: "Update Progress Note",
); );
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => UpdateNoteOrder( builder: (context) => UpdateNoteOrder(
patientModel: model, patientModel: model,
patient: patient, patient: patient,
visitType: widget.visitType, visitType: widget.visitType,
isUpdate: false, isUpdate: false,
), ),
settings: RouteSettings(name: 'UpdateNoteOrder'), settings: RouteSettings(name: 'UpdateNoteOrder'),
),
);
},
label: widget.visitType == 3
? TranslationBase.of(context).addNewOrderSheet
: TranslationBase.of(context).addProgressNote,
), ),
Expanded( );
child: Container( },
child: ListView.builder( label: widget.visitType == 3 ? TranslationBase.of(context).addNewOrderSheet : TranslationBase.of(context).addProgressNote,
itemCount: model.patientProgressNoteList.length, ),
itemBuilder: (BuildContext ctxt, int index) { Expanded(
return FractionallySizedBox( child: Container(
widthFactor: 0.95, child: ListView.builder(
child: CardWithBgWidget( itemCount: model.patientProgressNoteList.length,
hasBorder: false, itemBuilder: (BuildContext ctxt, int index) {
bgColor: model.patientProgressNoteList[index] return FractionallySizedBox(
.status == widthFactor: 0.95,
1 && child: CardWithBgWidget(
authenticationViewModel hasBorder: false,
.doctorProfile.doctorID != bgColor: model.patientProgressNoteList[index].status == 1 && authenticationViewModel.doctorProfile!.doctorID != model.patientProgressNoteList[index].createdBy
model ? Color(0xFFCC9B14)
.patientProgressNoteList[ : model.patientProgressNoteList[index].status == 4
index] ? Colors.red.shade700
.createdBy : model.patientProgressNoteList[index].status == 2
? Color(0xFFCC9B14) ? AppGlobal.appGreenColor
: model.patientProgressNoteList[index] : Color(0xFFCC9B14),
.status == widget: Column(
4 children: [
? Colors.red.shade700 Column(
: model.patientProgressNoteList[index] crossAxisAlignment: CrossAxisAlignment.start,
.status == children: [
2 if (model.patientProgressNoteList[index].status == 1 && authenticationViewModel.doctorProfile!.doctorID != model.patientProgressNoteList[index].createdBy)
? AppGlobal.appGreenColor AppText(
: Color(0xFFCC9B14), TranslationBase.of(context).notePending,
widget: Column( fontWeight: FontWeight.bold,
children: [ color: Color(0xFFCC9B14),
Column( fontSize: 12,
crossAxisAlignment: ),
CrossAxisAlignment.start, if (model.patientProgressNoteList[index].status == 4)
AppText(
TranslationBase.of(context).noteCanceled,
fontWeight: FontWeight.bold,
color: Colors.red.shade700,
fontSize: 12,
),
if (model.patientProgressNoteList[index].status == 2)
AppText(
TranslationBase.of(context).noteVerified,
fontWeight: FontWeight.bold,
color: AppGlobal.appGreenColor,
fontSize: 12,
),
if (model.patientProgressNoteList[index].status != 2 &&
model.patientProgressNoteList[index].status != 4 &&
authenticationViewModel.doctorProfile!.doctorID == model.patientProgressNoteList[index].createdBy)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (model InkWell(
.patientProgressNoteList[ onTap: () {
index] Navigator.push(
.status == context,
1 && MaterialPageRoute(
authenticationViewModel builder: (context) => UpdateNoteOrder(
.doctorProfile.doctorID != note: model.patientProgressNoteList[index],
model patientModel: model,
.patientProgressNoteList[ patient: patient,
index] visitType: widget.visitType,
.createdBy) isUpdate: true,
AppText( )),
TranslationBase.of(context) );
.notePending, },
fontWeight: FontWeight.bold, child: Container(
color: Color(0xFFCC9B14), decoration: BoxDecoration(
fontSize: 12, color: Colors.grey[600],
), borderRadius: BorderRadius.circular(10),
if (model ),
.patientProgressNoteList[ // color:Colors.red[600],
index]
.status ==
4)
AppText(
TranslationBase.of(context)
.noteCanceled,
fontWeight: FontWeight.bold,
color: Colors.red.shade700,
fontSize: 12,
),
if (model
.patientProgressNoteList[
index]
.status ==
2)
AppText(
TranslationBase.of(context)
.noteVerified,
fontWeight: FontWeight.bold,
color: AppGlobal.appGreenColor,
fontSize: 12,
),
if (model.patientProgressNoteList[index].status != 2 &&
model
.patientProgressNoteList[
index]
.status !=
4 &&
authenticationViewModel
.doctorProfile.doctorID ==
model
.patientProgressNoteList[
index]
.createdBy)
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
UpdateNoteOrder(
note: model
.patientProgressNoteList[
index],
patientModel:
model,
patient:
patient,
visitType: widget
.visitType,
isUpdate: true,
)),
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.grey[600],
borderRadius:
BorderRadius.circular(
10),
),
// color:Colors.red[600],
child: Row( child: Row(
children: [ children: [
Icon( Icon(
DoctorApp.edit_1, DoctorApp.edit_1,
size: 12, size: 12,
color: Colors.white, color: Colors.white,
),
SizedBox(
width: 2,
),
AppText(
TranslationBase.of(
context)
.update,
fontSize: 10,
color: Colors.white,
),
],
),
padding: EdgeInsets.all(6),
), ),
), SizedBox(
SizedBox( width: 2,
width: 10,
),
InkWell(
onTap: () async {
showMyDialog(
context: context,
actionName: "verify",
confirmFun: () async {
GifLoaderDialogUtils
.showMyDialog(
context);
UpdateNoteReqModel
reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
cancelledNote:
false,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
conditionId: model
.patientProgressNoteList[
index].condition,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: true,
patientTypeID:
patient
.patientType,
patientOutSA: false,
);
await model
.updatePatientProgressNote(
reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
});
},
child: Container(
decoration: BoxDecoration(
color: AppGlobal
.appGreenColor,
borderRadius:
BorderRadius.circular(
10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons
.check,
size: 12,
color: Colors.white,
),
SizedBox(
width: 2,
),
AppText(
TranslationBase.of(
context)
.noteVerify,
fontSize: 10,
color: Colors.white,
),
],
),
padding: EdgeInsets.all(6),
), ),
), AppText(
SizedBox( TranslationBase.of(context).update,
width: 10, fontSize: 10,
), color: Colors.white,
InkWell(
onTap: () async {
showMyDialog(
context: context,
actionName:
TranslationBase.of(
context)
.cancel,
confirmFun: () async {
GifLoaderDialogUtils
.showMyDialog(
context,
);
UpdateNoteReqModel
reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
conditionId: model
.patientProgressNoteList[
index].condition,
cancelledNote: true,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: false,
patientTypeID:
patient
.patientType,
patientOutSA: false,
);
await model
.updatePatientProgressNote(
reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.red[600],
borderRadius:
BorderRadius.circular(
10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons
.trash,
size: 12,
color: Colors.white,
),
SizedBox(
width: 2,
),
AppText(
'Cancel',
fontSize: 10,
color: Colors.white,
),
],
),
padding: EdgeInsets.all(6),
), ),
), ],
SizedBox( ),
width: 10, padding: EdgeInsets.all(6),
)
],
), ),
),
SizedBox( SizedBox(
height: 10, width: 10,
), ),
Row( InkWell(
mainAxisAlignment: onTap: () async {
MainAxisAlignment.spaceBetween, showMyDialog(
crossAxisAlignment: context: context,
CrossAxisAlignment.start, actionName: "verify",
children: [ confirmFun: () async {
Container( GifLoaderDialogUtils.showMyDialog(context);
width: MediaQuery.of(context) UpdateNoteReqModel reqModel = UpdateNoteReqModel(
.size admissionNo: int.parse(patient.admissionNo!),
.width * cancelledNote: false,
0.60, lineItemNo: model.patientProgressNoteList[index].lineItemNo,
child: Column( conditionId: model.patientProgressNoteList[index].condition,
crossAxisAlignment: createdBy: model.patientProgressNoteList[index].createdBy,
CrossAxisAlignment.start, notes: model.patientProgressNoteList[index].notes,
children: [ verifiedNote: true,
Row( patientTypeID: patient.patientType,
crossAxisAlignment: patientOutSA: false,
CrossAxisAlignment );
.start, await model.updatePatientProgressNote(reqModel);
children: [ await getProgressNoteList(context, model, isLocalBusy: true);
AppText( GifLoaderDialogUtils.hideDialog(context);
TranslationBase.of( });
context) },
.createdBy + ' ', child: Container(
fontSize: 10, decoration: BoxDecoration(
), color: AppGlobal.appGreenColor,
Expanded( borderRadius: BorderRadius.circular(10),
child: AppText(
model
.patientProgressNoteList[
index]
.doctorName ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
TranslationBase.of(context).conditionDescription + ' : ',
fontSize: 10,
),
Expanded(
child: AppText(
model.patientProgressNoteList[index].conditionDescription ?? '',
fontWeight:
FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
],
),
), ),
Column( // color:Colors.red[600],
child: Row(
children: [ children: [
AppText( Icon(
model FontAwesomeIcons.check,
.patientProgressNoteList[ size: 12,
index] color: Colors.white,
.createdOn != ),
null SizedBox(
? AppDateUtils.getDayMonthYearDateFormatted( width: 2,
AppDateUtils
.getDateTimeFromServerFormat(model
.patientProgressNoteList[
index]
.createdOn),
isArabic:
projectViewModel
.isArabic,
isMonthShort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
fontWeight: FontWeight.w600,
fontSize: 14,
isCopyable: true,
), ),
AppText( AppText(
model TranslationBase.of(context).noteVerify,
.patientProgressNoteList[ fontSize: 10,
index] color: Colors.white,
.createdOn !=
null
? AppDateUtils.getHour(
AppDateUtils
.getDateTimeFromServerFormat(model
.patientProgressNoteList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
isCopyable: true,
), ),
], ],
crossAxisAlignment: ),
CrossAxisAlignment.end, padding: EdgeInsets.all(6),
) ),
],
), ),
SizedBox( SizedBox(
height: 8, width: 10,
), ),
Row( InkWell(
mainAxisAlignment: onTap: () async {
MainAxisAlignment.start, showMyDialog(
children: [ context: context,
Expanded( actionName: TranslationBase.of(context).cancel,
child: AppText( confirmFun: () async {
model GifLoaderDialogUtils.showMyDialog(
.patientProgressNoteList[ context,
index] );
.notes, UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(patient.admissionNo!),
conditionId: model.patientProgressNoteList[index].condition,
cancelledNote: true,
lineItemNo: model.patientProgressNoteList[index].lineItemNo,
createdBy: model.patientProgressNoteList[index].createdBy,
notes: model.patientProgressNoteList[index].notes,
verifiedNote: false,
patientTypeID: patient.patientType,
patientOutSA: false,
);
await model.updatePatientProgressNote(reqModel);
await getProgressNoteList(context, model, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.red[600],
borderRadius: BorderRadius.circular(10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons.trash,
size: 12,
color: Colors.white,
),
SizedBox(
width: 2,
),
AppText(
'Cancel',
fontSize: 10, fontSize: 10,
isCopyable: true, color: Colors.white,
), ),
), ],
]) ),
padding: EdgeInsets.all(6),
),
),
SizedBox(
width: 10,
)
], ],
), ),
SizedBox( SizedBox(
height: 20, height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width * 0.60,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).createdBy + ' ',
fontSize: 10,
),
Expanded(
child: AppText(
model.patientProgressNoteList[index].doctorName ?? '',
fontWeight: FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).conditionDescription + ' : ',
fontSize: 10,
),
Expanded(
child: AppText(
model.patientProgressNoteList[index].conditionDescription ?? '',
fontWeight: FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
],
),
),
Column(
children: [
AppText(
model.patientProgressNoteList[index].createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.patientProgressNoteList[index].createdOn!),
isArabic: projectViewModel.isArabic, isMonthShort: true)
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic),
fontWeight: FontWeight.w600,
fontSize: 14,
isCopyable: true,
),
AppText(
model.patientProgressNoteList[index].createdOn != null
? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(model.patientProgressNoteList[index].createdOn!))
: AppDateUtils.getHour(DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
isCopyable: true,
),
],
crossAxisAlignment: CrossAxisAlignment.end,
)
],
),
SizedBox(
height: 8,
),
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
Expanded(
child: AppText(
model.patientProgressNoteList[index].notes!,
fontSize: 10,
isCopyable: true,
),
), ),
], ])
), ],
), ),
); SizedBox(
}), height: 20,
), ),
), ],
], ),
),
);
}),
), ),
), ),
],
),
),
), ),
); );
} }
/// TODO Elham* Make this as custom Dialog /// TODO Elham* Make this as custom Dialog
showMyDialog({BuildContext context, Function confirmFun, String actionName}) { showMyDialog({required BuildContext context, required Function confirmFun, required String actionName}) {
showDialog( showDialog(
context: context, context: context,
builder: (ctx) => Center( builder: (ctx) => Center(
@ -637,9 +459,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
color: Colors.white, color: Colors.white,
child: AppText( child: AppText(
projectViewModel.isArabic projectViewModel.isArabic ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟" : 'Are you sure you want $actionName this order?',
? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟"
: 'Are you sure you want $actionName this order?',
fontSize: 15, fontSize: 15,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -654,7 +474,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
FlatButton( ElevatedButton(
child: AppText( child: AppText(
TranslationBase.of(context).cancel, TranslationBase.of(context).cancel,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -664,7 +484,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}), }),
FlatButton( ElevatedButton(
child: AppText( child: AppText(
TranslationBase.of(context).noteConfirm, TranslationBase.of(context).noteConfirm,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,

@ -30,24 +30,15 @@ import '../../../../../widgets/shared/dialogs/dailog-list-select.dart';
import '../../../../base/base_view.dart'; import '../../../../base/base_view.dart';
class UpdateNoteOrder extends StatefulWidget { class UpdateNoteOrder extends StatefulWidget {
final NoteModel note; final NoteModel? note;
final PatientViewModel patientModel; final PatientViewModel? patientModel;
final PatiantInformtion patient; final PatiantInformtion? patient;
final int visitType; final int? visitType;
final bool isUpdate; final bool isUpdate;
final List<dynamic> elementList; final List<dynamic>? elementList;
final Function(dynamic) okFunction; final Function(dynamic)? okFunction;
const UpdateNoteOrder( UpdateNoteOrder({Key? key, this.note, this.patientModel, this.patient, this.visitType, this.isUpdate = false, this.elementList, this.okFunction}) : super(key: key);
{Key key,
this.note,
this.patientModel,
this.patient,
this.visitType,
this.isUpdate,
this.elementList,
this.okFunction})
: super(key: key);
@override @override
_UpdateNoteOrderState createState() => _UpdateNoteOrderState(); _UpdateNoteOrderState createState() => _UpdateNoteOrderState();
@ -55,12 +46,12 @@ class UpdateNoteOrder extends StatefulWidget {
class _UpdateNoteOrderState extends State<UpdateNoteOrder> { class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
dynamic selectValue; dynamic selectValue;
int selectedType; int selectedType = 0;
bool isSubmitted = false; bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText(); stt.SpeechToText speech = stt.SpeechToText();
var recognizedWord; var recognizedWord;
var event = RobotProvider(); var event = RobotProvider();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
TextEditingController progressNoteController = TextEditingController(); TextEditingController progressNoteController = TextEditingController();
@ -90,12 +81,10 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
if (widget.note != null) { if (widget.note != null) {
progressNoteController.text = widget.note.notes; progressNoteController.text = widget.note!.notes!;
if(selectValue==null) if (selectValue == null) selectValue = {};
selectValue={}; selectValue[keyId] = widget.note!.condition;
selectValue[keyId] = widget.note.condition; selectValue['Description'] = widget.note!.conditionDescription!;
selectValue['Description'] = widget.note.conditionDescription;
} }
return BaseView<PatientViewModel>( return BaseView<PatientViewModel>(
@ -115,14 +104,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: [ children: [
BottomSheetTitle( BottomSheetTitle(
title: widget.visitType == 3 title: widget.visitType == 3
? (widget.isUpdate ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).orderSheet
? TranslationBase.of(context).noteUpdate : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote,
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).orderSheet
: (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote,
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
@ -136,11 +119,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.stpMasterList, list: model.stpMasterList,
attributeName: 'Description', attributeName: 'Description',
attributeValueId: attributeValueId: model.stpMasterList.length == 1 ? model.stpMasterList[0]['${keyId}'].toString() : '${keyId}',
model.stpMasterList.length == 1
? model.stpMasterList[0]['${keyId}']
.toString()
: '${keyId}',
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) => { okFunction: (selectedValue) => {
setState(() { setState(() {
@ -159,7 +138,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
} }
: null, : null,
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: TranslationBase.of(context).selectCondition,//'Select Condition', hintText: TranslationBase.of(context).selectCondition, //'Select Condition',
dropDownText: model.stpMasterList.length == 1 dropDownText: model.stpMasterList.length == 1
? model.stpMasterList[0]['Description'] ? model.stpMasterList[0]['Description']
: selectValue == null : selectValue == null
@ -182,19 +161,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
hintText: widget.visitType == 3 hintText: widget.visitType == 3
? (widget.isUpdate ? (widget.isUpdate! ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).orderSheet
? TranslationBase.of(context) : (widget.isUpdate! ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote,
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).orderSheet
: (widget.isUpdate
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context)
.progressNote,
//TranslationBase.of(context).addProgressNote, //TranslationBase.of(context).addProgressNote,
controller: progressNoteController, controller: progressNoteController,
maxLines: 40, maxLines: 40,
@ -202,26 +170,18 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: progressNoteController validationError: progressNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
), ),
Positioned( Positioned(
top: -2, top: -2,
//MediaQuery.of(context).size.height * 0, //MediaQuery.of(context).size.height * 0,
right: projectViewModel.isArabic right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * 0.75 : 15,
? MediaQuery.of(context).size.width * 0.75
: 15,
child: Column( child: Column(
children: [ children: [
IconButton( IconButton(
icon: Icon(DoctorApp.speechtotext, icon: Icon(DoctorApp.speechtotext, color: Colors.black, size: 35),
color: Colors.black, size: 35),
onPressed: () { onPressed: () {
initSpeechState() initSpeechState().then((value) => {onVoiceText()});
.then((value) => {onVoiceText()});
}, },
), ),
], ],
@ -258,14 +218,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: AppButton( child: AppButton(
title: widget.visitType == 3 title: widget.visitType == 3
? (widget.isUpdate ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).orderSheet
? TranslationBase.of(context).noteUpdate : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote,
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).orderSheet
: (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote,
color: AppGlobal.appGreenColor, color: AppGlobal.appGreenColor,
// disabled: progressNoteController.text.isEmpty, // disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -275,61 +229,51 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
}); });
if (progressNoteController.text.trim().isNotEmpty) { if (progressNoteController.text.trim().isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map<String, dynamic> profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
DoctorProfileModel.fromJson(profile);
if (widget.isUpdate) { if (widget.isUpdate) {
UpdateNoteReqModel reqModel = UpdateNoteReqModel( UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: admissionNo: int.parse(widget.patient!.admissionNo!),
int.parse(widget.patient.admissionNo),
cancelledNote: false, cancelledNote: false,
lineItemNo: widget.note.lineItemNo, lineItemNo: widget.note!.lineItemNo!,
createdBy: widget.note.createdBy, createdBy: widget.note!.createdBy!,
notes: progressNoteController.text, notes: progressNoteController.text,
verifiedNote: false, verifiedNote: false,
patientTypeID: widget.patient.patientType, patientTypeID: widget.patient!.patientType,
patientOutSA: false, patientOutSA: false,
conditionId: selectValue['ParameterCode']); conditionId: selectValue['ParameterCode']);
await widget.patientModel await widget.patientModel!.updatePatientProgressNote(reqModel);
.updatePatientProgressNote(reqModel);
} else { } else {
CreateNoteModel reqModel = CreateNoteModel( CreateNoteModel reqModel = CreateNoteModel(
admissionNo: admissionNo: int.parse(widget.patient!.admissionNo!),
int.parse(widget.patient.admissionNo),
createdBy: doctorProfile.doctorID, createdBy: doctorProfile.doctorID,
visitType: widget.visitType, visitType: widget.visitType,
patientID: widget.patient.patientId, patientID: widget.patient!.patientId,
nursingRemarks: ' ', nursingRemarks: ' ',
patientTypeID: widget.patient.patientType, patientTypeID: widget.patient!.patientType,
patientOutSA: false, patientOutSA: false,
notes: progressNoteController.text, notes: progressNoteController.text,
conditionId: selectValue['ParameterCode']); conditionId: selectValue['ParameterCode']);
await widget.patientModel await widget.patientModel!.createPatientProgressNote(reqModel);
.createPatientProgressNote(reqModel);
} }
if (widget.patientModel.state == if (widget.patientModel!.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { Utils.showErrorToast(widget.patientModel!.error);
Utils.showErrorToast(widget.patientModel.error);
} else { } else {
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
ProgressNoteRequest( visitType: widget.visitType,
visitType: widget.visitType, // if equal 5 then this will return progress note
// if equal 5 then this will return progress note admissionNo: int.parse(widget.patient!.admissionNo!),
admissionNo: projectID: widget.patient!.projectId,
int.parse(widget.patient.admissionNo), patientTypeID: widget.patient!.patientType,
projectID: widget.patient.projectId, languageID: 2);
patientTypeID: widget.patient.patientType, await widget.patientModel!.getPatientProgressNote(progressNoteRequest.toJson());
languageID: 2);
await widget.patientModel.getPatientProgressNote(
progressNoteRequest.toJson());
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).yourOrderAddedSuccessfully);
TranslationBase.of(context).yourOrderAddedSuccessfully);
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
Utils.showErrorToast(TranslationBase.of(context).youCannotAddOnlySpaces); Utils.showErrorToast(TranslationBase.of(context).youCannotAddOnlySpaces);
@ -345,8 +289,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
onVoiceText() async { onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context); new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize( bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
onStatus: statusListener, onError: errorListener);
if (available) { if (available) {
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
@ -390,8 +333,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
} }
Future<void> initSpeechState() async { Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize( bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
onError: errorListener, onStatus: statusListener);
print(hasSpeech); print(hasSpeech);
if (!mounted) return; if (!mounted) return;
} }

@ -20,29 +20,29 @@ import 'package:provider/provider.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class NursingProgressNoteScreen extends StatefulWidget { class NursingProgressNoteScreen extends StatefulWidget {
const NursingProgressNoteScreen({Key key}) : super(key: key); const NursingProgressNoteScreen({Key? key}) : super(key: key);
@override @override
_ProgressNoteState createState() => _ProgressNoteState(); _ProgressNoteState createState() => _ProgressNoteState();
} }
class _ProgressNoteState extends State<NursingProgressNoteScreen> { class _ProgressNoteState extends State<NursingProgressNoteScreen> {
List<NoteModel> notesList; List<NoteModel> notesList = [];
var filteredNotesList; var filteredNotesList;
bool isDischargedPatient = false; bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
getProgressNoteList(BuildContext context, PatientViewModel model, getProgressNoteList(BuildContext context, PatientViewModel model,
{bool isLocalBusy = false}) async { {bool isLocalBusy = false}) async {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
print(type); print(type);
GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel = GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel =
GetNursingProgressNoteRequestModel( GetNursingProgressNoteRequestModel(
admissionNo: int.parse(patient.admissionNo), admissionNo: int.parse(patient.admissionNo!),
patientTypeID: patient.patientType, patientTypeID: patient.patientType,
patientID: patient.patientId, patientID: patient.patientId,
setupID: "010266"); setupID: "010266");
@ -53,7 +53,7 @@ class _ProgressNoteState extends State<NursingProgressNoteScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context); authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
if (routeArgs.containsKey('isDischargedPatient')) if (routeArgs.containsKey('isDischargedPatient'))
isDischargedPatient = routeArgs['isDischargedPatient']; isDischargedPatient = routeArgs['isDischargedPatient'];
@ -156,7 +156,7 @@ class _ProgressNoteState extends State<NursingProgressNoteScreen> {
.getDateTimeFromServerFormat(model .getDateTimeFromServerFormat(model
.patientNursingProgressNoteList[ .patientNursingProgressNoteList[
index] index]
.createdOn), .createdOn!),
isArabic: isArabic:
projectViewModel projectViewModel
.isArabic, .isArabic,
@ -182,7 +182,7 @@ class _ProgressNoteState extends State<NursingProgressNoteScreen> {
.getDateTimeFromServerFormat(model .getDateTimeFromServerFormat(model
.patientNursingProgressNoteList[ .patientNursingProgressNoteList[
index] index]
.createdOn)) .createdOn!))
: AppDateUtils.getHour( : AppDateUtils.getHour(
DateTime.now()), DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -207,7 +207,7 @@ class _ProgressNoteState extends State<NursingProgressNoteScreen> {
model model
.patientNursingProgressNoteList[ .patientNursingProgressNoteList[
index] index]
.notes, .notes!,
fontSize: 10, fontSize: 10,
isCopyable: true, isCopyable: true,
), ),

@ -24,31 +24,30 @@ import '../../../../widgets/shared/app_texts_widget.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class OperationReportScreen extends StatefulWidget { class OperationReportScreen extends StatefulWidget {
final int visitType; final int? visitType;
const OperationReportScreen({Key key, this.visitType}) : super(key: key); const OperationReportScreen({Key? key, this.visitType}) : super(key: key);
@override @override
_ProgressNoteState createState() => _ProgressNoteState(); _ProgressNoteState createState() => _ProgressNoteState();
} }
class _ProgressNoteState extends State<OperationReportScreen> { class _ProgressNoteState extends State<OperationReportScreen> {
List<NoteModel> notesList; List<NoteModel> notesList = [];
var filteredNotesList; var filteredNotesList;
bool isDischargedPatient = false; bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context); authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
if (routeArgs.containsKey('isDischargedPatient')) if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient'];
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<OperationReportViewModel>( return BaseView<OperationReportViewModel>(
onModelReady: (model) => model.getReservations(patient.patientMRN), onModelReady: (model) => model.getReservations(patient.patientMRN!),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
@ -59,8 +58,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
), ),
body: Container( body: Container(
color: Colors.grey[200], color: Colors.grey[200],
child: model.reservationList == null || child: model.reservationList == null || model.reservationList.length == 0
model.reservationList.length == 0
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable, error: TranslationBase.of(context).noDataAvailable,
@ -81,46 +79,29 @@ class _ProgressNoteState extends State<OperationReportScreen> {
widget: Column( widget: Column(
children: [ children: [
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.60,
.size
.width *
0.60,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
AppText( AppText(
TranslationBase.of( TranslationBase.of(context).createdBy,
context)
.createdBy,
fontSize: 10, fontSize: 10,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
model model.reservationList[index].doctorName ?? '',
.reservationList[ fontWeight: FontWeight.w600,
index]
.doctorName ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12, fontSize: 12,
), ),
), ),
@ -132,146 +113,83 @@ class _ProgressNoteState extends State<OperationReportScreen> {
Column( Column(
children: [ children: [
AppText( AppText(
model.reservationList[index] model.reservationList[index].createdOn != null
.createdOn != ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.reservationList[index].createdOn!),
null isArabic: projectViewModel.isArabic, isMonthShort: true)
? AppDateUtils.getDayMonthYearDateFormatted( : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic),
AppDateUtils
.getDateTimeFromServerFormat(model
.reservationList[
index]
.createdOn),
isArabic:
projectViewModel
.isArabic,
isMonthShort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
AppText( AppText(
model.reservationList[index] model.reservationList[index].createdOn != null
.createdOn != ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(model.reservationList[index].createdOn!))
null : AppDateUtils.getHour(DateTime.now()),
? AppDateUtils.getHour(
AppDateUtils
.getDateTimeFromServerFormat(model
.reservationList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
], ],
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.end,
CrossAxisAlignment.end,
) )
], ],
), ),
SizedBox( SizedBox(
height: 8, height: 8,
), ),
Row( Row(mainAxisAlignment: MainAxisAlignment.start, children: [
mainAxisAlignment: AppText(
MainAxisAlignment.start, TranslationBase.of(context).reservation,
children: [ fontSize: 10,
AppText( ),
TranslationBase.of(context) Expanded(
.reservation, child: AppText(
fontSize: 10, model.reservationList[index].oTReservationID.toString(),
), fontSize: 10,
Expanded( ),
child: AppText( )
model.reservationList[index] ]),
.oTReservationID
.toString(),
fontSize: 10,
),
)
]),
SizedBox( SizedBox(
height: 8, height: 8,
), ),
if (model.reservationList[index] if (model.reservationList[index].operationDate != null)
.operationDate != Row(mainAxisAlignment: MainAxisAlignment.start, children: [
null) AppText(
Row( TranslationBase.of(context).operationDate,
mainAxisAlignment: fontSize: 10,
MainAxisAlignment.start, ),
children: [ Expanded(
AppText( child: AppText(
TranslationBase.of(context) AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.reservationList[index].operationDate!),
.operationDate, isArabic: projectViewModel.isArabic, isMonthShort: true),
fontSize: 10, fontSize: 10,
), ),
Expanded( )
child: AppText( ]),
AppDateUtils.getDayMonthYearDateFormatted( if (model.reservationList[index].timeStart != null)
AppDateUtils Row(mainAxisAlignment: MainAxisAlignment.start, children: [
.getDateTimeFromServerFormat(model AppText(
.reservationList[ TranslationBase.of(context).operationTimeStart,
index] fontSize: 10,
.operationDate), ),
isArabic: Expanded(
projectViewModel child: AppText(
.isArabic, model.reservationList[index].timeStart!,
isMonthShort: true), fontSize: 10,
fontSize: 10, ),
), )
) ]),
]), if (model.reservationList[index].remarks != null)
if (model.reservationList[index] Row(mainAxisAlignment: MainAxisAlignment.start, children: [
.timeStart != AppText(
null) TranslationBase.of(context).remarks,
Row( fontSize: 10,
mainAxisAlignment: ),
MainAxisAlignment.start, Expanded(
children: [ child: AppText(
AppText( model.reservationList[index].remarks ?? '',
TranslationBase.of(context) fontSize: 10,
.operationTimeStart, ),
fontSize: 10, ),
), ])
Expanded(
child: AppText(
model
.reservationList[
index]
.timeStart,
fontSize: 10,
),
)
]),
if (model.reservationList[index]
.remarks !=
null)
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.remarks,
fontSize: 10,
),
Expanded(
child: AppText(
model
.reservationList[
index]
.remarks ??
'',
fontSize: 10,
),
),
])
], ],
), ),
@ -287,28 +205,20 @@ class _ProgressNoteState extends State<OperationReportScreen> {
// index] // index]
// .createdBy) // .createdBy)
Row( Row(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.end,
children: [ children: [
InkWell( InkWell(
onTap: () async { onTap: () async {
await locator<AnalyticsService>() await locator<AnalyticsService>().logEvent(
.logEvent( eventCategory: "Operation Report Screen",
eventCategory: eventAction: "Update Operation Report ",
"Operation Report Screen",
eventAction:
"Update Operation Report ",
); );
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => UpdateOperationReport(
UpdateOperationReport( reservation: model.reservationList[index],
reservation: model
.reservationList[
index],
patient: patient, patient: patient,
isUpdate: true, isUpdate: true,
)), )),
@ -317,8 +227,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppGlobal.appGreenColor, color: AppGlobal.appGreenColor,
borderRadius: borderRadius: BorderRadius.circular(10),
BorderRadius.circular(10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
@ -333,8 +242,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
width: 2, width: 2,
), ),
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).operationReports,
.operationReports,
fontSize: 10, fontSize: 10,
color: Colors.white, color: Colors.white,
), ),

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
@ -20,18 +21,14 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:speech_to_text/speech_to_text.dart' as stt;
import '../../../../config/config.dart';
class UpdateOperationReport extends StatefulWidget { class UpdateOperationReport extends StatefulWidget {
final GetReservationsResponseModel reservation; final GetReservationsResponseModel? reservation;
final PatiantInformtion? patient;
// final OperationReportViewModel operationReportViewModel; final int? visitType;
final PatiantInformtion patient; final bool? isUpdate;
final int visitType;
final bool isUpdate;
const UpdateOperationReport( const UpdateOperationReport(
{Key key, {Key? key,
// this.operationReportViewModel, // this.operationReportViewModel,
this.patient, this.patient,
this.visitType, this.visitType,
@ -44,12 +41,12 @@ class UpdateOperationReport extends StatefulWidget {
} }
class _UpdateOperationReportState extends State<UpdateOperationReport> { class _UpdateOperationReportState extends State<UpdateOperationReport> {
int selectedType; int? selectedType;
bool isSubmitted = false; bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText(); stt.SpeechToText speech = stt.SpeechToText();
var recognizedWord; var recognizedWord;
var event = RobotProvider(); var event = RobotProvider();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
TextEditingController preOpDiagmosisController = TextEditingController(); TextEditingController preOpDiagmosisController = TextEditingController();
TextEditingController postOpDiagmosisNoteController = TextEditingController(); TextEditingController postOpDiagmosisNoteController = TextEditingController();
@ -63,13 +60,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
TextEditingController complicationDetailsController = TextEditingController(); TextEditingController complicationDetailsController = TextEditingController();
TextEditingController bloodLossDetailController = TextEditingController(); TextEditingController bloodLossDetailController = TextEditingController();
TextEditingController histopathSpecimenController = TextEditingController(); TextEditingController histopathSpecimenController = TextEditingController();
TextEditingController microbiologySpecimenController = TextEditingController microbiologySpecimenController = TextEditingController();
TextEditingController();
TextEditingController otherSpecimenController = TextEditingController(); TextEditingController otherSpecimenController = TextEditingController();
TextEditingController scrubNurseController = TextEditingController(); TextEditingController scrubNurseController = TextEditingController();
TextEditingController circulatingNurseController = TextEditingController(); TextEditingController circulatingNurseController = TextEditingController();
TextEditingController BloodTransfusedDetailController = TextEditingController BloodTransfusedDetailController = TextEditingController();
TextEditingController();
TextEditingController anasthetistController = TextEditingController(); TextEditingController anasthetistController = TextEditingController();
TextEditingController OTReservationID = TextEditingController(); TextEditingController OTReservationID = TextEditingController();
@ -91,33 +86,30 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
return BaseView<OperationReportViewModel>( return BaseView<OperationReportViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getOperationReportDetails(widget.reservation); await model.getOperationReportDetails(widget.reservation!);
OTReservationID.text = widget.reservation.oTReservationID.toString(); OTReservationID.text = widget.reservation!.oTReservationID.toString();
if (model.operationDetailsList.isNotEmpty) { if (model.operationDetailsList.isNotEmpty) {
GetOperationDetailsResponseModel oldDetails = GetOperationDetailsResponseModel oldDetails = model.operationDetailsList[0];
model.operationDetailsList[0];
postOpDiagmosisNoteController.text = oldDetails.postOpInstruction!;
postOpDiagmosisNoteController.text = oldDetails.postOpInstruction; preOpDiagmosisController.text = oldDetails.preOpDiagnosis!;
preOpDiagmosisController.text = oldDetails.preOpDiagnosis; surgeonController.text = oldDetails.surgeon!;
surgeonController.text = oldDetails.surgeon; assistantNoteController.text = oldDetails.assistant!;
assistantNoteController.text = oldDetails.assistant; operationController.text = oldDetails.operation!;
operationController.text = oldDetails.operation; inasionController.text = oldDetails.inasion!;
inasionController.text = oldDetails.inasion; findingController.text = oldDetails.finding!;
findingController.text = oldDetails.finding; surgeryProcedureController.text = oldDetails.surgeryProcedure!;
surgeryProcedureController.text = oldDetails.surgeryProcedure; postOpInstructionController.text = oldDetails.postOpInstruction!;
postOpInstructionController.text = oldDetails.postOpInstruction; complicationDetailsController.text = oldDetails.complicationDetail!;
complicationDetailsController.text = oldDetails.complicationDetail; bloodLossDetailController.text = oldDetails.bloodLossDetail!;
bloodLossDetailController.text = oldDetails.bloodLossDetail; histopathSpecimenController.text = oldDetails.histopathSpecimen!;
histopathSpecimenController.text = oldDetails.histopathSpecimen; microbiologySpecimenController.text = oldDetails.microbiologySpecimen!;
microbiologySpecimenController.text = otherSpecimenController.text = oldDetails.otherSpecimen!;
oldDetails.microbiologySpecimen;
otherSpecimenController.text = oldDetails.otherSpecimen;
scrubNurseController.text = oldDetails.scrubNurse; scrubNurseController.text = oldDetails.scrubNurse;
circulatingNurseController.text = oldDetails.circulatingNurse; circulatingNurseController.text = oldDetails.circulatingNurse;
BloodTransfusedDetailController.text = BloodTransfusedDetailController.text = oldDetails.bloodTransfusedDetail;
oldDetails.bloodTransfusedDetail; anasthetistController.text = oldDetails.anasthetist!;
anasthetistController.text = oldDetails.anasthetist;
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -146,8 +138,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
child: Column( child: Column(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).reservation,
.reservation,
controller: OTReservationID, controller: OTReservationID,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
@ -158,95 +149,63 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).preOperationDiagnosis,
.preOperationDiagnosis,
controller: preOpDiagmosisController, controller: preOpDiagmosisController,
maxLines: 20, maxLines: 20,
minLines: 8, minLines: 8,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: preOpDiagmosisController validationError: preOpDiagmosisController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).postOperationDiagnosis,
.postOperationDiagnosis,
controller: postOpDiagmosisNoteController, controller: postOpDiagmosisNoteController,
maxLines: 20, maxLines: 20,
minLines: 8, minLines: 8,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: postOpDiagmosisNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
postOpDiagmosisNoteController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).surgeon,
TranslationBase.of(context).surgeon,
controller: surgeonController, controller: surgeonController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: surgeonController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
surgeonController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).assistant,
TranslationBase.of(context).assistant,
controller: assistantNoteController, controller: assistantNoteController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: assistantNoteController validationError: assistantNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).operation,
TranslationBase.of(context).operation,
controller: operationController, controller: operationController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: operationController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
operationController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -260,248 +219,162 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: inasionController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
inasionController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).finding,
TranslationBase.of(context).finding,
controller: findingController, controller: findingController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: findingController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
findingController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).surgeryProcedure,
.surgeryProcedure,
controller: surgeryProcedureController, controller: surgeryProcedureController,
maxLines: 20, maxLines: 20,
minLines: 8, minLines: 8,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: surgeryProcedureController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
surgeryProcedureController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).postOperationInstruction,
.postOperationInstruction,
controller: postOpInstructionController, controller: postOpInstructionController,
maxLines: 20, maxLines: 20,
minLines: 8, minLines: 8,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: postOpInstructionController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
postOpInstructionController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).complicationDetails1,
.complicationDetails1,
controller: complicationDetailsController, controller: complicationDetailsController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: complicationDetailsController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
complicationDetailsController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).bloodLossDetail,
.bloodLossDetail,
controller: bloodLossDetailController, controller: bloodLossDetailController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: bloodLossDetailController validationError: bloodLossDetailController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).histopathSpecimen,
.histopathSpecimen,
controller: histopathSpecimenController, controller: histopathSpecimenController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: histopathSpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
histopathSpecimenController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).microbiologySpecimen,
.microbiologySpecimen, controller: microbiologySpecimenController,
controller:
microbiologySpecimenController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: microbiologySpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
microbiologySpecimenController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).otherSpecimen,
.otherSpecimen,
controller: otherSpecimenController, controller: otherSpecimenController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: otherSpecimenController validationError: otherSpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).scrubNurse,
.scrubNurse,
controller: scrubNurseController, controller: scrubNurseController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: scrubNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
scrubNurseController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).circulatingNurse,
.circulatingNurse,
controller: circulatingNurseController, controller: circulatingNurseController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: circulatingNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
circulatingNurseController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).bloodTransfusedDetail,
.bloodTransfusedDetail, controller: BloodTransfusedDetailController,
controller:
BloodTransfusedDetailController,
maxLines: 20, maxLines: 20,
minLines: 4, minLines: 4,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: BloodTransfusedDetailController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
BloodTransfusedDetailController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).anesthetist,
.anesthetist,
controller: anasthetistController, controller: anasthetistController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: anasthetistController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "",
anasthetistController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 250, height: 250,
@ -529,11 +402,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: AppButton( child: AppButton(
title: (widget.isUpdate title: (widget.isUpdate! ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + " " + TranslationBase.of(context).operationReports,
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
" " +
TranslationBase.of(context).operationReports,
color: AppGlobal.appGreenColor, color: AppGlobal.appGreenColor,
// disabled: operationReportsController.text.isEmpty, // disabled: operationReportsController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -545,55 +414,33 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getDoctorProfile(); await model.getDoctorProfile();
CreateUpdateOperationReportRequestModel CreateUpdateOperationReportRequestModel createUpdateOperationReportRequestModel = CreateUpdateOperationReportRequestModel(
createUpdateOperationReportRequestModel = inasion: inasionController.text,
CreateUpdateOperationReportRequestModel(
inasion: inasionController.text, /// TODO Elham* Add dynamic reservation
reservationNo: widget.reservation!.oTReservationID,
/// TODO Elham* Add dynamic reservation preOpDiagmosis: preOpDiagmosisController.text,
reservationNo: widget postOpDiagmosis: postOpDiagmosisNoteController.text,
.reservation.oTReservationID, surgeon: surgeonController.text,
preOpDiagmosis: assistant: assistantNoteController.text,
preOpDiagmosisController.text, anasthetist: assistantNoteController.text,
postOpDiagmosis: operation: operationController.text,
postOpDiagmosisNoteController finding: findingController.text,
.text, surgeryProcedure: surgeonController.text,
surgeon: surgeonController.text, postOpInstruction: postOpInstructionController.text,
assistant: complicationDetails: complicationDetailsController.text,
assistantNoteController.text, bloodLossDetail: bloodLossDetailController.text,
anasthetist: histopathSpecimen: histopathSpecimenController.text,
assistantNoteController.text, microbiologySpecimen: microbiologySpecimenController.text,
operation: operationController.text, otherSpecimen: otherSpecimenController.text,
finding: findingController.text, scrubNurse: surgeonController.text,
surgeryProcedure: circulatingNurse: circulatingNurseController.text,
surgeonController.text, bloodTransfusedDetail: bloodLossDetailController.text,
postOpInstruction: patientID: widget.patient!.patientId!,
postOpInstructionController.text, admissionNo: int.parse(widget.patient!.admissionNo!),
complicationDetails: createdBy: model.doctorProfile!.doctorID!,
complicationDetailsController setupID: "010266");
.text, await model.updateOperationReport(createUpdateOperationReportRequestModel);
bloodLossDetail:
bloodLossDetailController.text,
histopathSpecimen:
histopathSpecimenController.text,
microbiologySpecimen:
microbiologySpecimenController
.text,
otherSpecimen:
otherSpecimenController.text,
scrubNurse: surgeonController.text,
circulatingNurse:
circulatingNurseController.text,
bloodTransfusedDetail:
bloodLossDetailController.text,
patientID: widget.patient.patientId,
admissionNo: int.parse(
widget.patient.admissionNo),
createdBy:
model.doctorProfile.doctorID,
setupID: "010266");
await model.updateOperationReport(
createUpdateOperationReportRequestModel);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
@ -601,8 +448,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// await model.( // await model.(
// operationReportsRequest.toJson()); // operationReportsRequest.toJson());
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast("Your Order added Successfully");
"Your Order added Successfully");
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }

@ -10,22 +10,18 @@ import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class PendingOrdersScreen extends StatelessWidget { class PendingOrdersScreen extends StatelessWidget {
const PendingOrdersScreen({Key key}) : super(key: key); const PendingOrdersScreen({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
patient = routeArgs['patient']; patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
return BaseView<PendingOrdersViewModel>( return BaseView<PendingOrdersViewModel>(
onModelReady: (model) => model.getPendingOrders( onModelReady: (model) => model.getPendingOrders(patientId: patient.patientMRN!, admissionNo: int.parse(patient.admissionNo!)),
patientId: patient.patientMRN, builder: (BuildContext context, PendingOrdersViewModel model, Widget? child) => AppScaffold(
admissionNo: int.parse(patient.admissionNo)),
builder:
(BuildContext context, PendingOrdersViewModel model, Widget child) =>
AppScaffold(
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient,
isInpatient: isInpatient, isInpatient: isInpatient,
@ -33,8 +29,7 @@ class PendingOrdersScreen extends StatelessWidget {
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
appBarTitle: "Pending Orders", appBarTitle: "Pending Orders",
body: model.pendingOrdersList == null || body: model.pendingOrdersList == null || model.pendingOrdersList.length == 0
model.pendingOrdersList.length == 0
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable, error: TranslationBase.of(context).noDataAvailable,
@ -83,8 +78,7 @@ class PendingOrdersScreen extends StatelessWidget {
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: AppText( child: AppText(model.pendingOrdersList[index].notes!),
model.pendingOrdersList[index].notes),
), ),
SizedBox( SizedBox(
height: 20, height: 20,

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/profile/intervention_medication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_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/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -11,29 +12,27 @@ 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:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
import '../../../../widgets/transitions/fade_page.dart';
import 'intervention_medication_history_screen.dart'; import 'intervention_medication_history_screen.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class InterventionMedicationScreen extends StatefulWidget { class InterventionMedicationScreen extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion? patient;
final InterventionMedicationViewModel previousModel; final InterventionMedicationViewModel? previousModel;
const InterventionMedicationScreen(this.patient, {Key key, this.previousModel}) : super(key: key);
const InterventionMedicationScreen(this.patient, {Key? key, this.previousModel}) : super(key: key);
@override @override
_InterventionMedicationScreenState createState() => _InterventionMedicationScreenState createState() => _InterventionMedicationScreenState();
_InterventionMedicationScreenState();
} }
class _InterventionMedicationScreenState class _InterventionMedicationScreenState extends State<InterventionMedicationScreen> {
extends State<InterventionMedicationScreen> {
bool isDischargedPatient = false; bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -42,164 +41,142 @@ class _InterventionMedicationScreenState
return BaseView<InterventionMedicationViewModel>( return BaseView<InterventionMedicationViewModel>(
onModelReady: (model) => model.getInterventionMedication( onModelReady: (model) => model.getInterventionMedication(
patientId: widget.patient.patientId, patientId: widget.patient!.patientId,
//admissionNo: int.parse(widget.patient.admissionNo), //admissionNo: int.parse(widget.patient.admissionNo),
fromDate: widget.previousModel.selectedFromDate, fromDate: widget.previousModel!.selectedFromDate,
toDate: widget.previousModel.selectedToDate, toDate: widget.previousModel!.selectedToDate,
), ),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
widget.patient, widget.patient!,
isInpatient: true, isInpatient: true,
), ),
body: model.allInterventionList == null || body: model.allInterventionList == null || model.allInterventionList.length == 0
model.allInterventionList.length == 0
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable, error: TranslationBase.of(context).noDataAvailable,
), ),
) )
: Container( : Container(
color: Colors.grey[200], color: Colors.grey[200],
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Container( child: Container(
child: ListView.builder( child: ListView.builder(
itemCount: model.allInterventionList.length, itemCount: model.allInterventionList.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return InkWell( return InkWell(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.95, widthFactor: 0.95,
child: CardWithBgWidget( child: CardWithBgWidget(
hasBorder: false, hasBorder: false,
bgColor: Colors.transparent, bgColor: Colors.transparent,
widget: Column( widget: Column(
children: [ children: [
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ SizedBox(
SizedBox( height: 10,
height: 10, ),
), Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
MainAxisAlignment children: [
.spaceBetween, Container(
crossAxisAlignment: width: MediaQuery.of(context).size.width * 0.60,
CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
width: MediaQuery.of(context) CustomRow(
.size valueSize: 14,
.width * label: '',
0.60, value: model.allInterventionList[index].cS!,
child: Column( )
crossAxisAlignment: ],
CrossAxisAlignment ),
.start, ),
Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
CustomRow( AppText(
valueSize: 14, AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(model.allInterventionList[index].startDatetime!),
label: '', isArabic: projectViewModel.isArabic, isMonthShort: true),
value: model.allInterventionList[index].cS, fontWeight: FontWeight.w600,
) fontSize: 14,
color: Color(0xFF2B353E),
),
], ],
), ),
), ],
Column( )
children: [ ],
Row( ),
crossAxisAlignment: SizedBox(
CrossAxisAlignment height: 8,
.start, ),
children: [ CustomRow(
AppText( labelSize: 12,
AppDateUtils.getDayMonthYearDateFormatted( valueSize: 12,
AppDateUtils.convertStringToDate(model label: TranslationBase.of(context).description,
.allInterventionList[ value: model.allInterventionList[index].description!,
index] ),
.startDatetime), SizedBox(
isArabic: height: 8,
projectViewModel ),
.isArabic, CustomRow(
isMonthShort: labelSize: 12,
true), valueSize: 12,
fontWeight: label: TranslationBase.of(context).medication,
FontWeight.w600, value: model.allInterventionList[index].medication!,
fontSize: 14, ),
color: Color(0xFF2B353E), SizedBox(
), height: 8,
], ),
), CustomRow(
], labelSize: 12,
) valueSize: 12,
], label: TranslationBase.of(context).doctorComments,
), value: model.allInterventionList[index].doctorComments!,
SizedBox( ),
height: 8, SizedBox(
), height: 8,
CustomRow( ),
labelSize: 12, CustomRow(
valueSize: 12, labelSize: 12,
label: TranslationBase.of(context).description, valueSize: 12,
value: model.allInterventionList[index].description, label: TranslationBase.of(context).statusDescription,
), value: model.allInterventionList[index].statusDescription!,
SizedBox( ),
height: 8, ],
), ),
CustomRow( SizedBox(
labelSize: 12, height: 20,
valueSize: 12, ),
label: TranslationBase.of(context).medication, ],
value: model.allInterventionList[index].medication,
),
SizedBox(
height: 8,
),
CustomRow(
labelSize: 12,
valueSize: 12,
label: TranslationBase.of(context).doctorComments,
value: model.allInterventionList[index].doctorComments,
),
SizedBox(
height: 8,
),
CustomRow(
labelSize: 12,
valueSize: 12,
label: TranslationBase.of(context).statusDescription,
value: model.allInterventionList[index].statusDescription,
),
],
),
SizedBox(
height: 20,
),
],
),
), ),
), ),
onTap: () { ),
Navigator.push( onTap: () {
context, Navigator.push(
FadePage( context,
page: InterventionMedicationHistoryScreen(widget.patient, model.allInterventionList[index]), FadePage(
), page: InterventionMedicationHistoryScreen(widget.patient!, model.allInterventionList[index]),
); ),
}, );
); },
}), );
), }),
), ),
], ),
), ],
), ),
),
), ),
); );
} }

@ -27,7 +27,7 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class InterventionMedicationHistoryScreen extends StatefulWidget { class InterventionMedicationHistoryScreen extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final InterventionMedicationResModel interventionMedication; final InterventionMedicationResModel interventionMedication;
const InterventionMedicationHistoryScreen(this.patient, this.interventionMedication, {Key key}) : super(key: key); const InterventionMedicationHistoryScreen(this.patient, this.interventionMedication, {Key? key}) : super(key: key);
@override @override
_InterventionMedicationHistoryScreenState createState() => _InterventionMedicationHistoryScreenState(); _InterventionMedicationHistoryScreenState createState() => _InterventionMedicationHistoryScreenState();
@ -35,8 +35,8 @@ class InterventionMedicationHistoryScreen extends StatefulWidget {
class _InterventionMedicationHistoryScreenState extends State<InterventionMedicationHistoryScreen> { class _InterventionMedicationHistoryScreenState extends State<InterventionMedicationHistoryScreen> {
bool isDischargedPatient = false; bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -107,7 +107,7 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
labelSize: 12, labelSize: 12,
valueSize: 12, valueSize: 12,
label: TranslationBase.of(context).createdByName, label: TranslationBase.of(context).createdByName,
value: model.allInterventionHistoryList[index].createdByName, value: model.allInterventionHistoryList[index].createdByName!,
), ),
], ],
), ),
@ -125,7 +125,7 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
AppDateUtils.convertStringToDate( AppDateUtils.convertStringToDate(
model model
.allInterventionHistoryList[ .allInterventionHistoryList[
index].createdOn) index].createdOn!)
,isArabic: ,isArabic:
projectViewModel projectViewModel
.isArabic, .isArabic,
@ -147,7 +147,7 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
labelSize: 12, labelSize: 12,
valueSize: 12, valueSize: 12,
label: TranslationBase.of(context).remarks, label: TranslationBase.of(context).remarks,
value: model.allInterventionHistoryList[index].remark, value: model.allInterventionHistoryList[index].remark!,
), ),
SizedBox( SizedBox(
height: 8, height: 8,

@ -1,5 +1,8 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/profile/intervention_medication_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart';
@ -9,26 +12,21 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../../../config/config.dart';
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
import '../../../base/base_view.dart';
import 'intervention_medication.dart'; import 'intervention_medication.dart';
class PharmacyInterventionScreen extends StatefulWidget { class PharmacyInterventionScreen extends StatefulWidget {
final OutPatientFilterType outPatientFilterType; final OutPatientFilterType? outPatientFilterType;
const PharmacyInterventionScreen({ const PharmacyInterventionScreen({
Key key, Key? key,
this.outPatientFilterType, this.outPatientFilterType,
}) : super(key: key); }) : super(key: key);
@override @override
_PharmacyInterventionScreenState createState() => _PharmacyInterventionScreenState createState() => _PharmacyInterventionScreenState();
_PharmacyInterventionScreenState();
} }
class _PharmacyInterventionScreenState class _PharmacyInterventionScreenState extends State<PharmacyInterventionScreen> {
extends State<PharmacyInterventionScreen> {
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
@ -37,7 +35,7 @@ class _PharmacyInterventionScreenState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
return BaseView<InterventionMedicationViewModel>( return BaseView<InterventionMedicationViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -52,10 +50,7 @@ class _PharmacyInterventionScreenState
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
BottomSheetTitle( BottomSheetTitle(
title: (OutPatientFilterType.Previous == title: (OutPatientFilterType.Previous == widget.outPatientFilterType) ? "" : TranslationBase.of(context).pharmacyIntervention,
widget.outPatientFilterType)
? ""
: TranslationBase.of(context).pharmacyIntervention,
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
@ -71,24 +66,13 @@ class _PharmacyInterventionScreenState
onTap: () => selectDate( onTap: () => selectDate(
context, context,
model, model,
firstDate: DateTime( firstDate: DateTime(DateTime.now().year - 20, DateTime.now().month, DateTime.now().day),
DateTime.now().year - 20, lastDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 100),
DateTime.now().month, selectedDate: model.selectedFromDate != null ? model.selectedFromDate : DateTime.now(),
DateTime.now().day),
lastDate: DateTime(
DateTime.now().year,
DateTime.now().month,
DateTime.now().day + 100),
selectedDate: model.selectedFromDate != null
? model.selectedFromDate
: DateTime.now(),
), ),
child: TextField( child: TextField(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(
TranslationBase.of(context).fromDate, TranslationBase.of(context).fromDate, "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}", true,
"${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}"
,
true,
suffixIcon: Icon( suffixIcon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
@ -107,24 +91,13 @@ class _PharmacyInterventionScreenState
context, context,
model, model,
isFromDate: false, isFromDate: false,
firstDate: DateTime( firstDate: DateTime(DateTime.now().year - 20, DateTime.now().month, DateTime.now().day),
DateTime.now().year - 20, lastDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 100),
DateTime.now().month, selectedDate: model.selectedToDate != null ? model.selectedToDate : DateTime.now().add(Duration(days: 1)),
DateTime.now().day),
lastDate: DateTime(
DateTime.now().year,
DateTime.now().month,
DateTime.now().day + 100),
selectedDate: model.selectedToDate != null
? model.selectedToDate
: DateTime.now().add(Duration(days: 1)),
), ),
child: TextField( child: TextField(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(
TranslationBase.of(context).toDate, TranslationBase.of(context).toDate, "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}", true,
"${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}"
,
true,
suffixIcon: Icon( suffixIcon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
@ -169,8 +142,7 @@ class _PharmacyInterventionScreenState
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => InterventionMedicationScreen(
InterventionMedicationScreen(
patient, patient,
previousModel: model, previousModel: model,
)), )),
@ -188,16 +160,12 @@ class _PharmacyInterventionScreenState
))); )));
} }
selectDate(BuildContext context, InterventionMedicationViewModel model, selectDate(BuildContext context, InterventionMedicationViewModel model, {bool isFromDate = true, DateTime? firstDate, lastDate, selectedDate}) async {
{bool isFromDate = true,
DateTime firstDate,
lastDate,
selectedDate}) async {
Utils.hideKeyboard(context); Utils.hideKeyboard(context);
final DateTime picked = await showDatePicker( final DateTime? picked = await showDatePicker(
context: context, context: context,
initialDate: selectedDate, initialDate: selectedDate,
firstDate: firstDate, firstDate: firstDate!,
lastDate: lastDate, lastDate: lastDate,
initialEntryMode: DatePickerEntryMode.calendar, initialEntryMode: DatePickerEntryMode.calendar,
); );
@ -219,9 +187,7 @@ class _PharmacyInterventionScreenState
} }
} }
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon? suffixIcon}) {
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),

@ -17,10 +17,10 @@ class InpatientPrescriptionDetailsScreen extends StatefulWidget {
class _InpatientPrescriptionDetailsScreenState class _InpatientPrescriptionDetailsScreenState
extends State<InpatientPrescriptionDetailsScreen> { extends State<InpatientPrescriptionDetailsScreen> {
bool _showDetails = false; bool _showDetails = false;
String error; String? error;
TextEditingController answerController; TextEditingController answerController = TextEditingController();
bool _isInit = true; bool _isInit = true;
PrescriptionReportForInPatient prescription; PrescriptionReportForInPatient prescription = PrescriptionReportForInPatient();
@override @override
void initState() { void initState() {
@ -31,7 +31,7 @@ class _InpatientPrescriptionDetailsScreenState
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
prescription = routeArgs['prescription']; prescription = routeArgs['prescription'];
} }
_isInit = false; _isInit = false;
@ -49,8 +49,8 @@ class _InpatientPrescriptionDetailsScreenState
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
AppText( AppText(
prescription.itemDescription, prescription.itemDescription!,
fontSize: 2.5 * SizeConfig.textMultiplier, fontSize: 2.5 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
InkWell( InkWell(
@ -96,11 +96,11 @@ class _InpatientPrescriptionDetailsScreenState
key: 'UOM'), key: 'UOM'),
buildTableRow( buildTableRow(
des: des:
'${AppDateUtils.getDate(prescription.startDatetime)}', '${AppDateUtils.getDate(prescription.startDatetime!)}',
key: 'Start Date'), key: 'Start Date'),
buildTableRow( buildTableRow(
des: des:
'${AppDateUtils.getDate(prescription.stopDatetime)}', '${AppDateUtils.getDate(prescription.stopDatetime!)}',
key: 'Stop Date'), key: 'Stop Date'),
buildTableRow( buildTableRow(
des: '${prescription.noOfDoses}', des: '${prescription.noOfDoses}',
@ -115,7 +115,7 @@ class _InpatientPrescriptionDetailsScreenState
key: 'Pharmacy Remarks'), key: 'Pharmacy Remarks'),
buildTableRow( buildTableRow(
des: des:
'${AppDateUtils.getDate(prescription.prescriptionDatetime)}', '${AppDateUtils.getDate(prescription.prescriptionDatetime!)}',
key: 'Prescription Date'), key: 'Prescription Date'),
buildTableRow( buildTableRow(
des: '${prescription.refillID}', des: '${prescription.refillID}',
@ -160,7 +160,7 @@ class _InpatientPrescriptionDetailsScreenState
child: Container( child: Container(
child: AppText( child: AppText(
key, key,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.start, textAlign: TextAlign.start,
), ),
@ -176,7 +176,7 @@ class _InpatientPrescriptionDetailsScreenState
children: <Widget>[ children: <Widget>[
AppText( AppText(
'${des}', '${des}',
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
textAlign: TextAlign.center, textAlign: TextAlign.center,
) )

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
class OutPatientPrescriptionDetailsItem extends StatefulWidget { class OutPatientPrescriptionDetailsItem extends StatefulWidget {
final PrescriptionReport prescriptionReport; final PrescriptionReport prescriptionReport;
OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); OutPatientPrescriptionDetailsItem({Key? key, required this.prescriptionReport});
@override @override
_OutPatientPrescriptionDetailsItemState createState() => _OutPatientPrescriptionDetailsItemState createState() =>
@ -30,7 +30,7 @@ class _OutPatientPrescriptionDetailsItemState
flex: 5, flex: 5,
child: AppText( child: AppText(
'${widget.prescriptionReport.itemDescription} ', '${widget.prescriptionReport.itemDescription} ',
fontSize: 2.5 * SizeConfig.textMultiplier, fontSize: 2.5 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -106,7 +106,7 @@ class _OutPatientPrescriptionDetailsItemState
child: Container( child: Container(
child: AppText( child: AppText(
key, key,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.start, textAlign: TextAlign.start,
), ),
@ -122,7 +122,7 @@ class _OutPatientPrescriptionDetailsItemState
children: <Widget>[ children: <Widget>[
AppText( AppText(
'${des}', '${des}',
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
textAlign: TextAlign.center, textAlign: TextAlign.center,
) )

@ -8,12 +8,12 @@ class PatientProfileCardModel {
final bool isInPatient; final bool isInPatient;
final bool isDisable; final bool isDisable;
final bool isLoading; final bool isLoading;
final Function onTap; final Function? onTap;
final bool isDischargedPatient; final bool isDischargedPatient;
final bool isSelectInpatient; final bool isSelectInpatient;
final bool isDartIcon; final bool isDartIcon;
final IconData dartIcon; final IconData? dartIcon;
final Color color; final Color? color;
PatientProfileCardModel( PatientProfileCardModel(
this.nameLine1, this.nameLine1,

@ -9,6 +9,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart';
@ -26,17 +28,13 @@ import 'package:flutter_svg/svg.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:quiver/async.dart'; import 'package:quiver/async.dart';
import '../../../../locator.dart';
import '../../../../routes.dart';
class PatientProfileScreen extends StatefulWidget { class PatientProfileScreen extends StatefulWidget {
@override @override
_PatientProfileScreenState createState() => _PatientProfileScreenState(); _PatientProfileScreenState createState() => _PatientProfileScreenState();
} }
class _PatientProfileScreenState extends State<PatientProfileScreen> class _PatientProfileScreenState extends State<PatientProfileScreen> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin { PatiantInformtion patient = PatiantInformtion();
PatiantInformtion patient;
LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel(); LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel();
bool isFromSearch = false; bool isFromSearch = false;
@ -48,16 +46,16 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
bool isDischargedPatient = false; bool isDischargedPatient = false;
bool isSearchAndOut = false; bool isSearchAndOut = false;
bool isCallStarted = false; bool isCallStarted = false;
String patientType; String? patientType;
String arrivalType; String? arrivalType;
String from; String? from;
String to; String? to;
TabController _tabController; TabController? _tabController;
int index = 0; int index = 0;
int _activeTab = 0; int _activeTab = 0;
StreamController<String> videoCallDurationStreamController; late StreamController<String> videoCallDurationStreamController;
Stream<String> videoCallDurationStream = (() async* {})(); late Stream<String> videoCallDurationStream;
@override @override
void initState() { void initState() {
@ -69,17 +67,17 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
@override @override
void dispose() { void dispose() {
_tabController.dispose(); _tabController!.dispose();
super.dispose(); super.dispose();
if (isFromLiveCare) { if (isFromLiveCare) {
_liveCareViewModel.removePatientFromDoctorList(patient.vcId); _liveCareViewModel.removePatientFromDoctorList(patient.vcId!);
} }
} }
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
patientType = routeArgs['patientType']; patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType']; arrivalType = routeArgs['arrivalType'];
@ -112,23 +110,22 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
_activeTab = 1; _activeTab = 1;
} }
StreamSubscription callTimer; late StreamSubscription callTimer;
callConnected() { callConnected() {
callTimer = callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null)
CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) ..onDone(() {
..onDone(() { callTimer.cancel();
callTimer.cancel(); })
}) ..onData((data) {
..onData((data) { var t = Utils.timeFrom(duration: data.elapsed);
var t = Utils.timeFrom(duration: data.elapsed); videoCallDurationStreamController.sink.add(t);
videoCallDurationStreamController.sink.add(t); });
});
} }
callDisconnected() { callDisconnected() {
callTimer.cancel(); callTimer.cancel();
videoCallDurationStreamController.sink.add(null); videoCallDurationStreamController.sink.add("");
setState(() { setState(() {
isCallStarted = false; isCallStarted = false;
@ -140,8 +137,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<LiveCarePatientViewModel>( return BaseView<LiveCarePatientViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (isFromLiveCare && patient.patientStatus == 1) if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId!);
await model.addPatientToDoctorList(patient.vcId);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -154,13 +150,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
children: [ children: [
Column( Column(
children: [ children: [
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType!,
patient, arrivalType ?? '0', patientType,
videoCallDurationStream: videoCallDurationStream, videoCallDurationStream: videoCallDurationStream,
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare, isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null && height: (patient.patientStatusType != null && patient.patientStatusType == 43)
patient.patientStatusType == 43)
? 210 ? 210
: isDischargedPatient : isDischargedPatient
? 240 ? 240
@ -178,32 +172,31 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
child: isSearchAndOut child: isSearchAndOut
? ProfileGridForSearch( ? ProfileGridForSearch(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType!,
arrivalType: arrivalType, arrivalType: arrivalType!,
isInpatient: isInpatient, isInpatient: isInpatient,
from: from, from: from!,
to: to, to: to!,
) )
: isInpatient : isInpatient
? ProfileGridForInPatient( ? ProfileGridForInPatient(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType!,
arrivalType: arrivalType, arrivalType: arrivalType!,
isInpatient: isInpatient, isInpatient: isInpatient,
from: from, from: from!,
to: to, to: to!,
isDischargedPatient: isDischargedPatient: isDischargedPatient,
isDischargedPatient,
isFromSearch: isFromSearch, isFromSearch: isFromSearch,
) )
: ProfileGridForOther( : ProfileGridForOther(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType!,
arrivalType: arrivalType, arrivalType: arrivalType!,
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare, isFromLiveCare: isFromLiveCare,
from: from, from: from!,
to: to, to: to!,
), ),
), ),
SizedBox( SizedBox(
@ -218,8 +211,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
? true ? true
: isFromLiveCare : isFromLiveCare
? patient.episodeNo != null ? patient.episodeNo != null
: patient.patientStatusType != null && : patient.patientStatusType != null && patient.patientStatusType == 43)
patient.patientStatusType == 43)
BaseView<SOAPViewModel>( BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.getDoctorProfile(); model.getDoctorProfile();
@ -237,10 +229,8 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
if (patient.episodeNo == 0) if (patient.episodeNo == 0)
AppButton( AppButton(
loading: model.state == ViewState.BusyLocal, loading: model.state == ViewState.BusyLocal,
disabled: disabled: model.state == ViewState.BusyLocal,
model.state == ViewState.BusyLocal, title: "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
title:
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
color: isFromLiveCare || isInpatient color: isFromLiveCare || isInpatient
? AppGlobal.appRedColor ? AppGlobal.appRedColor
: patient.patientStatusType == 43 : patient.patientStatusType == 43
@ -248,8 +238,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
: AppGlobal.appRedColor, : AppGlobal.appRedColor,
fontColor: Colors.white, fontColor: Colors.white,
// vPadding: 8, // vPadding: 8,
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 9 : 6),
(SizeConfig.isHeightVeryShort ? 9 : 6),
radius: 30, radius: 30,
hPadding: 25, hPadding: 25,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -260,34 +249,24 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
height: 30, height: 30,
), ),
onPressed: () async { onPressed: () async {
if ((isFromLiveCare && if ((isFromLiveCare && patient.appointmentNo != null) || patient.patientStatusType == 43 || isInpatient) {
patient.appointmentNo != null) || createEpisode(patient: patient, model: model);
patient.patientStatusType == 43 ||
isInpatient) {
createEpisode(
patient: patient, model: model);
} }
}, },
), ),
if (patient.episodeNo != 0) if (patient.episodeNo != 0)
AppButton( AppButton(
loading: loading: model.state == ViewState.BusyLocal,
model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
disabled: title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
model.state == ViewState.BusyLocal, color: ((isInpatient) || isFromLiveCare) && model.state != ViewState.BusyLocal
title:
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
color: ((isInpatient) ||
isFromLiveCare) &&
model.state != ViewState.BusyLocal
? AppGlobal.appRedColor ? AppGlobal.appRedColor
: patient.patientStatusType == 43 : patient.patientStatusType == 43
?AppGlobal.appRedColor ? AppGlobal.appRedColor
: AppGlobal.appRedColor, : AppGlobal.appRedColor,
fontColor: Colors.white, fontColor: Colors.white,
// vPadding: 8, // vPadding: 8,
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 9 : 6),
(SizeConfig.isHeightVeryShort ? 9 : 6),
radius: 30, radius: 30,
hPadding: 25, hPadding: 25,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -298,19 +277,12 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
height: 30, height: 30,
), ),
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>() await locator<AnalyticsService>().logEvent(
.logEvent(
eventCategory: "Patient Profile ", eventCategory: "Patient Profile ",
eventAction: "Update Episode", eventAction: "Update Episode",
); );
if ((isFromLiveCare && if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || patient.patientStatusType == 43 || isInpatient) {
patient.appointmentNo != null && Navigator.of(context).pushNamed(UPDATE_EPISODE, arguments: {'patient': patient});
patient.appointmentNo != 0) ||
patient.patientStatusType == 43 ||
isInpatient) {
Navigator.of(context).pushNamed(
UPDATE_EPISODE,
arguments: {'patient': patient});
} }
}), }),
], ],
@ -342,14 +314,9 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
child: Center( child: Center(
child: AppButton( child: AppButton(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: isCallFinished color: isCallFinished ? Colors.red[600]! : AppGlobal.appGreenColor,
? Colors.red[600] title: isCallFinished ? TranslationBase.of(context).endCall : TranslationBase.of(context).initiateCall,
: AppGlobal.appGreenColor, disabled: isCallStarted || model.state == ViewState.BusyLocal,
title: isCallFinished
? TranslationBase.of(context).endCall
: TranslationBase.of(context).initiateCall,
disabled: isCallStarted ||
model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// TODO MOSA TEST // TODO MOSA TEST
// AppPermissionsUtils // AppPermissionsUtils
@ -367,50 +334,32 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) => EndCallScreen(patient: patient),
EndCallScreen(patient: patient), settings: RouteSettings(name: 'EndCallScreen'),
settings:
RouteSettings(name: 'EndCallScreen'),
), ),
); );
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.startCall( await model.startCall(isReCall: false, vCID: patient.vcId!);
isReCall: false, vCID: patient.vcId);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
await model.getDoctorProfile(); await model.getDoctorProfile();
patient.appointmentNo = int.parse(model patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString());
.startCallRes.appointmentNo
.toString());
patient.episodeNo = 0; patient.episodeNo = 0;
model.updateInCallPatient( model.updateInCallPatient(patient: patient, appointmentNo: int.parse(model.startCallRes.appointmentNo.toString()));
patient: patient,
appointmentNo: int.parse(model
.startCallRes.appointmentNo
.toString()));
setState(() { setState(() {
isCallStarted = true; isCallStarted = true;
}); });
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppPermissionsUtils AppPermissionsUtils.requestVideoCallPermission(
.requestVideoCallPermission( context: context,
context: context, onTapGrant: () {
onTapGrant: () { locator<VideoCallService>()
locator<VideoCallService>() .openVideo(model.startCallRes, patient, model.startCallRes != null ? model.startCallRes.isRecording! : true, callConnected, callDisconnected);
.openVideo( });
model.startCallRes,
patient,
model.startCallRes != null
? model.startCallRes
.isRecording
: true,
callConnected,
callDisconnected);
});
} }
} }
}, },
@ -424,29 +373,24 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
], ],
), ),
) )
: null, : SizedBox(),
), ),
); );
} }
createEpisode({PatiantInformtion patient, SOAPViewModel model}) async { createEpisode({PatiantInformtion? patient, SOAPViewModel? model}) async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
eventCategory: "Patient Profile", eventCategory: "Patient Profile",
eventAction: "Create Episode", eventAction: "Create Episode",
); );
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
if (patient.admissionNo != null && patient.admissionNo.isNotEmpty) { if (patient!.admissionNo != null && patient.admissionNo!.isNotEmpty) {
PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel(admissionNo: int.parse(patient.admissionNo!), patientID: patient.patientId);
PostEpisodeForInpatientRequestModel( await model!.postEpisodeForInPatient(postEpisodeReqModel);
admissionNo: int.parse(patient.admissionNo),
patientID: patient.patientId);
await model.postEpisodeForInPatient(postEpisodeReqModel);
} else { } else {
PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(appointmentNo: int.parse(patient.appointmentNo.toString()), patientMRN: patient.patientMRN);
appointmentNo: int.parse(patient.appointmentNo.toString()),
patientMRN: patient.patientMRN);
await model.postEpisode(postEpisodeReqModel); await model!.postEpisode(postEpisodeReqModel);
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -454,8 +398,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
patient.episodeNo = model.episodeID; patient.episodeNo = model.episodeID;
Navigator.of(context) Navigator.of(context).pushNamed(CREATE_EPISODE, arguments: {'patient': patient});
.pushNamed(CREATE_EPISODE, arguments: {'patient': patient});
} }
} }
} }
@ -469,12 +412,7 @@ class AvatarWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
boxShadow: [ boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)],
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.08),
offset: Offset(0.0, 5.0),
blurRadius: 16.0)
],
borderRadius: BorderRadius.all(Radius.circular(35.0)), borderRadius: BorderRadius.all(Radius.circular(35.0)),
color: Color(0xffCCCCCC), color: Color(0xffCCCCCC),
), ),

@ -8,102 +8,44 @@ import '../../../../routes.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class ProfileGridForInPatient extends StatelessWidget { class ProfileGridForInPatient extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion? patient;
final String patientType; final String? patientType;
final String arrivalType; final String? arrivalType;
final double height; final double? height;
final bool isInpatient; final bool isInpatient;
final bool isDischargedPatient; final bool isDischargedPatient;
final bool isFromSearch; final bool isFromSearch;
String from; String? from;
String to; String? to;
ProfileGridForInPatient( ProfileGridForInPatient(
{Key key, {Key? key, this.patient, this.patientType, this.arrivalType, this.height, this.isInpatient = false, this.from, this.to, this.isDischargedPatient = false, this.isFromSearch = false})
this.patient,
this.patientType,
this.arrivalType,
this.height,
this.isInpatient,
this.from,
this.to,
this.isDischargedPatient,
this.isFromSearch})
: super(key: key); : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [ final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).vital, TranslationBase.of(context).signs, VITAL_SIGN_DETAILS, 'assets/images/svgs/profile_screen/vital signs.svg', isInPatient: isInpatient),
TranslationBase.of(context).vital, PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).result, LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient),
TranslationBase.of(context).signs, PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).special, ALL_SPECIAL_LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg',
VITAL_SIGN_DETAILS,
'assets/images/svgs/profile_screen/vital signs.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).result,
LAB_RESULT,
'assets/images/svgs/profile_screen/lab results.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).special,
ALL_SPECIAL_LAB_RESULT,
'assets/images/svgs/profile_screen/lab results.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).result, RADIOLOGY_PATIENT, 'assets/images/svgs/profile_screen/Radiology.svg',
TranslationBase.of(context).radiology,
TranslationBase.of(context).result,
RADIOLOGY_PATIENT,
'assets/images/svgs/profile_screen/Radiology.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_OLD,
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
ORDER_PRESCRIPTION_OLD,
'assets/images/svgs/profile_screen/order prescription.svg', 'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg',
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel(TranslationBase.of(context).progress, TranslationBase.of(context).note, PROGRESS_NOTE, 'assets/images/svgs/profile_screen/Progress notes.svg',
PatientProfileCardModel( isInPatient: isInpatient, isDischargedPatient: isDischargedPatient),
TranslationBase.of(context).progress, PatientProfileCardModel(TranslationBase.of(context).order, TranslationBase.of(context).sheet, ORDER_NOTE, 'assets/images/svgs/profile_screen/order sheets.svg',
TranslationBase.of(context).note, isInPatient: isInpatient, isDischargedPatient: isDischargedPatient),
PROGRESS_NOTE, PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).procedures, ORDER_PROCEDURE, 'assets/images/svgs/profile_screen/Order Procedures.svg',
'assets/images/svgs/profile_screen/Progress notes.svg',
isInPatient: isInpatient,
isDischargedPatient: isDischargedPatient),
PatientProfileCardModel(
TranslationBase.of(context).order,
TranslationBase.of(context).sheet,
ORDER_NOTE,
'assets/images/svgs/profile_screen/order sheets.svg',
isInPatient: isInpatient,
isDischargedPatient: isDischargedPatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).procedures,
ORDER_PROCEDURE,
'assets/images/svgs/profile_screen/Order Procedures.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).health, TranslationBase.of(context).summary, HEALTH_SUMMARY, 'assets/images/svgs/profile_screen/health summary.svg',
TranslationBase.of(context).health,
TranslationBase.of(context).summary,
HEALTH_SUMMARY,
'assets/images/svgs/profile_screen/health summary.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).medical, TranslationBase.of(context).report, PATIENT_MEDICAL_REPORT, 'assets/images/svgs/profile_screen/medical report.svg',
TranslationBase.of(context).medical, isInPatient: isInpatient, isDisable: false),
TranslationBase.of(context).report,
PATIENT_MEDICAL_REPORT,
'assets/images/svgs/profile_screen/medical report.svg',
isInPatient: isInpatient,
isDisable: false),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).referral, TranslationBase.of(context).referral,
TranslationBase.of(context).patient, TranslationBase.of(context).patient,
@ -112,11 +54,7 @@ class ProfileGridForInPatient extends StatelessWidget {
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: isDischargedPatient || isFromSearch, isDisable: isDischargedPatient || isFromSearch,
), ),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).insurance, TranslationBase.of(context).approvals, PATIENT_INSURANCE_APPROVALS_NEW, 'assets/images/svgs/profile_screen/insurance approval.svg',
TranslationBase.of(context).insurance,
TranslationBase.of(context).approvals,
PATIENT_INSURANCE_APPROVALS_NEW,
'assets/images/svgs/profile_screen/insurance approval.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).discharge, TranslationBase.of(context).discharge,
@ -205,11 +143,11 @@ class ProfileGridForInPatient extends StatelessWidget {
//change the number as you want //change the number as you want
children: cardsList.map((item) { children: cardsList.map((item) {
return PatientProfileButton( return PatientProfileButton(
patient: patient, patient: patient!,
patientType: patientType, patientType: patientType!,
arrivalType: arrivalType, arrivalType: arrivalType!,
from: from, from: from!,
to: to, to: to!,
nameLine1: item.nameLine1, nameLine1: item.nameLine1,
nameLine2: item.nameLine2, nameLine2: item.nameLine2,
route: item.route, route: item.route,
@ -217,7 +155,7 @@ class ProfileGridForInPatient extends StatelessWidget {
isInPatient: item.isInPatient, isInPatient: item.isInPatient,
isDischargedPatient: item.isDischargedPatient, isDischargedPatient: item.isDischargedPatient,
isDisable: item.isDisable, isDisable: item.isDisable,
onTap: item.onTap, onTap: item.onTap!,
isLoading: item.isLoading, isLoading: item.isLoading,
); );
}).toList(), }).toList(),

@ -1,137 +1,61 @@
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../../routes.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class ProfileGridForOther extends StatelessWidget { class ProfileGridForOther extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion? patient;
final String patientType; final String? patientType;
final String arrivalType; final String? arrivalType;
final double height; final double? height;
final bool isInpatient; final bool isInpatient;
final bool isFromLiveCare; final bool isFromLiveCare;
String from; String? from;
String to; String? to;
ProfileGridForOther( ProfileGridForOther({Key? key, this.patient, this.patientType, this.arrivalType, this.height , this.isInpatient = false, this.from, this.to, this.isFromLiveCare = false}) : super(key: key);
{Key key,
this.patient,
this.patientType,
this.arrivalType,
this.height,
this.isInpatient,
this.from,
this.to,
this.isFromLiveCare})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [ final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).vital, TranslationBase.of(context).signs, VITAL_SIGN_DETAILS, 'assets/images/svgs/profile_screen/vital signs.svg', isInPatient: isInpatient),
TranslationBase.of(context).vital, PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).result, LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient),
TranslationBase.of(context).signs, PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).special, ALL_SPECIAL_LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg',
VITAL_SIGN_DETAILS,
'assets/images/svgs/profile_screen/vital signs.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).result,
LAB_RESULT,
'assets/images/svgs/profile_screen/lab results.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).special,
ALL_SPECIAL_LAB_RESULT,
'assets/images/svgs/profile_screen/lab results.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).radiology,
TranslationBase.of(context).service,
RADIOLOGY_PATIENT,
'assets/images/svgs/profile_screen/health summary.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).service, RADIOLOGY_PATIENT, 'assets/images/svgs/profile_screen/health summary.svg',
TranslationBase.of(context).orders,
TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
ORDER_PRESCRIPTION_OLD,
'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_OLD,
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'assets/images/svgs/profile_screen/order prescription.svg', 'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg',
TranslationBase.of(context).health,
TranslationBase.of(context).summary,
HEALTH_SUMMARY,
'assets/images/svgs/profile_screen/health summary.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel(TranslationBase.of(context).patient, "ECG", PatientProfileCardModel(TranslationBase.of(context).health, TranslationBase.of(context).summary, HEALTH_SUMMARY, 'assets/images/svgs/profile_screen/health summary.svg',
PATIENT_ECG, 'assets/images/svgs/profile_screen/ECG.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).patient, "ECG", PATIENT_ECG, 'assets/images/svgs/profile_screen/ECG.svg', isInPatient: isInpatient),
TranslationBase.of(context).orders, PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).procedures, ORDER_PROCEDURE, 'assets/images/svgs/profile_screen/Order Procedures.svg',
TranslationBase.of(context).procedures,
ORDER_PROCEDURE,
'assets/images/svgs/profile_screen/Order Procedures.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).insurance, TranslationBase.of(context).service, PATIENT_INSURANCE_APPROVALS_NEW, 'assets/images/svgs/profile_screen/insurance approval.svg',
TranslationBase.of(context).insurance,
TranslationBase.of(context).service,
PATIENT_INSURANCE_APPROVALS_NEW,
'assets/images/svgs/profile_screen/insurance approval.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(TranslationBase.of(context).patientSick, TranslationBase.of(context).leave, ADD_SICKLEAVE, 'assets/images/svgs/profile_screen/patient sick leave.svg',
TranslationBase.of(context).patientSick,
TranslationBase.of(context).leave,
ADD_SICKLEAVE,
'assets/images/svgs/profile_screen/patient sick leave.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
if (isFromLiveCare || if (isFromLiveCare || (patient!.appointmentNo != null && patient!.appointmentNo != 0))
(patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).ucaf, PATIENT_UCAF_REQUEST, 'assets/images/svgs/profile_screen/UCAF.svg',
PatientProfileCardModel( isInPatient: isInpatient, isDisable: isFromLiveCare ? patient!.appointmentNo == null : patient!.patientStatusType != 43 || patient!.appointmentNo == null),
TranslationBase.of(context).patient, if (isFromLiveCare || (patient!.appointmentNo != null && patient!.appointmentNo != 0))
TranslationBase.of(context).ucaf,
PATIENT_UCAF_REQUEST,
'assets/images/svgs/profile_screen/UCAF.svg',
isInPatient: isInpatient,
isDisable: isFromLiveCare
? patient.appointmentNo == null
: patient.patientStatusType != 43 ||
patient.appointmentNo == null),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).referral, TranslationBase.of(context).referral,
TranslationBase.of(context).patient, TranslationBase.of(context).patient,
REFER_PATIENT_TO_DOCTOR, REFER_PATIENT_TO_DOCTOR,
'assets/images/svgs/profile_screen/refer patient.svg', 'assets/images/svgs/profile_screen/refer patient.svg',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: isFromLiveCare isDisable: isFromLiveCare ? patient!.appointmentNo == null : patient!.patientStatusType != 43 || patient!.appointmentNo == null,
? patient.appointmentNo == null
: patient.patientStatusType != 43 ||
patient.appointmentNo == null,
), ),
if (isFromLiveCare || if (isFromLiveCare || (patient!.appointmentNo != null && patient!.appointmentNo != 0))
(patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel(TranslationBase.of(context).admission, TranslationBase.of(context).request, PATIENT_ADMISSION_REQUEST, 'assets/images/svgs/profile_screen/admission req.svg',
PatientProfileCardModel( isInPatient: isInpatient, isDisable: isFromLiveCare ? patient!.appointmentNo == null : patient!.patientStatusType != 43 || patient!.appointmentNo == null),
TranslationBase.of(context).admission,
TranslationBase.of(context).request,
PATIENT_ADMISSION_REQUEST,
'assets/images/svgs/profile_screen/admission req.svg',
isInPatient: isInpatient,
isDisable: isFromLiveCare
? patient.appointmentNo == null
: patient.patientStatusType != 43 ||
patient.appointmentNo == null),
]; ];
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15),
@ -148,11 +72,11 @@ class ProfileGridForOther extends StatelessWidget {
//change the number as you want //change the number as you want
children: cardsList.map((item) { children: cardsList.map((item) {
return PatientProfileButton( return PatientProfileButton(
patient: patient, patient: patient!,
patientType: patientType, patientType: patientType!,
arrivalType: arrivalType, arrivalType: arrivalType!,
from: from, from: from!,
to: to, to: to!,
nameLine1: item.nameLine1, nameLine1: item.nameLine1,
nameLine2: item.nameLine2, nameLine2: item.nameLine2,
route: item.route, route: item.route,
@ -160,7 +84,7 @@ class ProfileGridForOther extends StatelessWidget {
isInPatient: item.isInPatient, isInPatient: item.isInPatient,
isDischargedPatient: item.isDischargedPatient, isDischargedPatient: item.isDischargedPatient,
isDisable: item.isDisable, isDisable: item.isDisable,
onTap: item.onTap, onTap: item.onTap!,
isLoading: item.isLoading, isLoading: item.isLoading,
); );
}).toList(), }).toList(),

@ -7,21 +7,21 @@ import 'package:flutter/material.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
class ProfileGridForSearch extends StatelessWidget { class ProfileGridForSearch extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion? patient;
final String patientType; final String? patientType;
final String arrivalType; final String? arrivalType;
final double height; final double? height;
final bool isInpatient; final bool isInpatient;
String from; String? from;
String to; String? to;
ProfileGridForSearch( ProfileGridForSearch(
{Key key, {Key? key,
this.patient, this.patient,
this.patientType, this.patientType,
this.arrivalType, this.arrivalType,
this.height, this.height,
this.isInpatient, this.isInpatient = false,
this.from, this.from,
this.to}) this.to})
: super(key: key); : super(key: key);
@ -92,30 +92,30 @@ class ProfileGridForSearch extends StatelessWidget {
ADD_SICKLEAVE, ADD_SICKLEAVE,
'assets/images/svgs/profile_screen/patient sick leave.svg', 'assets/images/svgs/profile_screen/patient sick leave.svg',
isInPatient: isInpatient), isInPatient: isInpatient),
if (patient.appointmentNo != null && patient.appointmentNo != 0) if (patient!.appointmentNo != null && patient!.appointmentNo != 0)
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).patient, TranslationBase.of(context).patient,
TranslationBase.of(context).ucaf, TranslationBase.of(context).ucaf,
PATIENT_UCAF_REQUEST, PATIENT_UCAF_REQUEST,
'assets/images/svgs/profile_screen/UCAF.svg', 'assets/images/svgs/profile_screen/UCAF.svg',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false), isDisable: patient!.patientStatusType != 43 ? true : false),
if (patient.appointmentNo != null && patient.appointmentNo != 0) if (patient!.appointmentNo != null && patient!.appointmentNo != 0)
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).referral, TranslationBase.of(context).referral,
TranslationBase.of(context).patient, TranslationBase.of(context).patient,
REFER_PATIENT_TO_DOCTOR, REFER_PATIENT_TO_DOCTOR,
'assets/images/svgs/profile_screen/refer patient.svg', 'assets/images/svgs/profile_screen/refer patient.svg',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false), isDisable: patient!.patientStatusType != 43 ? true : false),
if (patient.appointmentNo != null && patient.appointmentNo != 0) if (patient!.appointmentNo != null && patient!.appointmentNo != 0)
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).admission, TranslationBase.of(context).admission,
TranslationBase.of(context).request, TranslationBase.of(context).request,
PATIENT_ADMISSION_REQUEST, PATIENT_ADMISSION_REQUEST,
'assets/images/svgs/profile_screen/admission req.svg', 'assets/images/svgs/profile_screen/admission req.svg',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false), isDisable: patient!.patientStatusType != 43 ? true : false),
]; ];
return Padding( return Padding(
@ -133,11 +133,11 @@ class ProfileGridForSearch extends StatelessWidget {
//change the number as you want //change the number as you want
children: cardsList.map((item) { children: cardsList.map((item) {
return PatientProfileButton( return PatientProfileButton(
patient: patient, patient: patient!,
patientType: patientType, patientType: patientType!,
arrivalType: arrivalType, arrivalType: arrivalType!,
from: from, from: from!,
to: to, to: to!,
nameLine1: item.nameLine1, nameLine1: item.nameLine1,
nameLine2: item.nameLine2, nameLine2: item.nameLine2,
route: item.route, route: item.route,
@ -145,7 +145,7 @@ class ProfileGridForSearch extends StatelessWidget {
isInPatient: item.isInPatient, isInPatient: item.isInPatient,
isDischargedPatient: item.isDischargedPatient, isDischargedPatient: item.isDischargedPatient,
isDisable: item.isDisable, isDisable: item.isDisable,
onTap: item.onTap, onTap: item.onTap!,
isLoading: item.isLoading, isLoading: item.isLoading,
); );
}).toList(), }).toList(),

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
@ -11,46 +12,35 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import '../../../../locator.dart';
class RadiologyDetailsPage extends StatelessWidget { class RadiologyDetailsPage extends StatelessWidget {
final FinalRadiology finalRadiology; final FinalRadiology? finalRadiology;
final PatiantInformtion patient; final PatiantInformtion? patient;
final String patientType; final String? patientType;
final String arrivalType; final String? arrivalType;
final bool isInpatient; final bool isInpatient;
RadiologyDetailsPage( RadiologyDetailsPage({Key? key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false});
{Key key,
this.finalRadiology,
this.patient,
this.patientType,
this.arrivalType,
this.isInpatient = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<RadiologyViewModel>( return BaseView<RadiologyViewModel>(
onModelReady: (model) => model.getRadImageURL( onModelReady: (model) => model.getRadImageURL(patient: patient!, projectId: finalRadiology!.projectID, lineItem: finalRadiology!.invoiceLineItemNo, invoiceNo: finalRadiology!.invoiceNo),
patient: patient,
projectId: finalRadiology.projectID,
lineItem: finalRadiology.invoiceLineItemNo,
invoiceNo: finalRadiology.invoiceNo),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient!,
appointmentDate: finalRadiology.orderDate, appointmentDate: finalRadiology!.orderDate!,
doctorName: finalRadiology.doctorName, doctorName: finalRadiology!.doctorName,
clinic: finalRadiology.clinicDescription, clinic: finalRadiology!.clinicDescription,
branch: finalRadiology.projectName, branch: finalRadiology!.projectName,
profileUrl: finalRadiology.doctorImageURL, profileUrl: finalRadiology!.doctorImageURL,
invoiceNO: finalRadiology.invoiceNo.toString(), invoiceNO: finalRadiology!.invoiceNo.toString(),
isAppointmentHeader: true, isAppointmentHeader: true,
), ),
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -78,7 +68,7 @@ class RadiologyDetailsPage extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText( child: AppText(
'${finalRadiology.reportData.trim()}', '${finalRadiology!.reportData.trim()}',
textAlign: TextAlign.start, textAlign: TextAlign.start,
isCopyable: true, isCopyable: true,
fontSize: 17, fontSize: 17,
@ -99,23 +89,22 @@ class RadiologyDetailsPage extends StatelessWidget {
height: 80, height: 80,
width: double.maxFinite, width: double.maxFinite,
child: Container( child: Container(
margin: margin: EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12),
EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12),
child: AppButton( child: AppButton(
color: Color(0xffD02127), color: Color(0xffD02127),
disabled: finalRadiology.dIAPACSURL == "", disabled: finalRadiology!.dIAPACSURL == "",
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
eventCategory: "RadiologyDetailsPage", eventCategory: "RadiologyDetailsPage",
eventAction: "Open Radiology Image", eventAction: "Open Radiology Image",
); );
launch(model.radImageURL); launchUrlString(model.radImageURL);
}, },
title: TranslationBase.of(context).openRad, title: TranslationBase.of(context).openRad,
), ),
), ),
) )
: null, : SizedBox(),
), ),
); );
} }

@ -12,12 +12,12 @@ import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrde
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; 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/shared/doctor_card.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../../widgets/shared/errors/error_message.dart';
class RadiologyHomePage extends StatefulWidget { class RadiologyHomePage extends StatefulWidget {
@override @override
@ -25,16 +25,16 @@ class RadiologyHomePage extends StatefulWidget {
} }
class _RadiologyHomePageState extends State<RadiologyHomePage> { class _RadiologyHomePageState extends State<RadiologyHomePage> {
String patientType; String? patientType;
PatiantInformtion patient; PatiantInformtion? patient;
String arrivalType; String? arrivalType;
bool isInpatient; bool isInpatient = false;
bool isFromLiveCare; bool isFromLiveCare = false;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
patientType = routeArgs['patientType']; patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType']; arrivalType = routeArgs['arrivalType'];
@ -47,14 +47,14 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getPatientRadOrders(patient, onModelReady: (model) => model.getPatientRadOrders(patient!,
patientType: patientType, isInPatient: false), patientType: patientType, isInPatient: false),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100]!,
// appBarTitle: TranslationBase.of(context).radiology, // appBarTitle: TranslationBase.of(context).radiology,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient!,
isInpatient: isInpatient, isInpatient: isInpatient,
), ),
baseViewModel: model, baseViewModel: model,
@ -67,27 +67,27 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
height: 12, height: 12,
), ),
if (model.radiologyList.isNotEmpty && if (model.radiologyList.isNotEmpty &&
patient.patientStatusType != 43) patient!.patientStatusType != 43)
ServiceTitle( ServiceTitle(
title: TranslationBase.of(context).radiology, title: TranslationBase.of(context).radiology,
subTitle: TranslationBase.of(context).result, subTitle: TranslationBase.of(context).result,
), ),
if (patient.patientStatusType != null && if (patient!.patientStatusType != null &&
patient.patientStatusType == 43) patient!.patientStatusType == 43)
ServiceTitle( ServiceTitle(
title: TranslationBase.of(context).radiology, title: TranslationBase.of(context).radiology,
subTitle: TranslationBase.of(context).result, subTitle: TranslationBase.of(context).result,
), ),
if ((patient.patientStatusType != null && if ((patient!.patientStatusType != null &&
patient.patientStatusType == 43) || patient!.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null)) (isFromLiveCare && patient!.appointmentNo != null))
AddNewOrder( AddNewOrder(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
SlideUpPageRoute( SlideUpPageRoute(
widget: BaseAddProcedureTabPage( widget: BaseAddProcedureTabPage(
patient: patient, patient: patient!,
previousProcedureViewModel: model, previousProcedureViewModel: model,
procedureType: ProcedureType.RADIOLOGY, procedureType: ProcedureType.RADIOLOGY,
), ),
@ -118,9 +118,9 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
decoration: BoxDecoration( decoration: BoxDecoration(
//Colors.red[900] Color(0xff404545) //Colors.red[900] Color(0xff404545)
color: model.radiologyList[index] color: model.radiologyList[index]
.isLiveCareAppodynamicment .isLiveCareAppodynamicment!
? Colors.red[900] ? Colors.red[900]!
: !model.radiologyList[index].isInOutPatient : !model.radiologyList[index].isInOutPatient!
? Colors.black ? Colors.black
: Color(0xffa9a089), : Color(0xffa9a089),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -142,12 +142,12 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
child: Center( child: Center(
child: Text( child: Text(
model.radiologyList[index] model.radiologyList[index]
.isLiveCareAppodynamicment .isLiveCareAppodynamicment!
? TranslationBase.of(context) ? TranslationBase.of(context)
.liveCare .liveCare
.toUpperCase() .toUpperCase()
: !model.radiologyList[index] : !model.radiologyList[index]
.isInOutPatient .isInOutPatient!
? TranslationBase.of(context) ? TranslationBase.of(context)
.inPatientLabel .inPatientLabel
.toUpperCase() .toUpperCase()
@ -173,7 +173,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
Utils.convertToTitleCase(model.radiologyList[index].clinicDescription), Utils.convertToTitleCase(model.radiologyList[index].clinicDescription),
appointmentDate: appointmentDate:
model.radiologyList[index].orderDate ?? model.radiologyList[index].orderDate ??
model.radiologyList[index].reportDate, model.radiologyList[index].reportDate!,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@ -192,7 +192,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
), ),
)), )),
if (model.radiologyList.isEmpty && if (model.radiologyList.isEmpty &&
patient.patientStatusType != 43) patient!.patientStatusType != 43)
Center( Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable, error: TranslationBase.of(context).noDataAvailable,

@ -11,7 +11,7 @@ class RadiologyReportScreen extends StatelessWidget {
final String reportData; final String reportData;
final String url; final String url;
RadiologyReportScreen({Key key, this.reportData, this.url}); RadiologyReportScreen({Key? key, required this.reportData, required this.url});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,7 +35,7 @@ class RadiologyReportScreen extends StatelessWidget {
), ),
child: AppText( child: AppText(
reportData, reportData,
fontSize: 2.5 * SizeConfig.textMultiplier, fontSize: 2.5 * SizeConfig.textMultiplier!,
), ),
), ),
SizedBox( SizedBox(

@ -28,13 +28,12 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
class PatientMakeInPatientReferralScreen extends StatefulWidget { class PatientMakeInPatientReferralScreen extends StatefulWidget {
@override @override
_PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState();
_PatientMakeInPatientReferralScreenState();
} }
class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatientReferralScreen>{ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatientReferralScreen> {
PatiantInformtion patient; PatiantInformtion? patient;
List<dynamic> referToList; List<dynamic>? referToList;
dynamic _referTo; dynamic _referTo;
dynamic _selectedBranch; dynamic _selectedBranch;
dynamic _selectedClinic; dynamic _selectedClinic;
@ -44,19 +43,17 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
final _remarksController = TextEditingController(); final _remarksController = TextEditingController();
final _extController = TextEditingController(); final _extController = TextEditingController();
int _activePriority = 1; int _activePriority = 1;
String appointmentDate; String? appointmentDate;
String branchError; String? branchError;
String hospitalError; String? hospitalError;
String clinicError; String? clinicError;
String doctorError; String? doctorError;
String frequencyError; String? frequencyError;
String remarkError; String? remarkError;
stt.SpeechToText speech = stt.SpeechToText(); stt.SpeechToText speech = stt.SpeechToText();
var recognizedWord; var recognizedWord;
var event = RobotProvider(); var event = RobotProvider();
@override @override
void initState() { void initState() {
requestPermissions(); requestPermissions();
@ -73,8 +70,7 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
onVoiceText() async { onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context); new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize( bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
onStatus: statusListener, onError: errorListener);
if (available) { if (available) {
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
@ -118,15 +114,13 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
} }
Future<void> initSpeechState() async { Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize( bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
onError: errorListener, onStatus: statusListener);
print(hasSpeech); print(hasSpeech);
if (!mounted) return; if (!mounted) return;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic priority1 = { dynamic priority1 = {
"ParameterCode": 1, "ParameterCode": 1,
"Description": TranslationBase.of(context).veryUrgent.toUpperCase(), "Description": TranslationBase.of(context).veryUrgent.toUpperCase(),
@ -145,503 +139,427 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
_priorityList.add(priority2); _priorityList.add(priority2);
_priorityList.add(priority3); _priorityList.add(priority3);
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
referToList = []; referToList = [];
dynamic sameBranch = { dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch};
"id": 1, dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch};
"name": TranslationBase.of(context).sameBranch referToList!.add(sameBranch);
}; referToList!.add(otherBranch);
dynamic otherBranch = {
"id": 2,
"name": TranslationBase.of(context).otherBranch
};
referToList.add(sameBranch);
referToList.add(otherBranch);
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<PatientReferralViewModel>( return BaseView<PatientReferralViewModel>(
onModelReady: (model) => model.getReferralFrequencyList(), onModelReady: (model) => model.getReferralFrequencyList(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient!,
isInpatient: isInpatient, isInpatient: isInpatient,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 10, height: 10,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ServiceTitle(
title: TranslationBase.of(context).refer,
subTitle: TranslationBase.of(context).patient,
), ),
), Padding(
Container( padding: const EdgeInsets.all(8.0),
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), child: ServiceTitle(
child: Column( title: TranslationBase.of(context).refer,
crossAxisAlignment: CrossAxisAlignment.start, subTitle: TranslationBase.of(context).patient,
children: [ ),
AppTextFieldCustom( ),
height: screenSize.height * 0.075, Container(
hintText: TranslationBase.of(context).branch, margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
dropDownText: child: Column(
_referTo != null ? _referTo['name'] : null, crossAxisAlignment: CrossAxisAlignment.start,
enabled: false, children: [
isTextFieldHasSuffix: true, AppTextFieldCustom(
validationError: branchError, height: screenSize.height * 0.075,
onClick: referToList != null hintText: TranslationBase.of(context).branch,
? () { dropDownText: _referTo != null ? _referTo['name'] : null,
ListSelectDialog dialog = ListSelectDialog( enabled: false,
list: referToList, isTextFieldHasSuffix: true,
attributeName: 'name', validationError: branchError!,
attributeValueId: 'id', onClick: referToList != null
okText: TranslationBase.of(context).ok, ? () {
okFunction: (selectedValue) { ListSelectDialog dialog = ListSelectDialog(
setState(() { list: referToList!,
_referTo = selectedValue; attributeName: 'name',
_selectedBranch = null; attributeValueId: 'id',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_referTo = selectedValue;
_selectedBranch = null;
_selectedClinic = null;
_selectedDoctor = null;
model.getDoctorBranch().then((value) async {
_selectedBranch = value;
if (_referTo['id'] == 1) {
GifLoaderDialogUtils.showMyDialog(context);
await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
} else {
_selectedBranch = null;
}
});
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: () {},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).hospital,
dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: hospitalError!,
onClick: model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2
? () {
ListSelectDialog dialog = ListSelectDialog(
list: model.branchesList,
attributeName: 'facilityName',
attributeValueId: 'facilityId',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) async {
_selectedBranch = selectedValue;
_selectedClinic = null; _selectedClinic = null;
_selectedDoctor = null; _selectedDoctor = null;
model GifLoaderDialogUtils.showMyDialog(context);
.getDoctorBranch() await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
.then((value) async { if (model.state == ViewState.ErrorLocal) {
_selectedBranch = value; DrAppToastMsg.showErrorToast(model.error);
if (_referTo['id'] == 1) { }
GifLoaderDialogUtils.showMyDialog( },
context); );
await model showDialog(
.getClinics(_selectedBranch[ barrierDismissible: false,
'facilityId']) context: context,
.then((_) => builder: (BuildContext context) {
GifLoaderDialogUtils return dialog;
.hideDialog(context)); },
if (model.state == );
ViewState.ErrorLocal) { }
DrAppToastMsg.showErrorToast( : () {},
model.error); ),
} SizedBox(
} else { height: 10,
_selectedBranch = null; ),
} AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).clinic,
dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: clinicError!,
onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0
? () {
ListSelectDialog dialog = ListSelectDialog(
list: model.clinicsList,
attributeName: 'ClinicDescription',
attributeValueId: 'ClinicID',
usingSearch: true,
hintSearchText: TranslationBase.of(context).clinicSearch,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) async {
_selectedDoctor = null;
_selectedClinic = selectedValue;
GifLoaderDialogUtils.showMyDialog(context);
await model.getClinicDoctors(patient!, _selectedClinic['ClinicID'], _selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: () {},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor,
dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: doctorError!,
onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0
? () {
ListSelectDialog dialog = ListSelectDialog(
list: model.doctorsList,
attributeName: 'Name',
attributeValueId: 'DoctorID',
usingSearch: true,
hintSearchText: TranslationBase.of(context).doctorSearch,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedDoctor = selectedValue;
}); });
}); },
}, );
); showDialog(
showDialog( barrierDismissible: false,
barrierDismissible: false, context: context,
context: context, builder: (BuildContext context) {
builder: (BuildContext context) { return dialog;
return dialog; },
}, );
);
}
: null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).hospital,
dropDownText: _selectedBranch != null
? _selectedBranch['facilityName']
: null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: hospitalError,
onClick: model.branchesList != null &&
model.branchesList.length > 0 &&
_referTo != null &&
_referTo['id'] == 2
? () {
ListSelectDialog dialog = ListSelectDialog(
list: model.branchesList,
attributeName: 'facilityName',
attributeValueId: 'facilityId',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) async {
_selectedBranch = selectedValue;
_selectedClinic = null;
_selectedDoctor = null;
GifLoaderDialogUtils.showMyDialog(
context);
await model
.getClinics(
_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).clinic,
dropDownText: _selectedClinic != null
? _selectedClinic['ClinicDescription']
: null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: clinicError,
onClick: _selectedBranch != null &&
model.clinicsList != null &&
model.clinicsList.length > 0
? () {
ListSelectDialog dialog = ListSelectDialog(
list: model.clinicsList,
attributeName: 'ClinicDescription',
attributeValueId: 'ClinicID',
usingSearch: true,
hintSearchText:
TranslationBase.of(context)
.clinicSearch,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) async {
_selectedDoctor = null;
_selectedClinic = selectedValue;
GifLoaderDialogUtils.showMyDialog(
context);
await model
.getClinicDoctors(
patient,
_selectedClinic['ClinicID'],
_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor,
dropDownText: _selectedDoctor != null
? _selectedDoctor['Name']
: null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: doctorError,
onClick: _selectedClinic != null &&
model.doctorsList != null &&
model.doctorsList.length > 0
? () {
ListSelectDialog dialog = ListSelectDialog(
list: model.doctorsList,
attributeName: 'Name',
attributeValueId: 'DoctorID',
usingSearch: true,
hintSearchText:
TranslationBase.of(context)
.doctorSearch,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedDoctor = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: () {
if (_selectedClinic == null) {
DrAppToastMsg.showErrorToast(
"You need to select a clinic first");
} else if (model.doctorsList == null ||
model.doctorsList.length == 0) {
DrAppToastMsg.showErrorToast(
"There is no doctors for this clinic");
} }
: () {
if (_selectedClinic == null) {
DrAppToastMsg.showErrorToast("You need to select a clinic first");
} else if (model.doctorsList == null || model.doctorsList.length == 0) {
DrAppToastMsg.showErrorToast("There is no doctors for this clinic");
}
},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).priority,
dropDownText: _selectedPriority != null ? _selectedPriority['Description'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: frequencyError!,
onClick: () {
ListSelectDialog dialog = ListSelectDialog(
list: _priorityList,
attributeName: 'Description',
attributeValueId: 'Description',
usingSearch: false,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedPriority = selectedValue;
_activePriority = selectedValue["ParameterCode"];
});
}, },
), );
SizedBox( showDialog(
height: 10, barrierDismissible: false,
), context: context,
AppTextFieldCustom( builder: (BuildContext context) {
height: screenSize.height * 0.075, return dialog;
hintText: },
TranslationBase.of(context).priority, );
dropDownText: _selectedPriority != null },
? _selectedPriority['Description']
: null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: frequencyError,
onClick: () {
ListSelectDialog dialog = ListSelectDialog(
list: _priorityList,
attributeName: 'Description',
attributeValueId: 'Description',
usingSearch: false,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedPriority = selectedValue;
_activePriority = selectedValue["ParameterCode"];
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
},
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.all(4.0),
child: AppText(
"${TranslationBase.of(context).replayBefore}: ${getPriority()}",
fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 1.9,
), ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Padding(
AppTextFieldCustom( padding: const EdgeInsets.all(4.0),
height: screenSize.height * 0.075, child: AppText(
hintText: "${TranslationBase.of(context).replayBefore}: ${getPriority()}",
TranslationBase.of(context).referralFrequency, fontWeight: FontWeight.normal,
dropDownText: _selectedFrequency != null fontSize: SizeConfig.textMultiplier! * 1.9,
? _selectedFrequency['Description']
: null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: frequencyError,
onClick: () {
ListSelectDialog dialog = ListSelectDialog(
list: model.referralFrequencyList,
attributeName: 'Description',
attributeValueId: 'ParameterCode',
usingSearch: true,
hintSearchText: TranslationBase.of(context)
.selectReferralFrequency,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedFrequency = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context).ext,
controller: _extController,
inputType: TextInputType.text,
),
SizedBox(
height: 10,
),
Stack(
children: [
AppTextFieldCustom(
validationError: remarkError,
hintText: "Remarks",
controller: _remarksController,
inputType: TextInputType.multiline,
minLines: 4,
maxLines: 6,
), ),
Positioned( ),
top: 0, SizedBox(
right: 15, height: 10,
child: IconButton( ),
icon: Icon( AppTextFieldCustom(
DoctorApp.speechtotext, height: screenSize.height * 0.075,
color: Colors.black, hintText: TranslationBase.of(context).referralFrequency,
size: 35, dropDownText: _selectedFrequency != null ? _selectedFrequency['Description'] : null,
), enabled: false,
onPressed: () { isTextFieldHasSuffix: true,
initSpeechState() validationError: frequencyError!,
.then((value) => {onVoiceText()}); onClick: () {
ListSelectDialog dialog = ListSelectDialog(
list: model.referralFrequencyList,
attributeName: 'Description',
attributeValueId: 'ParameterCode',
usingSearch: true,
hintSearchText: TranslationBase.of(context).selectReferralFrequency,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedFrequency = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
}, },
);
},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context).ext,
controller: _extController,
inputType: TextInputType.text,
),
SizedBox(
height: 10,
),
Stack(
children: [
AppTextFieldCustom(
validationError: remarkError!,
hintText: "Remarks",
controller: _remarksController,
inputType: TextInputType.multiline,
minLines: 4,
maxLines: 6,
), ),
), Positioned(
], top: 0,
), right: 15,
SizedBox( child: IconButton(
height: 100, icon: Icon(
) DoctorApp.speechtotext,
], color: Colors.black,
size: 35,
),
onPressed: () {
initSpeechState().then((value) => {onVoiceText()});
},
),
),
],
),
SizedBox(
height: 100,
)
],
),
)
],
),
Column(
children: [
_remarksController.text.isEmpty
? SizedBox()
: Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
_remarksController.text = '';
});
},
)),
SizedBox(
height: 10,
), ),
) ],
], ),
), ],
Column( ),
children: [
_remarksController.text.isEmpty
? SizedBox()
: Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
_remarksController.text = '';
});
},
)),
SizedBox(
height: 10,
),
],
),
],
), ),
), ),
), bottomSheet: model.state != ViewState.Idle
bottomSheet:
model.state != ViewState.Idle
? Container( ? Container(
height: 0, height: 0,
) )
:CustomBottomSheetContainer( : CustomBottomSheetContainer(
label: "${TranslationBase.of(context).refer}", label: "${TranslationBase.of(context).refer}",
onTap: () async { onTap: () async {
setState(() { setState(() {
if (_referTo == null) { if (_referTo == null) {
branchError = branchError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired; } else {
} else { branchError = null;
branchError = null; }
} if (_selectedBranch == null) {
if (_selectedBranch == null) { hospitalError = TranslationBase.of(context).fieldRequired;
hospitalError = } else {
TranslationBase.of(context).fieldRequired; hospitalError = null;
} else { }
hospitalError = null; if (_selectedClinic == null) {
} clinicError = TranslationBase.of(context).fieldRequired;
if (_selectedClinic == null) { } else {
clinicError = clinicError = null;
TranslationBase.of(context).fieldRequired; }
} else { if (_selectedDoctor == null) {
clinicError = null; doctorError = TranslationBase.of(context).fieldRequired;
} } else {
if (_selectedDoctor == null) { doctorError = null;
doctorError = }
TranslationBase.of(context).fieldRequired; if (_selectedFrequency == null) {
} else { frequencyError = TranslationBase.of(context).fieldRequired;
doctorError = null; } else {
} frequencyError = null;
if (_selectedFrequency == null) { }
frequencyError = if (_selectedPriority == null) {
TranslationBase.of(context).fieldRequired; remarkError = TranslationBase.of(context).fieldRequired;
} else { } else {
frequencyError = null; remarkError = null;
} }
if (_selectedPriority == null) { });
remarkError = if (_selectedFrequency == null ||
TranslationBase.of(context).fieldRequired; _selectedPriority == null ||
} else { _selectedBranch == null ||
remarkError = null; _selectedClinic == null ||
} _selectedDoctor == null ||
}); _remarksController.text == null ||
if (_selectedFrequency == null || _extController.text == null) return;
_selectedPriority == null || {
_selectedBranch == null || GifLoaderDialogUtils.showMyDialog(context);
_selectedClinic == null || await model.makeInPatientReferral(
_selectedDoctor == null || patient: patient,
_remarksController.text == null || projectID: _selectedBranch['facilityId'],
_extController.text == null) return; clinicID: _selectedClinic['ClinicID'],
{ doctorID: _selectedDoctor['DoctorID'],
GifLoaderDialogUtils.showMyDialog(context); frequencyCode: _selectedFrequency['ParameterCode'],
await model.makeInPatientReferral( ext: _extController.text,
patient: patient, remarks: _remarksController.text,
projectID: _selectedBranch['facilityId'], priority: _activePriority,
clinicID: _selectedClinic['ClinicID'], referralDate: appointmentDate,
doctorID: _selectedDoctor['DoctorID'], isLocalBusy: true);
frequencyCode: GifLoaderDialogUtils.hideDialog(context);
_selectedFrequency['ParameterCode'], if (model.state == ViewState.ErrorLocal)
ext: _extController.text, DrAppToastMsg.showErrorToast(model.error);
remarks: _remarksController.text, else {
priority: _activePriority, DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg);
referralDate: appointmentDate, Navigator.pop(context);
isLocalBusy: true); }
GifLoaderDialogUtils.hideDialog(context); }
if (model.state == ViewState.ErrorLocal) },
DrAppToastMsg.showErrorToast(model.error); )),
else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.referralSuccessMsg);
Navigator.pop(context);
}
}
},
)
),
); );
} }
@ -666,8 +584,7 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
return time; return time;
} }
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,

@ -21,24 +21,23 @@ import 'package:flutter/services.dart';
class PatientMakeReferralScreen extends StatefulWidget { class PatientMakeReferralScreen extends StatefulWidget {
// previous design page is: ReferPatientScreen // previous design page is: ReferPatientScreen
@override @override
_PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState();
_PatientMakeReferralScreenState();
} }
class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> { class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
PatiantInformtion patient; PatiantInformtion? patient;
List<dynamic> referToList; List<dynamic>? referToList;
dynamic _referTo; dynamic _referTo;
dynamic _selectedBranch; dynamic _selectedBranch;
dynamic _selectedClinic; dynamic _selectedClinic;
dynamic _selectedDoctor; dynamic _selectedDoctor;
DateTime appointmentDate; DateTime? appointmentDate;
final _remarksController = TextEditingController(); final _remarksController = TextEditingController();
String branchError = null; String branchError = '';
String hospitalError = null; String hospitalError = '';
String clinicError = null; String clinicError = '';
String doctorError = null; String doctorError = '';
@override @override
void initState() { void initState() {
@ -49,32 +48,26 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
referToList = []; referToList = [];
dynamic sameBranch = { dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch};
"id": 1, dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch};
"name": TranslationBase.of(context).sameBranch referToList!.add(sameBranch);
}; referToList!.add(otherBranch);
dynamic otherBranch = {
"id": 2,
"name": TranslationBase.of(context).otherBranch
};
referToList.add(sameBranch);
referToList.add(otherBranch);
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<PatientReferralViewModel>( return BaseView<PatientReferralViewModel>(
onModelReady: (model) => model.getPatientReferral(patient), onModelReady: (model) => model.getPatientReferral(patient!),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar(patient), appBar: PatientProfileAppBar(patient!),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
@ -93,19 +86,9 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
model.patientReferral.length == 0 model.patientReferral.length == 0
? referralForm(model, screenSize) ? referralForm(model, screenSize)
: PatientReferralItemWidget( : PatientReferralItemWidget(
referralStatus: model referralStatus: model.patientReferral[model.patientReferral.length - 1].referralStatus!,
.patientReferral[ patientName: model.patientReferral[model.patientReferral.length - 1].patientName!,
model.patientReferral.length - 1] patientGender: model.patientReferral[model.patientReferral.length - 1].patientDetails!.gender!,
.referralStatus,
patientName: model
.patientReferral[
model.patientReferral.length - 1]
.patientName,
patientGender: model
.patientReferral[
model.patientReferral.length - 1]
.patientDetails
.gender,
///TODO Elham* check this ///TODO Elham* check this
// referredDate: model // referredDate: model
@ -118,35 +101,15 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
// model.patientReferral.length - 1] // model.patientReferral.length - 1]
// .referredOn // .referredOn
// .split(" ")[1], // .split(" ")[1],
patientID: patientID: "${model.patientReferral[model.patientReferral.length - 1].patientID}",
"${model.patientReferral[model.patientReferral.length - 1].patientID}", isSameBranch: model.patientReferral[model.patientReferral.length - 1].isReferralDoctorSameBranch,
isSameBranch: model
.patientReferral[
model.patientReferral.length - 1]
.isReferralDoctorSameBranch,
isReferral: true, isReferral: true,
remark: model remark: model.patientReferral[model.patientReferral.length - 1].remarksFromSource!,
.patientReferral[ nationality: model.patientReferral[model.patientReferral.length - 1].patientDetails!.nationalityName!,
model.patientReferral.length - 1] nationalityFlag: model.patientReferral[model.patientReferral.length - 1].nationalityFlagUrl!,
.remarksFromSource, doctorAvatar: model.patientReferral[model.patientReferral.length - 1].doctorImageUrl!,
nationality: model referralDoctorName: model.patientReferral[model.patientReferral.length - 1].referredByDoctorInfo!,
.patientReferral[ clinicDescription: "",
model.patientReferral.length - 1]
.patientDetails
.nationalityName,
nationalityFlag: model
.patientReferral[
model.patientReferral.length - 1]
.nationalityFlagUrl,
doctorAvatar: model
.patientReferral[
model.patientReferral.length - 1]
.doctorImageUrl,
referralDoctorName: model
.patientReferral[
model.patientReferral.length - 1]
.referredByDoctorInfo,
clinicDescription: null,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -162,46 +125,32 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
eventAction: "Submit Refer", eventAction: "Submit Refer",
); );
if (_referTo == null) { if (_referTo == null) {
branchError = branchError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
branchError = null; branchError = "";
} }
if (_selectedBranch == null) { if (_selectedBranch == null) {
hospitalError = hospitalError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
hospitalError = null; hospitalError = "";
} }
if (_selectedClinic == null) { if (_selectedClinic == null) {
clinicError = clinicError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
clinicError = null; clinicError = "";
} }
if (_selectedDoctor == null) { if (_selectedDoctor == null) {
doctorError = doctorError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
doctorError = null; doctorError = "";
} }
if (appointmentDate == null || if (appointmentDate == null || _selectedBranch == null || _selectedClinic == null || _selectedDoctor == null || _remarksController.text == null) return;
_selectedBranch == null ||
_selectedClinic == null ||
_selectedDoctor == null ||
_remarksController.text == null) return;
model model
.makeReferral( .makeReferral(
patient, patient!, appointmentDate!.toIso8601String(), _selectedBranch['facilityId'], _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text)
appointmentDate.toIso8601String(),
_selectedBranch['facilityId'],
_selectedClinic['ClinicID'],
_selectedDoctor['DoctorID'],
_remarksController.text)
.then((_) { .then((_) {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg);
TranslationBase.of(context).referralSuccessMsg);
Navigator.pop(context); Navigator.pop(context);
}); });
}), }),
@ -229,7 +178,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
onClick: referToList != null onClick: referToList != null
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: referToList, list: referToList!,
attributeName: 'name', attributeName: 'name',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
@ -243,10 +192,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
_selectedBranch = value; _selectedBranch = value;
if (_referTo['id'] == 1) { if (_referTo['id'] == 1) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
.getClinics(_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} }
@ -265,7 +211,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}, },
); );
} }
: null, : () {},
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -273,16 +219,11 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).hospital, hintText: TranslationBase.of(context).hospital,
dropDownText: _selectedBranch != null dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null,
? _selectedBranch['facilityName']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: hospitalError, validationError: hospitalError,
onClick: model.branchesList != null && onClick: model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2
model.branchesList.length > 0 &&
_referTo != null &&
_referTo['id'] == 2
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.branchesList, list: model.branchesList,
@ -294,10 +235,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
_selectedClinic = null; _selectedClinic = null;
_selectedDoctor = null; _selectedDoctor = null;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
.getClinics(_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} }
@ -311,7 +249,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}, },
); );
} }
: null, : () {},
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -319,15 +257,11 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).clinic, hintText: TranslationBase.of(context).clinic,
dropDownText: _selectedClinic != null dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null,
? _selectedClinic['ClinicDescription']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: clinicError, validationError: clinicError,
onClick: _selectedBranch != null && onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0
model.clinicsList != null &&
model.clinicsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.clinicsList, list: model.clinicsList,
@ -340,13 +274,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
_selectedDoctor = null; _selectedDoctor = null;
_selectedClinic = selectedValue; _selectedClinic = selectedValue;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model.getClinicDoctors(patient!, _selectedClinic['ClinicID'], _selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
.getClinicDoctors(
patient,
_selectedClinic['ClinicID'],
_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} }
@ -360,7 +288,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}, },
); );
} }
: null, : () {},
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -368,14 +296,11 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor, hintText: TranslationBase.of(context).doctor,
dropDownText: dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null,
_selectedDoctor != null ? _selectedDoctor['Name'] : null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: doctorError, validationError: doctorError,
onClick: _selectedClinic != null && onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0
model.doctorsList != null &&
model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.doctorsList, list: model.doctorsList,
@ -400,12 +325,9 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
} }
: () { : () {
if (_selectedClinic == null) { if (_selectedClinic == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("You need to select a clinic first");
"You need to select a clinic first"); } else if (model.doctorsList == null || model.doctorsList.length == 0) {
} else if (model.doctorsList == null || DrAppToastMsg.showErrorToast("There is no doctors for this clinic");
model.doctorsList.length == 0) {
DrAppToastMsg.showErrorToast(
"There is no doctors for this clinic");
} }
}, },
), ),
@ -415,16 +337,16 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).date, hintText: TranslationBase.of(context).date,
dropDownText: appointmentDate != null dropDownText: appointmentDate != null ? "${AppDateUtils.convertDateToFormat(appointmentDate!, "yyyy-MM-dd")}" : "",
? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}"
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
)), ),
onPressed: () {},
),
onClick: () { onClick: () {
_selectDate(context, model); _selectDate(context, model);
}, },
@ -447,7 +369,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
_selectDate(BuildContext context, PatientReferralViewModel model) async { _selectDate(BuildContext context, PatientReferralViewModel model) async {
// https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference // https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference
// https://stackoverflow.com/a/63147062/6246772 to customize a date picker // https://stackoverflow.com/a/63147062/6246772 to customize a date picker
final DateTime picked = await showDatePicker( final DateTime? picked = await showDatePicker(
context: context, context: context,
initialDate: appointmentDate, initialDate: appointmentDate,
firstDate: DateTime.now().add(Duration(hours: 2)), firstDate: DateTime.now().add(Duration(hours: 2)),

@ -8,11 +8,11 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../../../widgets/shared/errors/error_message.dart';
class ReferredPatientScreen extends StatefulWidget { class ReferredPatientScreen extends StatefulWidget {
@override @override
@ -81,31 +81,31 @@ class _ReferredPatientScreenState extends State<ReferredPatientScreen> {
child: PatientReferralItemWidget( child: PatientReferralItemWidget(
referralStatus: model referralStatus: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referralStatusDesc, .referralStatusDesc!,
referralStatusCode: model referralStatusCode: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referralStatus, .referralStatus!,
patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
patientGender: model patientGender: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.gender, .gender!,
referredDate: model.state == ViewState.BusyLocal ?"": referredDate: model.state == ViewState.BusyLocal ?"":
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(
patientType == PatientType.IN_PATIENT? patientType == PatientType.IN_PATIENT?
AppDateUtils.getDateTimeFromServerFormat( AppDateUtils.getDateTimeFromServerFormat(
model.getReferredPatientItem(index).referralDate, model.getReferredPatientItem(index).referralDate!,
):AppDateUtils.getDateTimeFromString( ):AppDateUtils.getDateTimeFromString(
model.getReferredPatientItem(index).referralDate, model.getReferredPatientItem(index).referralDate!,
), ),
isMonthShort: true isMonthShort: true
), ),
referredTime:model.state == ViewState.BusyLocal ?"":AppDateUtils.getHour( referredTime:model.state == ViewState.BusyLocal ?"":AppDateUtils.getHour(
patientType == PatientType.IN_PATIENT? patientType == PatientType.IN_PATIENT?
AppDateUtils.getDateTimeFromServerFormat( AppDateUtils.getDateTimeFromServerFormat(
model.getReferredPatientItem(index).referralDate, model.getReferredPatientItem(index).referralDate!,
):AppDateUtils.getDateTimeFromString( ):AppDateUtils.getDateTimeFromString(
model.getReferredPatientItem(index).referralDate, model.getReferredPatientItem(index).referralDate!,
), ),
// isMonthShort: true // isMonthShort: true
), ),
@ -117,21 +117,21 @@ class _ReferredPatientScreenState extends State<ReferredPatientScreen> {
isReferral: false, isReferral: false,
remark: model remark: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referringDoctorRemarks, .referringDoctorRemarks!,
nationality: model nationality: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.nationalityName, .nationalityName!,
nationalityFlag: model nationalityFlag: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.nationalityFlagURL, .nationalityFlagURL!,
doctorAvatar: model doctorAvatar: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.doctorImageURL, .doctorImageURL!,
referralDoctorName: "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", referralDoctorName: "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}",
clinicDescription: model clinicDescription: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referralClinicDescription, .referralClinicDescription!,
infoIcon: Icon(FontAwesomeIcons.arrowRight, infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black), size: 25, color: Colors.black),
), ),
@ -176,10 +176,10 @@ class _PatientTypeRadioWidgetState extends State<PatientTypeRadioWidget> {
title: AppText(TranslationBase.of(context).inPatient), title: AppText(TranslationBase.of(context).inPatient),
value: PatientType.IN_PATIENT, value: PatientType.IN_PATIENT,
groupValue: patientType, groupValue: patientType,
onChanged: (PatientType value) { onChanged: (PatientType? value) {
setState(() { setState(() {
patientType = value; patientType = value!;
radioOnChange(value); radioOnChange(value!);
}); });
}, },
), ),
@ -189,10 +189,10 @@ class _PatientTypeRadioWidgetState extends State<PatientTypeRadioWidget> {
title: AppText(TranslationBase.of(context).outpatient), title: AppText(TranslationBase.of(context).outpatient),
value: PatientType.OUT_PATIENT, value: PatientType.OUT_PATIENT,
groupValue: patientType, groupValue: patientType,
onChanged: (PatientType value) { onChanged: (PatientType? value) {
setState(() { setState(() {
patientType = value; patientType = value!;
radioOnChange(value); radioOnChange(value!);
}); });
}, },
), ),

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dar
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/core/model/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/core/model/patient/my_referral/my_referred_patient_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
@ -15,7 +16,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../../../routes.dart';
class ReferredPatientDetailScreen extends StatelessWidget { class ReferredPatientDetailScreen extends StatelessWidget {
final MyReferredPatientModel referredPatient; final MyReferredPatientModel referredPatient;
@ -54,7 +54,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
child: AppText( child: AppText(
(Utils.capitalize( (Utils.capitalize(
"${referredPatient.firstName} ${referredPatient.lastName}")), "${referredPatient.firstName} ${referredPatient.lastName}")),
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier!! * 2.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -133,8 +133,8 @@ class ReferredPatientDetailScreen extends StatelessWidget {
AppText( AppText(
TranslationBase.of(context).viewProfile, TranslationBase.of(context).viewProfile,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Colors.red[700], color: Colors.red[700]!,
) )
], ],
), ),
@ -150,23 +150,23 @@ class ReferredPatientDetailScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ children: [
AppText( AppText(
referredPatient.referralStatusDesc, referredPatient.referralStatusDesc!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 1.9 * SizeConfig.textMultiplier, fontSize: 1.9 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: referredPatient.referralStatus == 1 color: referredPatient.referralStatus == 1
? AppGlobal.inProgressColor ? AppGlobal.inProgressColor
: referredPatient.referralStatus == 46 : referredPatient.referralStatus == 46
? AppGlobal.appGreenColor ? AppGlobal.appGreenColor
: Colors.red[700], : Colors.red[700]!,
), ),
AppText( AppText(
AppDateUtils.convertDateFromServerFormat( AppDateUtils.convertDateFromServerFormat(
referredPatient.referralDate, referredPatient.referralDate!,
"dd MMM,yyyy"), "dd MMM,yyyy"),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 2.0 * SizeConfig.textMultiplier, fontSize: 2.0 * SizeConfig.textMultiplier!,
color: Color(0XFF28353E), color: Color(0XFF28353E),
) )
], ],
@ -185,7 +185,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize:
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
@ -199,11 +199,11 @@ class ReferredPatientDetailScreen extends StatelessWidget {
), ),
AppText( AppText(
AppDateUtils.convertDateFromServerFormat( AppDateUtils.convertDateFromServerFormat(
referredPatient.referralDate, referredPatient.referralDate!,
"hh:mm a"), "hh:mm a"),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
) )
], ],
@ -225,13 +225,13 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 *
SizeConfig.textMultiplier, SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient referredPatient
.referralClinicDescription, .referralClinicDescription!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 13, fontSize: 13,
@ -256,13 +256,13 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 *
SizeConfig.textMultiplier, SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient referredPatient
.frequencyDescription, .frequencyDescription!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 14, fontSize: 14,
@ -279,12 +279,12 @@ class ReferredPatientDetailScreen extends StatelessWidget {
AppText( AppText(
referredPatient.nationalityName != referredPatient.nationalityName !=
null null
? referredPatient.nationalityName ? referredPatient.nationalityName!
: "", : "",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: fontSize:
1.4 * SizeConfig.textMultiplier, 1.4 * SizeConfig.textMultiplier!,
), ),
referredPatient.nationalityFlagURL != referredPatient.nationalityFlagURL !=
null null
@ -293,13 +293,13 @@ class ReferredPatientDetailScreen extends StatelessWidget {
BorderRadius.circular(20.0), BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referredPatient referredPatient
.nationalityFlagURL, .nationalityFlagURL!,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext errorBuilder: (BuildContext
context, context,
Object exception, Object exception,
StackTrace stackTrace) { StackTrace? stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -320,11 +320,11 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize:
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
referredPatient.priorityDescription, referredPatient.priorityDescription!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 14, fontSize: 14,
@ -345,7 +345,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize:
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
@ -355,13 +355,13 @@ class ReferredPatientDetailScreen extends StatelessWidget {
? AppDateUtils ? AppDateUtils
.convertDateFromServerFormat( .convertDateFromServerFormat(
referredPatient referredPatient
.mAXResponseTime, .mAXResponseTime!,
"dd MMM,yyyy") "dd MMM,yyyy")
: '', : '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize:
1.8 * SizeConfig.textMultiplier, 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -393,13 +393,13 @@ class ReferredPatientDetailScreen extends StatelessWidget {
borderRadius: borderRadius:
BorderRadius.circular(20.0), BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referredPatient.doctorImageURL, referredPatient.doctorImageURL!,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: errorBuilder:
(BuildContext context, (BuildContext context,
Object exception, Object exception,
StackTrace stackTrace) { StackTrace? stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -429,16 +429,16 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontSize: 1.5 * fontSize: 1.5 *
SizeConfig.textMultiplier, SizeConfig.textMultiplier!,
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
referredPatient referredPatient
.referralClinicDescription, .referralClinicDescription!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.3 * fontSize: 1.3 *
SizeConfig.textMultiplier, SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -478,14 +478,14 @@ class ReferredPatientDetailScreen extends StatelessWidget {
TranslationBase.of(context).remarks, TranslationBase.of(context).remarks,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 2.4 * SizeConfig.textMultiplier, fontSize: 2.4 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
AppText( AppText(
referredPatient.referringDoctorRemarks, referredPatient.referringDoctorRemarks!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
SizedBox( SizedBox(
@ -502,12 +502,12 @@ class ReferredPatientDetailScreen extends StatelessWidget {
? ClipRRect( ? ClipRRect(
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referredPatient.doctorImageURL, referredPatient.doctorImageURL!,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext context, errorBuilder: (BuildContext context,
Object exception, Object exception,
StackTrace stackTrace) { StackTrace? stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -528,22 +528,22 @@ class ReferredPatientDetailScreen extends StatelessWidget {
TranslationBase.of(context).reply, TranslationBase.of(context).reply,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
AppText( AppText(
referredPatient.referredDoctorRemarks == referredPatient.referredDoctorRemarks ==
null null
? '' ? ''
: referredPatient.referredDoctorRemarks : referredPatient.referredDoctorRemarks!
.isNotEmpty .isNotEmpty
? referredPatient ? referredPatient
.referredDoctorRemarks .referredDoctorRemarks!
: TranslationBase.of(context) : TranslationBase.of(context)
.notRepliedYet, .notRepliedYet,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.6 * SizeConfig.textMultiplier, fontSize: 1.6 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -561,14 +561,14 @@ class ReferredPatientDetailScreen extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: AppButton( child: AppButton(
title: TranslationBase.of(context).acknowledged, title: TranslationBase.of(context).acknowledged,
color: Colors.red[700], color: Colors.red[700]!,
fontColor: Colors.white, fontColor: Colors.white,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
hPadding: 8, hPadding: 8,
vPadding: 12, vPadding: 12,
disabled: referredPatient.referredDoctorRemarks == null disabled: referredPatient.referredDoctorRemarks == null
? true ? true
: referredPatient.referredDoctorRemarks.isNotEmpty : referredPatient.referredDoctorRemarks!.isNotEmpty
? false ? false
: true, : true,
onPressed: () async { onPressed: () async {

@ -22,16 +22,16 @@ import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:speech_to_text/speech_to_text.dart' as stt;
class AddReplayOnReferralPatient extends StatefulWidget { class AddReplayOnReferralPatient extends StatefulWidget {
final PatientReferralViewModel patientReferralViewModel; final PatientReferralViewModel? patientReferralViewModel;
final MyReferralPatientModel myReferralInPatientModel; final MyReferralPatientModel? myReferralInPatientModel;
final AddReferredRemarksRequestModel myReferralInPatientRequestModel; final AddReferredRemarksRequestModel? myReferralInPatientRequestModel;
final bool isEdited; final bool isEdited;
const AddReplayOnReferralPatient( const AddReplayOnReferralPatient(
{Key key, {Key? key,
this.patientReferralViewModel, this.patientReferralViewModel,
this.myReferralInPatientModel, this.myReferralInPatientModel,
this.isEdited, this.isEdited = false,
this.myReferralInPatientRequestModel}) this.myReferralInPatientRequestModel})
: super(key: key); : super(key: key);
@ -55,7 +55,7 @@ class _AddReplayOnReferralPatientState
requestPermissions(); requestPermissions();
super.initState(); super.initState();
replayOnReferralController.text = replayOnReferralController.text =
widget.myReferralInPatientModel.referredDoctorRemarks ?? ""; widget.myReferralInPatientModel!.referredDoctorRemarks ?? "";
} }
@override @override
@ -91,7 +91,7 @@ class _AddReplayOnReferralPatientState
.text.isEmpty && .text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context).emptyMessage
: null, : "",
), ),
Positioned( Positioned(
top: 0, top: 0,
@ -150,14 +150,14 @@ class _AddReplayOnReferralPatientState
if (replayOnReferralController.text.isNotEmpty) { if (replayOnReferralController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.patientReferralViewModel await widget.patientReferralViewModel
.replayReferred( !.replayReferred(
replayOnReferralController.text.trim(), replayOnReferralController.text.trim(),
widget.myReferralInPatientModel, widget.myReferralInPatientModel!,
reject); reject);
if (widget.patientReferralViewModel.state == if (widget.patientReferralViewModel!.state ==
ViewState.ErrorLocal) { ViewState.ErrorLocal) {
Utils.showErrorToast( Utils.showErrorToast(
widget.patientReferralViewModel.error); widget.patientReferralViewModel!.error);
} else { } else {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
@ -175,7 +175,7 @@ class _AddReplayOnReferralPatientState
}, },
title: TranslationBase.of(context).reject, title: TranslationBase.of(context).reject,
fontColor: Colors.white, fontColor: Colors.white,
color: Colors.red[600], color: Colors.red[600]!,
), ),
), ),
SizedBox( SizedBox(
@ -190,14 +190,14 @@ class _AddReplayOnReferralPatientState
if (replayOnReferralController.text.isNotEmpty) { if (replayOnReferralController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.patientReferralViewModel await widget.patientReferralViewModel
.replayReferred( !.replayReferred(
replayOnReferralController.text.trim(), replayOnReferralController.text.trim(),
widget.myReferralInPatientModel, widget.myReferralInPatientModel!,
replay); replay);
if (widget.patientReferralViewModel.state == if (widget.patientReferralViewModel!.state ==
ViewState.ErrorLocal) { ViewState.ErrorLocal) {
Utils.showErrorToast( Utils.showErrorToast(
widget.patientReferralViewModel.error); widget.patientReferralViewModel!.error);
} else { } else {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(

@ -17,10 +17,9 @@ import 'package:flutter/material.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class MyReferralDetailScreen extends StatelessWidget { class MyReferralDetailScreen extends StatelessWidget {
final MyReferralPatientModel referralPatient; final MyReferralPatientModel? referralPatient;
const MyReferralDetailScreen({Key key, this.referralPatient}) const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key);
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -55,15 +54,13 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
Expanded( Expanded(
child: AppText( child: AppText(
(Utils.capitalize(referralPatient.firstName + (Utils.capitalize(referralPatient!.firstName! + " " + referralPatient!.lastName!)),
" " + fontSize: SizeConfig.textMultiplier! * 2.5,
referralPatient.lastName)),
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
), ),
referralPatient.gender == 1 referralPatient!.gender == 1
? Icon( ? Icon(
DoctorApp.male_2, DoctorApp.male_2,
color: Colors.blue, color: Colors.blue,
@ -83,9 +80,7 @@ class MyReferralDetailScreen extends StatelessWidget {
width: 60, width: 60,
height: 60, height: 60,
child: Image.asset( child: Image.asset(
referralPatient.gender == 1 referralPatient!.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png',
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -97,140 +92,102 @@ class MyReferralDetailScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
AppText( AppText(
referralPatient.referralStatus != null referralPatient!.referralStatus != null ? model.getReferralStatusNameByCode(referralPatient!.referralStatus!, context) : "",
? model.getReferralStatusNameByCode(
referralPatient.referralStatus,
context)
: "",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 1.9 * SizeConfig.textMultiplier, fontSize: 1.9 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: referralPatient.referralStatus == 1 color: referralPatient!.referralStatus == 1
? AppGlobal.inProgressColor ? AppGlobal.inProgressColor
: referralPatient.referralStatus == : referralPatient!.referralStatus == 46 || referralPatient!.referralStatus == 2
46 ||
referralPatient
.referralStatus ==
2
? AppGlobal.appGreenColor ? AppGlobal.appGreenColor
: Colors.red[700], : Colors.red[700]!,
), ),
AppText( AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(referralPatient!.referralDate!),
referralPatient.referralDate),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 2.0 * SizeConfig.textMultiplier, fontSize: 2.0 * SizeConfig.textMultiplier!,
color: Color(0XFF28353E), color: Color(0XFF28353E),
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).fileNumber,
.fileNumber,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.7 * SizeConfig.textMultiplier!,
1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
"${referralPatient.patientID}", "${referralPatient!.patientID}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier!,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
), ),
AppText( AppText(
AppDateUtils.getTimeHHMMA( AppDateUtils.getTimeHHMMA(referralPatient!.referralDate!),
referralPatient.referralDate),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).referredFrom,
.referredFrom,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
referralPatient referralPatient!.targetProjectId == referralPatient!.sourceProjectId ? TranslationBase.of(context).sameBranch : TranslationBase.of(context).otherBranch,
.targetProjectId ==
referralPatient
.sourceProjectId
? TranslationBase.of(
context)
.sameBranch
: TranslationBase.of(
context)
.otherBranch,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * fontSize: 1.8 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).remarks + " : ",
.remarks +
" : ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referralPatient referralPatient!.referringDoctorRemarks ?? '',
.referringDoctorRemarks ??
'',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * fontSize: 1.8 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -242,29 +199,19 @@ class MyReferralDetailScreen extends StatelessWidget {
Row( Row(
children: [ children: [
AppText( AppText(
referralPatient.nationalityName != referralPatient!.nationalityName != null ? referralPatient!.nationalityName! : "",
null
? referralPatient.nationalityName
: "",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: fontSize: 1.4 * SizeConfig.textMultiplier!,
1.4 * SizeConfig.textMultiplier,
), ),
referralPatient.nationalityFlagURL != referralPatient!.nationalityFlagURL != null
null
? ClipRRect( ? ClipRRect(
borderRadius: borderRadius: BorderRadius.circular(20.0),
BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referralPatient referralPatient!.nationalityFlagURL!,
.nationalityFlagURL,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
context,
Object exception,
StackTrace stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -277,8 +224,7 @@ class MyReferralDetailScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: margin: EdgeInsets.only(left: 10, right: 0),
EdgeInsets.only(left: 10, right: 0),
child: Image.asset( child: Image.asset(
'assets/images/patient/ic_ref_arrow_up.png', 'assets/images/patient/ic_ref_arrow_up.png',
height: 50, height: 50,
@ -286,20 +232,14 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
), ),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0),
left: 0, padding: EdgeInsets.only(left: 4.0, right: 4.0),
top: 25,
right: 0,
bottom: 0),
padding: EdgeInsets.only(
left: 4.0, right: 4.0),
child: Container( child: Container(
width: 40, width: 40,
height: 40, height: 40,
child: CircleAvatar( child: CircleAvatar(
radius: 25.0, radius: 25.0,
backgroundImage: NetworkImage( backgroundImage: NetworkImage(referralPatient!.doctorImageURL!),
referralPatient.doctorImageURL),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
), ),
), ),
@ -307,19 +247,14 @@ class MyReferralDetailScreen extends StatelessWidget {
Expanded( Expanded(
flex: 4, flex: 4,
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0),
left: 10,
top: 25,
right: 10,
bottom: 0),
child: Column( child: Column(
children: [ children: [
AppText( AppText(
referralPatient.doctorName, referralPatient!.doctorName!,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -350,12 +285,11 @@ class MyReferralDetailScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: SizedBox( child: SizedBox(
child: ProfileMedicalInfoWidgetSearch( child: ProfileMedicalInfoWidgetSearch(
patient: model patient: model.getPatientFromReferralO(referralPatient!),
.getPatientFromReferralO(referralPatient),
patientType: "7", patientType: "7",
isInpatient: false, isInpatient: false,
from: null, from: "",
to: null, to: "",
), ),
), ),
), ),
@ -364,7 +298,7 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
), ),
), ),
if (referralPatient.referralStatus == 1) if (referralPatient!.referralStatus == 1)
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Row( child: Row(
@ -378,13 +312,11 @@ class MyReferralDetailScreen extends StatelessWidget {
vPadding: 12, vPadding: 12,
disabled: model.state == ViewState.Busy, disabled: model.state == ViewState.Busy,
onPressed: () async { onPressed: () async {
await model.responseReferral(referralPatient, true); await model.responseReferral(referralPatient!, true);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept);
TranslationBase.of(context)
.referralSuccessMsgAccept);
model.getMyReferralOutPatientService(); model.getMyReferralOutPatientService();
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);
@ -404,14 +336,11 @@ class MyReferralDetailScreen extends StatelessWidget {
vPadding: 12, vPadding: 12,
disabled: model.state == ViewState.Busy, disabled: model.state == ViewState.Busy,
onPressed: () async { onPressed: () async {
await model.responseReferral( await model.responseReferral(referralPatient!, false);
referralPatient, false);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject);
TranslationBase.of(context)
.referralSuccessMsgReject);
model.getMyReferralOutPatientService(); model.getMyReferralOutPatientService();
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);

@ -8,16 +8,15 @@ import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../../../widgets/shared/errors/error_message.dart';
class MyReferralInPatientScreen extends StatefulWidget { class MyReferralInPatientScreen extends StatefulWidget {
@override @override
_MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState();
_MyReferralInPatientScreenState();
} }
class _MyReferralInPatientScreenState extends State<MyReferralInPatientScreen> { class _MyReferralInPatientScreenState extends State<MyReferralInPatientScreen> {
@ -45,8 +44,7 @@ class _MyReferralInPatientScreenState extends State<MyReferralInPatientScreen> {
if (patientType == PatientType.IN_PATIENT) { if (patientType == PatientType.IN_PATIENT) {
await model.getMyReferralPatientService(localBusy: true); await model.getMyReferralPatientService(localBusy: true);
} else { } else {
await model.getMyReferralOutPatientService( await model.getMyReferralOutPatientService(localBusy: true);
localBusy: true);
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}, },
@ -73,78 +71,41 @@ class _MyReferralInPatientScreenState extends State<MyReferralInPatientScreen> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return InkWell( return InkWell(
onTap: () { onTap: () {
if (patientType == if (patientType == PatientType.OUT_PATIENT) {
PatientType.OUT_PATIENT) {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: MyReferralDetailScreen( page: MyReferralDetailScreen(referralPatient: model.myReferralPatients[index]),
referralPatient:
model.myReferralPatients[
index]),
), ),
); );
} else { } else {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ReferralPatientDetailScreen( page: ReferralPatientDetailScreen(model.myReferralPatients[index], model),
model.myReferralPatients[
index],
model),
), ),
); );
} }
}, },
child: PatientReferralItemWidget( child: PatientReferralItemWidget(
referralStatus: referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus!, context),
model.getReferralStatusNameByCode( referralStatusCode: model.myReferralPatients[index].referralStatus!,
model.myReferralPatients[index] patientName: model.myReferralPatients[index].patientName,
.referralStatus, patientGender: model.myReferralPatients[index].gender!,
context), referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate!),
referralStatusCode: model referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate!),
.myReferralPatients[index] patientID: "${model.myReferralPatients[index].patientID}",
.referralStatus,
patientName: model
.myReferralPatients[index]
.patientName,
patientGender: model
.myReferralPatients[index].gender,
referredDate: AppDateUtils
.getDayMonthYearDateFormatted(model
.myReferralPatients[index]
.referralDate),
referredTime: AppDateUtils.getTimeHHMMA(
model.myReferralPatients[index]
.referralDate),
patientID:
"${model.myReferralPatients[index].patientID}",
isSameBranch: false, isSameBranch: false,
isReferral: true, isReferral: true,
isReferralClinic: true, isReferralClinic: true,
referralClinic: referralClinic: "${model.myReferralPatients[index].referringClinicDescription}",
"${model.myReferralPatients[index].referringClinicDescription}", remark: model.myReferralPatients[index].referringDoctorRemarks!,
remark: model.myReferralPatients[index] nationality: model.myReferralPatients[index].nationalityName!,
.referringDoctorRemarks, nationalityFlag: model.myReferralPatients[index].nationalityFlagURL!,
nationality: model doctorAvatar: model.myReferralPatients[index].doctorImageURL!,
.myReferralPatients[index] referralDoctorName: model.myReferralPatients[index].referringDoctorName!,
.nationalityName, clinicDescription: model.myReferralPatients[index].referringClinicDescription!,
nationalityFlag: model infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black),
.myReferralPatients[index]
.nationalityFlagURL,
doctorAvatar: model
.myReferralPatients[index]
.doctorImageURL,
referralDoctorName: model
.myReferralPatients[index]
.referringDoctorName,
clinicDescription: model
.myReferralPatients[index]
.referringClinicDescription,
infoIcon: Icon(
FontAwesomeIcons.arrowRight,
size: 25,
color: Colors.black),
), ),
); );
}) })

@ -1,5 +1,6 @@
import 'dart:ui'; import 'dart:ui';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/refer_details/referred-patient-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/refer_details/referred-patient-screen.dart';
import 'package:doctor_app_flutter/utils/tab_utils.dart'; import 'package:doctor_app_flutter/utils/tab_utils.dart';
@ -8,7 +9,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../ReferralDischargedPatientPage.dart';
import 'my-referral-inpatient-screen.dart'; import 'my-referral-inpatient-screen.dart';
class PatientReferralScreen extends StatefulWidget { class PatientReferralScreen extends StatefulWidget {
@ -18,26 +18,26 @@ class PatientReferralScreen extends StatefulWidget {
class _PatientReferralScreen extends State<PatientReferralScreen> class _PatientReferralScreen extends State<PatientReferralScreen>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
TabController _tabController; TabController? _tabController;
int index = 0; int index = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: 3, vsync: this); _tabController = TabController(length: 3, vsync: this);
_tabController.addListener(_handleTabSelection); _tabController!.addListener(_handleTabSelection);
} }
_handleTabSelection() { _handleTabSelection() {
setState(() { setState(() {
index = _tabController.index; index = _tabController!.index;
}); });
} }
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
_tabController.dispose(); _tabController!.dispose();
} }
@override @override

@ -23,8 +23,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
final MyReferralPatientModel referredPatient; final MyReferralPatientModel referredPatient;
final PatientReferralViewModel patientReferralViewModel; final PatientReferralViewModel patientReferralViewModel;
ReferralPatientDetailScreen( ReferralPatientDetailScreen(this.referredPatient, this.patientReferralViewModel);
this.referredPatient, this.patientReferralViewModel);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -55,9 +54,8 @@ class ReferralPatientDetailScreen extends StatelessWidget {
), ),
Expanded( Expanded(
child: AppText( child: AppText(
(Utils.capitalize( (Utils.capitalize("${referredPatient.firstName} ${referredPatient.lastName}")),
"${referredPatient.firstName} ${referredPatient.lastName}")), fontSize: SizeConfig.textMultiplier! * 2.5,
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -73,18 +71,14 @@ class ReferralPatientDetailScreen extends StatelessWidget {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
PatiantInformtion patient = model PatiantInformtion patient = model.getPatientFromReferralO(referredPatient);
.getPatientFromReferralO(referredPatient); Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patient, "patient": patient,
"patientType": "1", "patientType": "1",
"isInpatient": true, "isInpatient": true,
"arrivalType": "1", "arrivalType": "1",
"from": AppDateUtils.convertDateToFormat( "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
DateTime.now(), 'yyyy-MM-dd'), "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
"to": AppDateUtils.convertDateToFormat(
DateTime.now(), 'yyyy-MM-dd'),
}); });
}, },
child: Icon( child: Icon(
@ -101,18 +95,14 @@ class ReferralPatientDetailScreen extends StatelessWidget {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
PatiantInformtion patient = model PatiantInformtion patient = model.getPatientFromReferralO(referredPatient);
.getPatientFromReferralO(referredPatient); Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patient, "patient": patient,
"patientType": "1", "patientType": "1",
"isInpatient": true, "isInpatient": true,
"arrivalType": "1", "arrivalType": "1",
"from": AppDateUtils.convertDateToFormat( "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
DateTime.now(), 'yyyy-MM-dd'), "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
"to": AppDateUtils.convertDateToFormat(
DateTime.now(), 'yyyy-MM-dd'),
}); });
}, },
child: Padding( child: Padding(
@ -121,9 +111,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
width: 60, width: 60,
height: 60, height: 60,
child: Image.asset( child: Image.asset(
referredPatient.gender == 1 referredPatient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png',
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -135,8 +123,8 @@ class ReferralPatientDetailScreen extends StatelessWidget {
AppText( AppText(
TranslationBase.of(context).viewProfile, TranslationBase.of(context).viewProfile,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Colors.red[700], color: Colors.red[700]!,
) )
], ],
), ),
@ -147,103 +135,87 @@ class ReferralPatientDetailScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
AppText( AppText(
"${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}", "${model.getReferralStatusNameByCode(referredPatient.referralStatus!, context)}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier!,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: referredPatient.referralStatus == 1 color: referredPatient.referralStatus == 1
? AppGlobal.inProgressColor ? AppGlobal.inProgressColor
: referredPatient.referralStatus == : referredPatient.referralStatus == 46 || referredPatient.referralStatus == 2
46 ||
referredPatient
.referralStatus ==
2
? AppGlobal.appGreenColor ? AppGlobal.appGreenColor
: Colors.red[700], : Colors.red[700]!,
), ),
AppText( AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(
referredPatient.referralDate, referredPatient.referralDate!,
), ),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF28353E), color: Color(0XFF28353E),
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).fileNumber,
.fileNumber,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.5 * SizeConfig.textMultiplier!,
1.5 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
"${referredPatient.patientID}", "${referredPatient.patientID}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.6 * SizeConfig.textMultiplier!,
1.6 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
), ),
AppText( AppText(
AppDateUtils.getTimeHHMMA( AppDateUtils.getTimeHHMMA(
referredPatient.referralDate, referredPatient.referralDate!,
), ),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.6 * SizeConfig.textMultiplier, fontSize: 1.6 * SizeConfig.textMultiplier!,
color: Color(0XFF575757), color: Color(0XFF575757),
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
"${TranslationBase.of(context).refClinic}: ", "${TranslationBase.of(context).refClinic}: ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.5 * fontSize: 1.5 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient referredPatient.referringClinicDescription!,
.referringClinicDescription,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.6 * fontSize: 1.6 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -251,31 +223,22 @@ class ReferralPatientDetailScreen extends StatelessWidget {
), ),
if (referredPatient.frequency != null) if (referredPatient.frequency != null)
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).frequency + ": ",
.frequency +
": ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.5 * fontSize: 1.5 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient referredPatient.frequencyDescription ?? '',
.frequencyDescription ??
'',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.6 * fontSize: 1.6 * SizeConfig.textMultiplier!,
SizeConfig
.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -287,29 +250,19 @@ class ReferralPatientDetailScreen extends StatelessWidget {
Row( Row(
children: [ children: [
AppText( AppText(
referredPatient.nationalityName != referredPatient.nationalityName != null ? referredPatient.nationalityName! : "",
null
? referredPatient.nationalityName
: "",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: fontSize: 1.4 * SizeConfig.textMultiplier!,
1.4 * SizeConfig.textMultiplier,
), ),
referredPatient.nationalityFlagURL != referredPatient.nationalityFlagURL != null
null
? ClipRRect( ? ClipRRect(
borderRadius: borderRadius: BorderRadius.circular(20.0),
BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referredPatient referredPatient.nationalityFlagURL!,
.nationalityFlagURL,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
context,
Object exception,
StackTrace stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -321,26 +274,21 @@ class ReferralPatientDetailScreen extends StatelessWidget {
if (referredPatient.priorityDescription != null) if (referredPatient.priorityDescription != null)
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context).priority + TranslationBase.of(context).priority + ": ",
": ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.5 * SizeConfig.textMultiplier!,
1.5 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient.priorityDescription ?? referredPatient.priorityDescription ?? '',
'',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.6 * SizeConfig.textMultiplier!,
1.6 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -349,33 +297,21 @@ class ReferralPatientDetailScreen extends StatelessWidget {
if (referredPatient.mAXResponseTime != null) if (referredPatient.mAXResponseTime != null)
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).maxResponseTime + ": ",
.maxResponseTime +
": ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.5 * SizeConfig.textMultiplier!,
1.5 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referredPatient.mAXResponseTime != referredPatient.mAXResponseTime != null ? AppDateUtils.convertDateFromServerFormat(referredPatient.mAXResponseTime!, "dd MMM,yyyy") : '',
null
? AppDateUtils
.convertDateFromServerFormat(
referredPatient
.mAXResponseTime,
"dd MMM,yyyy")
: '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.6 * SizeConfig.textMultiplier!,
1.6 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -385,8 +321,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: margin: EdgeInsets.only(left: 10, right: 0),
EdgeInsets.only(left: 10, right: 0),
child: Image.asset( child: Image.asset(
'assets/images/patient/ic_ref_arrow_up.png', 'assets/images/patient/ic_ref_arrow_up.png',
height: 50, height: 50,
@ -394,34 +329,22 @@ class ReferralPatientDetailScreen extends StatelessWidget {
), ),
), ),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0),
left: 0, padding: EdgeInsets.only(left: 4.0, right: 4.0),
top: 25, child: referredPatient.doctorImageURL != null
right: 0,
bottom: 0),
padding: EdgeInsets.only(
left: 4.0, right: 4.0),
child: referredPatient.doctorImageURL !=
null
? ClipRRect( ? ClipRRect(
borderRadius: borderRadius: BorderRadius.circular(20.0),
BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referredPatient.doctorImageURL, referredPatient.doctorImageURL!,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
(BuildContext context,
Object exception,
StackTrace stackTrace) {
return Text(''); return Text('');
}, },
)) ))
: Container( : Container(
child: Image.asset( child: Image.asset(
referredPatient.gender == 1 referredPatient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png',
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -429,30 +352,22 @@ class ReferralPatientDetailScreen extends StatelessWidget {
Expanded( Expanded(
flex: 4, flex: 4,
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 10, top: 30, right: 10, bottom: 0),
left: 10,
top: 30,
right: 10,
bottom: 0),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
"${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}", "${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontSize: 1.5 * fontSize: 1.5 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
referredPatient referredPatient.referringClinicDescription!,
.referringClinicDescription,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.3 * fontSize: 1.3 * SizeConfig.textMultiplier!,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -476,10 +391,8 @@ class ReferralPatientDetailScreen extends StatelessWidget {
children: [ children: [
Container( Container(
width: double.infinity, width: double.infinity,
margin: margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
EdgeInsets.symmetric(horizontal: 16, vertical: 16), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
padding:
EdgeInsets.symmetric(horizontal: 16, vertical: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -496,14 +409,14 @@ class ReferralPatientDetailScreen extends StatelessWidget {
TranslationBase.of(context).remarks, TranslationBase.of(context).remarks,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 2.4 * SizeConfig.textMultiplier, fontSize: 2.4 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
AppText( AppText(
referredPatient.referringDoctorRemarks ?? '', referredPatient.referringDoctorRemarks ?? '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
SizedBox( SizedBox(
@ -512,14 +425,11 @@ class ReferralPatientDetailScreen extends StatelessWidget {
], ],
), ),
), ),
if (referredPatient.referredDoctorRemarks != null && if (referredPatient.referredDoctorRemarks != null && referredPatient.referredDoctorRemarks!.isNotEmpty)
referredPatient.referredDoctorRemarks.isNotEmpty)
Container( Container(
width: double.infinity, width: double.infinity,
margin: margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0),
EdgeInsets.symmetric(horizontal: 16, vertical: 0), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
padding: EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -536,14 +446,14 @@ class ReferralPatientDetailScreen extends StatelessWidget {
TranslationBase.of(context).reply, TranslationBase.of(context).reply,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 2.4 * SizeConfig.textMultiplier, fontSize: 2.4 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
AppText( AppText(
referredPatient.referredDoctorRemarks ?? '', referredPatient.referredDoctorRemarks ?? '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
SizedBox( SizedBox(
@ -561,7 +471,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: AppButton( child: AppButton(
title: TranslationBase.of(context).replay, title: TranslationBase.of(context).replay,
color: Colors.red[700], color: Colors.red[700]!,
fontColor: Colors.white, fontColor: Colors.white,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
hPadding: 8, hPadding: 8,
@ -577,10 +487,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
widget: AddReplayOnReferralPatient( widget: AddReplayOnReferralPatient(
patientReferralViewModel: patientReferralViewModel, patientReferralViewModel: patientReferralViewModel,
myReferralInPatientModel: referredPatient, myReferralInPatientModel: referredPatient,
isEdited: isEdited: referredPatient.referredDoctorRemarks != null && referredPatient.referredDoctorRemarks!.isNotEmpty,
referredPatient.referredDoctorRemarks != null &&
referredPatient
.referredDoctorRemarks.isNotEmpty,
), ),
), ),
); );

@ -26,20 +26,13 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class AddAssessmentDetails extends StatefulWidget { class AddAssessmentDetails extends StatefulWidget {
final MySelectedAssessment mySelectedAssessment; final MySelectedAssessment? mySelectedAssessment;
final List<MySelectedAssessment> mySelectedAssessmentList; final List<MySelectedAssessment>? mySelectedAssessmentList;
final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate)? addSelectedAssessment;
addSelectedAssessment; final PatiantInformtion? patientInfo;
final PatiantInformtion patientInfo;
final bool isUpdate; final bool isUpdate;
AddAssessmentDetails( AddAssessmentDetails({Key? key, this.mySelectedAssessment, this.addSelectedAssessment, this.patientInfo, this.isUpdate = false, this.mySelectedAssessmentList});
{Key key,
this.mySelectedAssessment,
this.addSelectedAssessment,
this.patientInfo,
this.isUpdate = false,
this.mySelectedAssessmentList});
@override @override
_AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState();
@ -52,56 +45,36 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
TextEditingController typeController = TextEditingController(); TextEditingController typeController = TextEditingController();
TextEditingController icdNameController = TextEditingController(); TextEditingController icdNameController = TextEditingController();
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>(); GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>> key = GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
bool isFormSubmitted = false; bool isFormSubmitted = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
remarkController.text = widget.mySelectedAssessment.remark ?? ""; remarkController.text = widget.mySelectedAssessment!.remark ?? "";
appointmentIdController.text = appointmentIdController.text = widget.mySelectedAssessment!.appointmentId.toString();
widget.mySelectedAssessment.appointmentId.toString();
if (widget.isUpdate) { if (widget.isUpdate) {
if (widget.mySelectedAssessment.selectedDiagnosisCondition != null) if (widget.mySelectedAssessment!.selectedDiagnosisCondition != null)
conditionController.text = projectViewModel.isArabic conditionController.text = projectViewModel.isArabic ? widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameAr! : widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameEn!;
? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr if (widget.mySelectedAssessment!.selectedDiagnosisType != null)
: widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn; typeController.text = projectViewModel.isArabic ? widget.mySelectedAssessment!.selectedDiagnosisType!.nameAr! : widget.mySelectedAssessment!.selectedDiagnosisType!.nameEn!;
if (widget.mySelectedAssessment.selectedDiagnosisType != null) if (widget.mySelectedAssessment!.selectedICD != null) icdNameController.text = widget.mySelectedAssessment!.selectedICD!.code;
typeController.text = projectViewModel.isArabic
? widget.mySelectedAssessment.selectedDiagnosisType.nameAr
: widget.mySelectedAssessment.selectedDiagnosisType.nameEn;
if (widget.mySelectedAssessment.selectedICD != null)
icdNameController.text = widget.mySelectedAssessment.selectedICD.code;
} }
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {IconData? icon, String? validationError}) {
String hintText, String selectedText, bool isDropDown,
{IconData icon, String validationError}) {
return new InputDecoration( return new InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5),
color: (validationError != null
? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5),
color: (validationError != null
? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
disabledBorder: OutlineInputBorder( disabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5),
color: (validationError != null
? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
hintText: selectedText != null ? selectedText : hintText, hintText: selectedText != null ? selectedText : hintText,
@ -123,8 +96,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: BottomSheetTitle( appBar: BottomSheetTitle(title: TranslationBase.of(context).addAssessmentDetails),
title: TranslationBase.of(context).addAssessmentDetails),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center( child: Center(
@ -133,263 +105,196 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Container( child: Container(
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, SizedBox(
children: [ height: 16,
SizedBox( ),
height: 16, Container(
), margin: EdgeInsets.only(left: 0, right: 0, top: 15),
Container( child: AppTextFieldCustom(
margin: EdgeInsets.only(left: 0, right: 0, top: 15), // height: 55.0,
child: AppTextFieldCustom( height: Utils.getTextFieldHeight(),
// height: 55.0,
height: Utils.getTextFieldHeight(),
hintText: hintText: TranslationBase.of(context).appointmentNumber,
TranslationBase.of(context).appointmentNumber, isTextFieldHasSuffix: false,
isTextFieldHasSuffix: false, enabled: false,
enabled: false, controller: appointmentIdController,
controller: appointmentIdController, ),
), ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Container(
Container( child: InkWell(
child: InkWell( onTap: model.listOfICD10 != null
onTap: model.listOfICD10 != null
? () {
setState(() {
widget.mySelectedAssessment
.selectedICD = null;
icdNameController.text = null;
});
}
: null,
child: widget
.mySelectedAssessment.selectedICD ==
null
? CustomAutoCompleteTextField(
isShowError: isFormSubmitted &&
widget.mySelectedAssessment
.selectedICD ==
null,
child: AutoCompleteTextField<
MasterKeyModel>(
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
TranslationBase.of(context)
.nameOrICD,
null,
true,
suffixIcon: Icons.search),
itemSubmitted: (item) => setState(() {
widget.mySelectedAssessment
.selectedICD = item;
icdNameController.text =
'${item.code.trim()}/${item.description}';
}),
key: key,
suggestions: model.listOfICD10,
itemBuilder: (context, suggestion) =>
new Padding(
child: AppText(
suggestion.description +
" / " +
suggestion.code
.toString()),
padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.code
.toLowerCase()
.startsWith(
input.toLowerCase()),
),
)
: AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
onClick: model.listOfICD10 != null
? () {
setState(() {
widget.mySelectedAssessment
.selectedICD = null;
icdNameController.text = null;
});
}
: null,
hintText: TranslationBase.of(context)
.nameOrICD,
maxLines: 1,
minLines: 1,
controller: icdNameController,
enabled: true,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
)),
)),
),
if (widget.mySelectedAssessment.selectedICD != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width:
MediaQuery.of(context).size.width * 0.7,
child: AppText(
widget.mySelectedAssessment.selectedICD
.description +
(' (${widget.mySelectedAssessment.selectedICD.code} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
),
),
],
),
SizedBox(
height: 7,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
onClick: model.listOfDiagnosisCondition != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment
.selectedDiagnosisCondition,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment
.selectedDiagnosisCondition =
selectedValue;
conditionController
.text = projectViewModel
.isArabic
? widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameAr
: widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).condition,
maxLines: 1,
minLines: 1,
controller: conditionController,
isTextFieldHasSuffix: true,
enabled: false,
hasBorder: true,
validationError: isFormSubmitted &&
widget.mySelectedAssessment
.selectedDiagnosisCondition ==
null
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
onClick: model.listOfDiagnosisType != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( setState(() {
list: model.listOfDiagnosisType, widget.mySelectedAssessment!.selectedICD = null;
okText: TranslationBase.of(context).ok, icdNameController.text = "";
selectedValue: widget.mySelectedAssessment });
.selectedDiagnosisType,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment
.selectedDiagnosisType =
selectedValue;
typeController.text =
projectViewModel.isArabic
? selectedValue.nameAr
: selectedValue.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
} }
: null, : null,
hintText: TranslationBase.of(context).dType, child: widget.mySelectedAssessment!.selectedICD == null
maxLines: 1, ? CustomAutoCompleteTextField(
minLines: 1, isShowError: isFormSubmitted && widget.mySelectedAssessment!.selectedICD == null,
enabled: false, child: AutoCompleteTextField<MasterKeyModel>(
isTextFieldHasSuffix: true, decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, "", true, suffixIcon: Icons.search),
controller: typeController, itemSubmitted: (item) => setState(() {
hasBorder: true, widget.mySelectedAssessment!.selectedICD = item;
validationError: isFormSubmitted && icdNameController.text = '${item.code.trim()}/${item.description}';
widget.mySelectedAssessment }),
.selectedDiagnosisType == key: key,
null suggestions: model.listOfICD10,
? TranslationBase.of(context).emptyMessage itemBuilder: (context, suggestion) => new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString()), padding: EdgeInsets.all(8.0)),
: null, itemSorter: (a, b) => 1,
), itemFilter: (suggestion, input) =>
SizedBox( suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||
height: 10, suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||
), suggestion.code.toLowerCase().startsWith(input.toLowerCase()),
Container( ),
margin: EdgeInsets.only(left: 0, right: 0, top: 15), )
child: AppTextFieldCustom( : AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks, height: Utils.getTextFieldHeight(),
maxLines: 18, onClick: model.listOfICD10 != null
minLines: 5, ? () {
inputType: TextInputType.multiline, setState(() {
controller: remarkController, widget.mySelectedAssessment!.selectedICD = null;
onChanged: (value) { icdNameController.text = "";
widget.mySelectedAssessment.remark = });
remarkController.text; }
}, : () {},
hintText: TranslationBase.of(context).nameOrICD,
maxLines: 1,
minLines: 1,
controller: icdNameController,
enabled: true,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
),
onPressed: () {},
),
)),
),
if (widget.mySelectedAssessment!.selectedICD != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width: MediaQuery.of(context).size.width * 0.7,
child: AppText(
widget.mySelectedAssessment!.selectedICD!.description + (' (${widget.mySelectedAssessment!.selectedICD!.code} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
),
), ),
), ],
SizedBox( ),
height: SizeConfig.heightMultiplier! * SizedBox(
(SizeConfig.isHeightVeryShort height: 7,
? 20 ),
: SizeConfig.isHeightShort AppTextFieldCustom(
? 15 height: Utils.getTextFieldHeight(),
: 10), onClick: model.listOfDiagnosisCondition != null
), ? () {
])), MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment!.selectedDiagnosisCondition!,
okFunction: (MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment!.selectedDiagnosisCondition = selectedValue;
conditionController.text = projectViewModel.isArabic
? widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameAr!
: widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameEn!;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: () {},
hintText: TranslationBase.of(context).condition,
maxLines: 1,
minLines: 1,
controller: conditionController,
isTextFieldHasSuffix: true,
enabled: false,
hasBorder: true,
validationError: isFormSubmitted && widget.mySelectedAssessment!.selectedDiagnosisCondition == null ? TranslationBase.of(context).emptyMessage : "",
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
onClick: model.listOfDiagnosisType != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment!.selectedDiagnosisType!,
okFunction: (MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment!.selectedDiagnosisType = selectedValue;
typeController.text = projectViewModel.isArabic ? selectedValue.nameAr! : selectedValue.nameEn!;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: () {},
hintText: TranslationBase.of(context).dType,
maxLines: 1,
minLines: 1,
enabled: false,
isTextFieldHasSuffix: true,
controller: typeController,
hasBorder: true,
validationError: isFormSubmitted && widget.mySelectedAssessment!.selectedDiagnosisType == null ? TranslationBase.of(context).emptyMessage : "",
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(left: 0, right: 0, top: 15),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
maxLines: 18,
minLines: 5,
inputType: TextInputType.multiline,
controller: remarkController,
onChanged: (value) {
widget.mySelectedAssessment!.remark = remarkController.text;
},
),
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort
? 20
: SizeConfig.isHeightShort
? 15
: 10),
),
])),
), ),
], ],
), ),
@ -400,26 +305,17 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
height: 0, height: 0,
) )
: CustomBottomSheetContainer( : CustomBottomSheetContainer(
label: (widget.isUpdate label: (widget.isUpdate ? 'Update Assessment Details' : 'Add Assessment Details'),
? 'Update Assessment Details'
: 'Add Assessment Details'),
onTap: () async { onTap: () async {
setState(() { setState(() {
isFormSubmitted = true; isFormSubmitted = true;
}); });
widget.mySelectedAssessment.remark = remarkController.text; widget.mySelectedAssessment!.remark = remarkController.text;
widget.mySelectedAssessment.appointmentId = widget.mySelectedAssessment!.appointmentId = int.parse(appointmentIdController.text);
int.parse(appointmentIdController.text); if (widget.mySelectedAssessment!.selectedDiagnosisCondition != null &&
if (widget.mySelectedAssessment widget.mySelectedAssessment!.selectedDiagnosisType != null &&
.selectedDiagnosisCondition != widget.mySelectedAssessment!.selectedICD != null) {
null && await submitAssessment(isUpdate: widget.isUpdate, model: model, mySelectedAssessment: widget.mySelectedAssessment!);
widget.mySelectedAssessment.selectedDiagnosisType !=
null &&
widget.mySelectedAssessment.selectedICD != null) {
await submitAssessment(
isUpdate: widget.isUpdate,
model: model,
mySelectedAssessment: widget.mySelectedAssessment);
} }
}, },
), ),
@ -428,51 +324,44 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
); );
} }
submitAssessment( submitAssessment({SOAPViewModel? model, MySelectedAssessment? mySelectedAssessment, bool isUpdate = false}) async {
{SOAPViewModel model,
MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
if (isUpdate) { if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo!.patientMRN,
episodeID: widget.patientInfo.episodeNo, episodeID: widget.patientInfo!.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo!.appointmentNo,
remarks: mySelectedAssessment.remark, remarks: mySelectedAssessment!.remark,
complexDiagnosis: true, complexDiagnosis: true,
conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id,
diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id,
icdcode10Id: mySelectedAssessment.selectedICD.code, icdcode10Id: mySelectedAssessment.selectedICD!.code,
prevIcdCode10ID: mySelectedAssessment.icdCode10ID); prevIcdCode10ID: mySelectedAssessment.icdCode10ID);
await model.patchAssessment(patchAssessmentReqModel); await model!.patchAssessment(patchAssessmentReqModel);
} else { } else {
PostAssessmentRequestModel postAssessmentRequestModel = PostAssessmentRequestModel postAssessmentRequestModel =
new PostAssessmentRequestModel( new PostAssessmentRequestModel(patientMRN: widget.patientInfo!.patientMRN, episodeId: widget.patientInfo!.episodeNo, appointmentNo: widget.patientInfo!.appointmentNo, icdCodeDetails: [
patientMRN: widget.patientInfo.patientMRN, new IcdCodeDetails(
episodeId: widget.patientInfo.episodeNo, remarks: mySelectedAssessment!.remark,
appointmentNo: widget.patientInfo.appointmentNo, complexDiagnosis: true,
icdCodeDetails: [ conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id,
new IcdCodeDetails( diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id,
remarks: mySelectedAssessment.remark, icdcode10Id: mySelectedAssessment.selectedICD!.code)
complexDiagnosis: true, ]);
conditionId: mySelectedAssessment.selectedDiagnosisCondition.id,
diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id,
icdcode10Id: mySelectedAssessment.selectedICD.code)
]);
await model.postAssessment(postAssessmentRequestModel); await model!.postAssessment(postAssessmentRequestModel);
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map<String, dynamic> profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD!.code;
mySelectedAssessment.doctorName = doctorProfile.doctorName; mySelectedAssessment.doctorName = doctorProfile.doctorName;
widget.addSelectedAssessment(mySelectedAssessment, isUpdate); widget.addSelectedAssessment!(mySelectedAssessment, isUpdate);
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} }

@ -25,13 +25,13 @@ import 'assessment_call_back.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class UpdateAssessmentPage extends StatefulWidget { class UpdateAssessmentPage extends StatefulWidget {
final Function changePageViewIndex; final Function? changePageViewIndex;
final PatiantInformtion patientInfo; final PatiantInformtion? patientInfo;
final Function changeLoadingState; final Function? changeLoadingState;
final int currentIndex; final int? currentIndex;
UpdateAssessmentPage( UpdateAssessmentPage(
{Key key, {Key? key,
this.changePageViewIndex, this.changePageViewIndex,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
@ -55,7 +55,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
model.setAssessmentCallBack(this); model.setAssessmentCallBack(this);
mySelectedAssessmentList.clear(); mySelectedAssessmentList.clear();
await model.onUpdateAssessmentStepStart(widget.patientInfo); await model.onUpdateAssessmentStepStart(widget.patientInfo!);
if (model.patientAssessmentList.isNotEmpty) { if (model.patientAssessmentList.isNotEmpty) {
model.patientAssessmentList.forEach((element) { model.patientAssessmentList.forEach((element) {
@ -92,7 +92,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
}); });
} }
widget.changeLoadingState(false); widget.changeLoadingState!(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
@ -108,9 +108,9 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SOAPStepHeader( SOAPStepHeader(
currentIndex: widget.currentIndex, currentIndex: widget.currentIndex!,
changePageViewIndex: widget.changePageViewIndex, changePageViewIndex: widget.changePageViewIndex!,
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo!,
), ),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).assessment, headerTitle: TranslationBase.of(context).assessment,
@ -163,7 +163,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
), ),
new TextSpan( new TextSpan(
text: assessment text: assessment
.selectedICD.code .selectedICD!.code
.trim() .trim()
.toUpperCase() ?? .toUpperCase() ??
""), ""),
@ -180,7 +180,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
.getDayMonthYearDateFormatted( .getDayMonthYearDateFormatted(
DateTime.parse( DateTime.parse(
assessment assessment
.createdOn), isMonthShort: true) .createdOn!), isMonthShort: true)
: AppDateUtils : AppDateUtils
.getDayMonthYearDateFormatted( .getDayMonthYearDateFormatted(
DateTime.now()), DateTime.now()),
@ -194,7 +194,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
? AppDateUtils.getHour( ? AppDateUtils.getHour(
DateTime.parse( DateTime.parse(
assessment assessment
.createdOn)) .createdOn!))
: AppDateUtils.getHour( : AppDateUtils.getHour(
DateTime.now()), DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -239,7 +239,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: assessment text: assessment
.selectedICD.description .selectedICD!.description
.toString(), .toString(),
), ),
], ],
@ -309,10 +309,10 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
.isArabic .isArabic
? assessment ? assessment
.selectedDiagnosisCondition .selectedDiagnosisCondition
.nameAr !.nameAr
: assessment : assessment
.selectedDiagnosisCondition .selectedDiagnosisCondition
.nameEn, !.nameEn,
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() * .getTextMultiplierBasedOnWidth() *
@ -349,10 +349,10 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
.isArabic .isArabic
? assessment ? assessment
.selectedDiagnosisType .selectedDiagnosisType
.nameAr !.nameAr
: assessment : assessment
.selectedDiagnosisType .selectedDiagnosisType
.nameEn, !.nameEn,
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() * .getTextMultiplierBasedOnWidth() *
@ -489,10 +489,10 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
} }
openAssessmentDialog(BuildContext context, openAssessmentDialog(BuildContext context,
{MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { {MySelectedAssessment? assessment, bool isUpdate = false, SOAPViewModel? model}) {
if (assessment == null) { if (assessment == null) {
assessment = SoapUtils.generateMySelectedAssessment( assessment = SoapUtils.generateMySelectedAssessment(
remark: '', appointmentNo: widget.patientInfo.appointmentNo); remark: '', appointmentNo: widget.patientInfo!.appointmentNo);
} }
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -519,8 +519,8 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
if (mySelectedAssessmentList.isEmpty) { if (mySelectedAssessmentList.isEmpty) {
Utils.showErrorToast(TranslationBase.of(context).assessmentErrorMsg); Utils.showErrorToast(TranslationBase.of(context).assessmentErrorMsg);
} else { } else {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
widget.changePageViewIndex(3); widget.changePageViewIndex!(3);
} }
} }
} }

@ -9,13 +9,12 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'examinations_list_search_widget.dart'; import 'examinations_list_search_widget.dart';
class AddExaminationPage extends StatefulWidget { class AddExaminationPage extends StatefulWidget {
final List<MySelectedExamination> mySelectedExamination; final List<MySelectedExamination>? mySelectedExamination;
final Function(List<MySelectedExamination>) addSelectedExamination; final Function(List<MySelectedExamination>)? addSelectedExamination;
final Function(MasterKeyModel) removeExamination; final Function(MasterKeyModel)? removeExamination;
AddExaminationPage( AddExaminationPage(
{this.mySelectedExamination, {this.mySelectedExamination,
@ -27,12 +26,12 @@ class AddExaminationPage extends StatefulWidget {
} }
class _AddExaminationPageState extends State<AddExaminationPage> { class _AddExaminationPageState extends State<AddExaminationPage> {
List<MySelectedExamination> mySelectedExaminationLocal; List<MySelectedExamination> mySelectedExaminationLocal = [];
@override @override
initState() { initState() {
super.initState(); super.initState();
mySelectedExaminationLocal = [...widget.mySelectedExamination]; mySelectedExaminationLocal = [...?widget.mySelectedExamination];
} }
@override @override
@ -73,7 +72,7 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
children: [ children: [
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
mySelectedExamination: mySelectedExamination:
widget.mySelectedExamination, widget.mySelectedExamination!,
masterList: model.physicalExaminationList, masterList: model.physicalExaminationList,
isServiceSelected: (master) => isServiceSelected: (master) =>
isServiceSelected(master), isServiceSelected(master),
@ -106,7 +105,7 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
label: "${TranslationBase.of(context).addExamination}", label: "${TranslationBase.of(context).addExamination}",
onTap: () { onTap: () {
widget widget
.addSelectedExamination(mySelectedExaminationLocal); .addSelectedExamination!(mySelectedExaminationLocal);
}, },
), ),
)); ));
@ -115,8 +114,8 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = mySelectedExaminationLocal.where( Iterable<MySelectedExamination> exam = mySelectedExaminationLocal.where(
(element) => (element) =>
masterKey.id == element.selectedExamination.id && masterKey.id == element.selectedExamination!.id &&
masterKey.typeId == element.selectedExamination.typeId); masterKey.typeId == element.selectedExamination!.typeId);
if (exam.length > 0) { if (exam.length > 0) {
return true; return true;
} }

@ -13,20 +13,21 @@ import 'package:provider/provider.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class AddExaminationWidget extends StatefulWidget { class AddExaminationWidget extends StatefulWidget {
MasterKeyModel item; MasterKeyModel? item;
final Function(MySelectedExamination) removeExamination; final Function(MySelectedExamination)? removeExamination;
final Function(MySelectedExamination) addExamination; final Function(MySelectedExamination)? addExamination;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel)? isServiceSelected;
bool isExpand; bool isExpand;
final Function expandClick;
final List<MySelectedExamination> mySelectedExamination; final Function? expandClick;
final List<MySelectedExamination>? mySelectedExamination;
AddExaminationWidget({ AddExaminationWidget({
this.item, this.item,
this.removeExamination, this.removeExamination,
this.addExamination, this.addExamination,
this.isServiceSelected, this.isServiceSelected,
this.isExpand, this.isExpand = false,
this.expandClick, this.expandClick,
this.mySelectedExamination, this.mySelectedExamination,
}); });
@ -42,14 +43,14 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
@override @override
void initState() { void initState() {
if (getSelectedExam(widget.item) != null) { if (getSelectedExam(widget.item!) != null) {
examination = getSelectedExam(widget.item); examination = getSelectedExam(widget.item!);
status = examination.isNormal status = examination.isNormal!
? 1 ? 1
: examination.isAbnormal : examination.isAbnormal!
? 2 ? 2
: 3; : 3;
remarksController.text = examination.remark; remarksController.text = examination.remark!;
} else { } else {
examination.selectedExamination = widget.item; examination.selectedExamination = widget.item;
} }
@ -72,22 +73,20 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: widget.isServiceSelected(widget.item), value: widget.isServiceSelected!(widget.item!),
activeColor: Colors.red[800], activeColor: Colors.red[800],
onChanged: (bool newValue) { onChanged: (bool? newValue) {
onExamTap(); onExamTap();
}), }),
Container( Container(
child: AppText( child: AppText(
projectViewModel.isArabic projectViewModel.isArabic
? widget.item.nameAr != null && ? widget.item!.nameAr != null && widget.item!.nameAr != ""
widget.item.nameAr != "" ? widget.item!.nameAr!
? widget.item.nameAr : widget.item!.nameEn!
: widget.item.nameEn : widget.item!.nameEn!,
: widget.item.nameEn,
color: Color(0xFF575757), color: Color(0xFF575757),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8),
(SizeConfig.isWidthLarge ? 3 : 3.8),
letterSpacing: -0.56, letterSpacing: -0.56,
), ),
), ),
@ -97,10 +96,9 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 8), margin: EdgeInsets.symmetric(horizontal: 8),
child: InkWell( child: InkWell(
onTap: widget.expandClick, onTap: widget.expandClick!(),
child: Icon(widget.isExpand child: Icon(widget.isExpand! ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down),
? Icons.keyboard_arrow_up ),
: Icons.keyboard_arrow_down)),
), ),
], ],
), ),
@ -115,7 +113,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
TranslationBase.of(context).status, TranslationBase.of(context).status,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
), ),
Row( Row(
@ -144,9 +142,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: status == 1 color: status == 1 ? HexColor("#D02127") : Colors.white,
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
), ),
@ -155,7 +151,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
TranslationBase.of(context).normal, TranslationBase.of(context).normal,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
], ],
), ),
@ -184,9 +180,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: status == 2 color: status == 2 ? HexColor("#D02127") : Colors.white,
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
), ),
@ -195,7 +189,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
TranslationBase.of(context).abnormal, TranslationBase.of(context).abnormal,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
], ],
), ),
@ -225,9 +219,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: status == 3 color: status == 3 ? HexColor("#D02127") : Colors.white,
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
), ),
@ -237,7 +229,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
TranslationBase.of(context).notExamined, TranslationBase.of(context).notExamined,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
), ),
], ],
@ -268,28 +260,25 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
onExamTap() { onExamTap() {
setState(() { setState(() {
if (widget.isServiceSelected(widget.item)) { if (widget.isServiceSelected!(widget.item!)) {
if (examination.isLocal) widget.removeExamination(examination); if (examination.isLocal) widget.removeExamination!(examination);
widget.expandClick(); widget.expandClick!();
} else { } else {
examination.isNormal = status == 1; examination.isNormal = status == 1;
examination.isAbnormal = status == 2; examination.isAbnormal = status == 2;
examination.notExamined = status == 3; examination.notExamined = status == 3;
examination.remark = remarksController.text; examination.remark = remarksController.text;
widget.addExamination(examination); widget.addExamination!(examination);
widget.expandClick(); widget.expandClick!();
} }
}); });
} }
MySelectedExamination getSelectedExam(MasterKeyModel masterKey) { MySelectedExamination getSelectedExam(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = widget.mySelectedExamination.where( Iterable<MySelectedExamination> exam = widget.mySelectedExamination!.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId);
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (exam.length > 0) { if (exam.length > 0) {
return exam.first; return exam.first;
} }
return null; return MySelectedExamination();
} }
} }

@ -32,15 +32,15 @@ class ExaminationItemCard extends StatelessWidget {
child: Container( child: Container(
child: AppText( child: AppText(
projectViewModel.isArabic projectViewModel.isArabic
? examination.selectedExamination.nameAr != null && ? examination.selectedExamination!.nameAr != null &&
examination.selectedExamination.nameAr != "" examination.selectedExamination!.nameAr != ""
? examination.selectedExamination.nameAr ? examination.selectedExamination!.nameAr!
: examination.selectedExamination.nameEn : examination.selectedExamination!.nameEn!
: examination.selectedExamination.nameEn, : examination.selectedExamination!.nameEn!,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
), ),
)), )),
], ],
@ -61,7 +61,7 @@ class ExaminationItemCard extends StatelessWidget {
? Colors.red.shade800 ? Colors.red.shade800
: Colors.grey.shade800 : Colors.grey.shade800
: AppGlobal.appGreenColor, : AppGlobal.appGreenColor,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
), ),
if (!examination.notExamined) if (!examination.notExamined)
RemoveButton( RemoveButton(
@ -75,8 +75,8 @@ class ExaminationItemCard extends StatelessWidget {
SizedBox( SizedBox(
height: 4, height: 4,
), ),
if (examination.remark.isNotEmpty) if (examination.remark!.isNotEmpty)
RemarkText(remark: examination.remark), RemarkText(remark: examination.remark!),
], ],
), ),
); );

@ -9,11 +9,11 @@ import 'package:flutter/material.dart';
import 'add_examination_widget.dart'; import 'add_examination_widget.dart';
class ExaminationsListSearchWidget extends StatefulWidget { class ExaminationsListSearchWidget extends StatefulWidget {
final Function(MySelectedExamination) removeExamination; final Function(MySelectedExamination)? removeExamination;
final Function(MySelectedExamination) addExamination; final Function(MySelectedExamination)? addExamination;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel)? isServiceSelected;
final List<MasterKeyModel> masterList; final List<MasterKeyModel>? masterList;
final List<MySelectedExamination> mySelectedExamination; final List<MySelectedExamination>? mySelectedExamination;
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
{this.removeExamination, {this.removeExamination,
@ -35,7 +35,7 @@ class _ExaminationsListSearchWidgetState
@override @override
void initState() { void initState() {
items.addAll(widget.masterList); items.addAll(widget.masterList as Iterable<MasterKeyModel>);
super.initState(); super.initState();
} }
@ -56,7 +56,7 @@ class _ExaminationsListSearchWidgetState
icon: Icon( icon: Icon(
Icons.search, Icons.search,
color: Colors.black, color: Colors.black,
)), ), onPressed: () { },),
), ),
DividerWithSpacesAround( DividerWithSpacesAround(
height: 2, height: 2,
@ -86,12 +86,12 @@ class _ExaminationsListSearchWidgetState
void filterSearchResults(String query) { void filterSearchResults(String query) {
List<MasterKeyModel> dummySearchList = []; List<MasterKeyModel> dummySearchList = [];
dummySearchList.addAll(widget.masterList); dummySearchList.addAll(widget.masterList as Iterable<MasterKeyModel>);
if (query.isNotEmpty) { if (query.isNotEmpty) {
List<MasterKeyModel> dummyListData = []; List<MasterKeyModel> dummyListData = [];
dummySearchList.forEach((item) { dummySearchList.forEach((item) {
if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) ||
item.nameEn.toLowerCase().contains(query.toLowerCase())) { item.nameEn!.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item); dummyListData.add(item);
} }
}); });
@ -103,7 +103,7 @@ class _ExaminationsListSearchWidgetState
} else { } else {
setState(() { setState(() {
items.clear(); items.clear();
items.addAll(widget.masterList); items.addAll(widget.masterList as Iterable<MasterKeyModel>);
}); });
} }
} }

@ -26,29 +26,22 @@ import 'examination_item_card.dart';
import 'objective_call_back.dart'; import 'objective_call_back.dart';
class UpdateObjectivePage extends StatefulWidget { class UpdateObjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function? changePageViewIndex;
final Function changeLoadingState; final Function? changeLoadingState;
final int currentIndex; final int currentIndex;
final PatiantInformtion patientInfo; final PatiantInformtion? patientInfo;
UpdateObjectivePage( UpdateObjectivePage({Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex = 0});
{Key key,
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@override @override
_UpdateObjectivePageState createState() => _UpdateObjectivePageState(); _UpdateObjectivePageState createState() => _UpdateObjectivePageState();
} }
class _UpdateObjectivePageState extends State<UpdateObjectivePage> class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements ObjectiveCallBack {
implements ObjectiveCallBack {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = []; List<MySelectedExamination> mySelectedExamination = [];
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -67,7 +60,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
model.setObjectiveCallBack(this); model.setObjectiveCallBack(this);
mySelectedExamination.clear(); mySelectedExamination.clear();
model.isAddExamInProgress = true; model.isAddExamInProgress = true;
await model.getPatientPhysicalExam(widget.patientInfo); await model.getPatientPhysicalExam(widget.patientInfo!);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model.getMasterLookup(MasterKeysService.PhysicalExamination);
@ -77,8 +70,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
masterKeys: MasterKeysService.PhysicalExamination, masterKeys: MasterKeysService.PhysicalExamination,
id: element.examId, id: element.examId,
); );
MySelectedExamination tempEam = MySelectedExamination tempEam = SoapUtils.generateMySelectedExamination(
SoapUtils.generateMySelectedExamination(
examination: examMaster, examination: examMaster,
remark: element.remarks, remark: element.remarks,
isNormal: element.isNormal, isNormal: element.isNormal,
@ -93,7 +85,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
mySelectedExamination.add(tempEam); mySelectedExamination.add(tempEam);
}); });
} }
widget.changeLoadingState(false); widget.changeLoadingState!(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
@ -109,12 +101,11 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
children: [ children: [
SOAPStepHeader( SOAPStepHeader(
currentIndex: widget.currentIndex, currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex, changePageViewIndex: widget.changePageViewIndex!,
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo!,
), ),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: headerTitle: TranslationBase.of(context).physicalSystemExamination,
TranslationBase.of(context).physicalSystemExamination,
onTap: () { onTap: () {
setState(() { setState(() {
isSysExaminationExpand = !isSysExaminationExpand; isSysExaminationExpand = !isSysExaminationExpand;
@ -123,14 +114,12 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
child: Column( child: Column(
children: [ children: [
SOAPOpenItems( SOAPOpenItems(
label: label: "${TranslationBase.of(context).addExamination}",
"${TranslationBase.of(context).addExamination}",
onTap: () { onTap: () {
openExaminationList(context); openExaminationList(context);
}, },
), ),
if (mySelectedExamination.isNotEmpty && if (mySelectedExamination.isNotEmpty && mySelectedExamination.first.isLocal)
mySelectedExamination.first.isLocal)
Row( Row(
children: [ children: [
AppText( AppText(
@ -143,25 +132,14 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
), ),
Column( Column(
children: mySelectedExamination children: mySelectedExamination
.sublist( .sublist(0, model.getFirstIndexForOldExamination(mySelectedExamination) == -1 ? 0 : model.getFirstIndexForOldExamination(mySelectedExamination))
0,
model.getFirstIndexForOldExamination(
mySelectedExamination) ==
-1
? 0
: model.getFirstIndexForOldExamination(
mySelectedExamination))
.map((examination) { .map((examination) {
return ExaminationItemCard(examination, () { return ExaminationItemCard(examination, () {
removeExamination( removeExamination(examination.selectedExamination!);
examination.selectedExamination);
}); });
}).toList(), }).toList(),
), ),
if (mySelectedExamination.isNotEmpty && if (mySelectedExamination.isNotEmpty && model.getFirstIndexForOldExamination(mySelectedExamination) > -1)
model.getFirstIndexForOldExamination(
mySelectedExamination) >
-1)
Row( Row(
children: [ children: [
AppText( AppText(
@ -174,16 +152,10 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
), ),
Column( Column(
children: mySelectedExamination children: mySelectedExamination
.sublist(model.getFirstIndexForOldExamination( .sublist(model.getFirstIndexForOldExamination(mySelectedExamination) == -1 ? 0 : model.getFirstIndexForOldExamination(mySelectedExamination))
mySelectedExamination) ==
-1
? 0
: model.getFirstIndexForOldExamination(
mySelectedExamination))
.map((examination) { .map((examination) {
return ExaminationItemCard(examination, () { return ExaminationItemCard(examination, () {
removeExamination( removeExamination(examination.selectedExamination!);
examination.selectedExamination);
}); });
}).toList(), }).toList(),
) )
@ -192,8 +164,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
isExpanded: isSysExaminationExpand, isExpanded: isSysExaminationExpand,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 14 : 12),
(SizeConfig.isHeightVeryShort ? 14 : 12),
) )
], ],
), ),
@ -206,40 +177,27 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
submitUpdateObjectivePage(SOAPViewModel model) async { submitUpdateObjectivePage(SOAPViewModel model) async {
if (mySelectedExamination.isNotEmpty) { if (mySelectedExamination.isNotEmpty) {
if (!model.isAddExamInProgress && if (!model.isAddExamInProgress && widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) {
widget.patientInfo.admissionNo != null &&
widget.patientInfo.admissionNo.isNotEmpty) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map<String, dynamic> profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostPhysicalExamRequestModel postPhysicalExamRequestModel = PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
new PostPhysicalExamRequestModel();
mySelectedExamination.forEach((exam) { mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = [];
.listHisProgNotePhysicalExaminationVM == ListHisProgNotePhysicalExaminationVM listHisProgNotePhysicalExaminationVM = ListHisProgNotePhysicalExaminationVM(
null) patientMRN: widget.patientInfo!.patientMRN,
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = episodeId: widget.patientInfo!.episodeNo == null ? 0 : widget.patientInfo!.episodeNo,
[]; appointmentNo: widget.patientInfo!.appointmentNo == null ? 0 : widget.patientInfo!.appointmentNo,
ListHisProgNotePhysicalExaminationVM
listHisProgNotePhysicalExaminationVM =
ListHisProgNotePhysicalExaminationVM(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo == null
? 0
: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo == null
? 0
: widget.patientInfo.appointmentNo,
remarks: exam.remark ?? '', remarks: exam.remark ?? '',
createdBy: exam.createdBy ?? doctorProfile.doctorID, createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID, editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(), editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id, examId: exam.selectedExamination!.id,
examType: exam.selectedExamination.typeId, examType: exam.selectedExamination!.typeId,
isAbnormal: exam.isAbnormal, isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal, isNormal: exam.isNormal,
notExamined: exam.notExamined, notExamined: exam.notExamined,
@ -255,15 +213,12 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
: "Not Examined", : "Not Examined",
isNew: exam.isNew, isNew: exam.isNew,
); );
if (widget.patientInfo.admissionNo != null && if (widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) {
widget.patientInfo.admissionNo.isNotEmpty) { listHisProgNotePhysicalExaminationVM.admissionNo = int.parse(widget.patientInfo!.admissionNo!);
listHisProgNotePhysicalExaminationVM.admissionNo =
int.parse(widget.patientInfo.admissionNo);
} else { } else {
listHisProgNotePhysicalExaminationVM.admissionNo = 0; listHisProgNotePhysicalExaminationVM.admissionNo = 0;
} }
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM!.add(listHisProgNotePhysicalExaminationVM);
.add(listHisProgNotePhysicalExaminationVM);
}); });
if (model.patientPhysicalExamList.isEmpty) { if (model.patientPhysicalExamList.isEmpty) {
@ -273,22 +228,20 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
} }
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
widget.changeLoadingState(false); widget.changeLoadingState!(false);
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
if (widget.patientInfo.admissionNo != null && if (widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) {
widget.patientInfo.admissionNo.isNotEmpty) {
// Navigator.of(context).pop(); // Navigator.of(context).pop();
model.isAddExamInProgress = false; model.isAddExamInProgress = false;
} }
} else { } else {
if (widget.patientInfo.admissionNo != null && if (widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) {
widget.patientInfo.admissionNo.isNotEmpty) {
// Navigator.of(context).pop(); // Navigator.of(context).pop();
widget.changeLoadingState(false); widget.changeLoadingState!(false);
model.isAddExamInProgress = false; model.isAddExamInProgress = false;
} else { } else {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
widget.changePageViewIndex(2); widget.changePageViewIndex!(2);
} }
} }
} }
@ -298,10 +251,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
} }
removeExamination(MasterKeyModel masterKey) { removeExamination(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> history = mySelectedExamination.where( Iterable<MySelectedExamination> history = mySelectedExamination.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId);
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0) { if (history.length > 0) {
setState(() { setState(() {
@ -322,16 +272,16 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
FadePage( FadePage(
page: AddExaminationPage( page: AddExaminationPage(
mySelectedExamination: mySelectedExamination, mySelectedExamination: mySelectedExamination,
addSelectedExamination: addSelectedExamination: (List<MySelectedExamination> mySelectedExaminationLocal) {
(List<MySelectedExamination> mySelectedExaminationLocal) {
setState(() { setState(() {
{ {
mySelectedExaminationLocal.forEach((element) { mySelectedExaminationLocal.forEach((element) {
if ((mySelectedExamination.singleWhere( if ((
(it) => mySelectedExamination.singleWhere(
it.selectedExamination.id == (it) => it.selectedExamination!.id == element.selectedExamination!.id,
element.selectedExamination.id, orElse: () => MySelectedExamination(),
orElse: () => null)) == ),
) ==
null) { null) {
mySelectedExamination.insert(0, element); mySelectedExamination.insert(0, element);
} }
@ -340,18 +290,13 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
/// remove items. /// remove items.
List<MySelectedExamination> removedList = []; List<MySelectedExamination> removedList = [];
mySelectedExamination.forEach((element) { mySelectedExamination.forEach((element) {
if ((mySelectedExaminationLocal.singleWhere( if ((mySelectedExaminationLocal.singleWhere((it) => it.selectedExamination!.id == element.selectedExamination!.id, orElse: () => MySelectedExamination())) == null) {
(it) =>
it.selectedExamination.id ==
element.selectedExamination.id,
orElse: () => null)) ==
null) {
removedList.add(element); removedList.add(element);
} }
}); });
removedList.forEach((element) { removedList.forEach((element) {
removeExamination(element.selectedExamination); removeExamination(element.selectedExamination!);
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
} }

@ -22,16 +22,16 @@ import '../shared_soap_widgets/SOAP_step_header.dart';
import '../shared_soap_widgets/expandable_SOAP_widget.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart';
class UpdatePlanPage extends StatefulWidget { class UpdatePlanPage extends StatefulWidget {
final Function changePageViewIndex; final Function? changePageViewIndex;
final PatiantInformtion patientInfo; final PatiantInformtion? patientInfo;
final Function changeLoadingState; final Function? changeLoadingState;
final Function changeStateFun; final Function? changeStateFun;
final SOAPViewModel sOAPViewModel; final SOAPViewModel? sOAPViewModel;
final int currentIndex; final int? currentIndex;
UpdatePlanPage( UpdatePlanPage(
{Key key, {Key? key,
this.changePageViewIndex, this.changePageViewIndex,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
@ -81,34 +81,34 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel getGetProgressNoteReqModel =
GetProgressNoteReqModel( GetProgressNoteReqModel(
appointmentNo: appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()), int.parse(widget.patientInfo!.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo!.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo!.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await widget.sOAPViewModel await widget.sOAPViewModel
.getPatientProgressNote(getGetProgressNoteReqModel); !.getPatientProgressNote(getGetProgressNoteReqModel);
///TODO set progressNote in model; ///TODO set progressNote in model;
if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Utils.parseHtmlString( progressNoteController.text = Utils.parseHtmlString(
widget.sOAPViewModel.patientProgressNoteList[0].planNote); widget.sOAPViewModel!.patientProgressNoteList[0].planNote!);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
widget.sOAPViewModel.patientProgressNoteList[0].createdByName; widget.sOAPViewModel!.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
widget.sOAPViewModel.patientProgressNoteList[0].createdOn; widget.sOAPViewModel!.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn = patientProgressNote.editedOn =
widget.sOAPViewModel.patientProgressNoteList[0].editedOn; widget.sOAPViewModel!.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName = patientProgressNote.editedByName =
widget.sOAPViewModel.patientProgressNoteList[0].editedByName; widget.sOAPViewModel!.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo = patientProgressNote.appointmentNo =
widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = isAddProgress; isAddProgress = isAddProgress;
widget.sOAPViewModel.isAddProgress = isAddProgress; widget.sOAPViewModel!.isAddProgress = isAddProgress;
widget.sOAPViewModel.progressNoteText = progressNoteController.text; widget.sOAPViewModel!.progressNoteText = progressNoteController.text;
}); });
} }
} }
@ -117,40 +117,40 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.sOAPViewModel.setPlanCallBack(this); widget.sOAPViewModel!.setPlanCallBack(this);
GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel getGetProgressNoteReqModel =
GetProgressNoteReqModel( GetProgressNoteReqModel(
appointmentNo: appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()), int.parse(widget.patientInfo!.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo!.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo!.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await widget.sOAPViewModel await widget.sOAPViewModel
.getPatientProgressNote(getGetProgressNoteReqModel); !.getPatientProgressNote(getGetProgressNoteReqModel);
if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Utils.parseHtmlString( progressNoteController.text = Utils.parseHtmlString(
widget.sOAPViewModel.patientProgressNoteList[0].planNote); widget.sOAPViewModel!.patientProgressNoteList[0].planNote!);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
widget.sOAPViewModel.patientProgressNoteList[0].createdByName; widget.sOAPViewModel!.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
widget.sOAPViewModel.patientProgressNoteList[0].createdOn; widget.sOAPViewModel!.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn = patientProgressNote.editedOn =
widget.sOAPViewModel.patientProgressNoteList[0].editedOn; widget.sOAPViewModel!.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName = patientProgressNote.editedByName =
widget.sOAPViewModel.patientProgressNoteList[0].editedByName; widget.sOAPViewModel!.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo = patientProgressNote.appointmentNo =
widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo;
widget.sOAPViewModel.progressNoteText = progressNoteController.text; widget.sOAPViewModel!.progressNoteText = progressNoteController.text;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
widget.sOAPViewModel.isAddProgress = false; widget.sOAPViewModel!.isAddProgress = false;
}); });
} }
widget.changeLoadingState(false); widget.changeLoadingState!(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
@ -163,9 +163,9 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
child: Column( child: Column(
children: [ children: [
SOAPStepHeader( SOAPStepHeader(
currentIndex: widget.currentIndex, currentIndex: widget.currentIndex!,
changePageViewIndex: widget.changePageViewIndex, changePageViewIndex: widget.changePageViewIndex!,
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo!,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -199,7 +199,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
patientProgressNote.planNote = patientProgressNote.planNote =
value; value;
model.progressNoteText = value; model.progressNoteText = value;
widget.changeStateFun(); widget.changeStateFun!();
}); });
}, },
), ),
@ -258,7 +258,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
.getDayMonthYearDateFormatted( .getDayMonthYearDateFormatted(
DateTime.parse( DateTime.parse(
patientProgressNote patientProgressNote
.createdOn)) .createdOn!))
: AppDateUtils : AppDateUtils
.getDayMonthYearDateFormatted( .getDayMonthYearDateFormatted(
DateTime.now()), DateTime.now()),
@ -293,7 +293,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
? AppDateUtils.getHour( ? AppDateUtils.getHour(
DateTime.parse( DateTime.parse(
patientProgressNote patientProgressNote
.createdOn)) .createdOn!))
: AppDateUtils.getHour( : AppDateUtils.getHour(
DateTime.now()), DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -322,7 +322,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
setState(() { setState(() {
isAddProgress = true; isAddProgress = true;
widget.sOAPViewModel widget.sOAPViewModel
.isAddProgress = true; !.isAddProgress = true;
}); });
}, },
child: Icon( child: Icon(
@ -354,62 +354,62 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
submitPlan(SOAPViewModel model) async { submitPlan(SOAPViewModel model) async {
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
PostProgressNoteRequestModel postProgressNoteRequestModel = PostProgressNoteRequestModel postProgressNoteRequestModel =
new PostProgressNoteRequestModel( new PostProgressNoteRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo!.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo!.episodeNo!,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo!.appointmentNo,
planNote: patientProgressNote.planNote, planNote: patientProgressNote.planNote,
doctorID: '', doctorID: '',
editedBy: ''); editedBy: '');
if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { if (widget.sOAPViewModel!.patientProgressNoteList.isEmpty) {
await widget.sOAPViewModel await widget.sOAPViewModel
.postProgressNote(postProgressNoteRequestModel); ! .postProgressNote(postProgressNoteRequestModel);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map<String, dynamic> profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; postProgressNoteRequestModel.editedBy = doctorProfile.doctorID;
await widget.sOAPViewModel await widget.sOAPViewModel
.patchProgressNote(postProgressNoteRequestModel); !.patchProgressNote(postProgressNoteRequestModel);
} }
if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { if (widget.sOAPViewModel!.state == ViewState.ErrorLocal) {
Utils.showErrorToast(widget.sOAPViewModel.error); Utils.showErrorToast(widget.sOAPViewModel!.error);
} else { } else {
GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel getGetProgressNoteReqModel =
GetProgressNoteReqModel( GetProgressNoteReqModel(
appointmentNo: appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()), int.parse(widget.patientInfo!.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo!.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo!.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await widget.sOAPViewModel await widget.sOAPViewModel
.getPatientProgressNote(getGetProgressNoteReqModel); !.getPatientProgressNote(getGetProgressNoteReqModel);
if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Utils.parseHtmlString( progressNoteController.text = Utils.parseHtmlString(
widget.sOAPViewModel.patientProgressNoteList[0].planNote); widget.sOAPViewModel!.patientProgressNoteList[0].planNote!);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
widget.sOAPViewModel.patientProgressNoteList[0].createdByName; widget.sOAPViewModel!.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
widget.sOAPViewModel.patientProgressNoteList[0].createdOn; widget.sOAPViewModel!.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn = patientProgressNote.editedOn =
widget.sOAPViewModel.patientProgressNoteList[0].editedOn; widget.sOAPViewModel!.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName = patientProgressNote.editedByName =
widget.sOAPViewModel.patientProgressNoteList[0].editedByName; widget.sOAPViewModel!.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo = patientProgressNote.appointmentNo =
widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
widget.sOAPViewModel.isAddProgress = false; widget.sOAPViewModel!.isAddProgress = false;
}); });
} }
} }
widget.changeLoadingState(false); widget.changeLoadingState!(false);
} else { } else {
Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
} }

@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SOAPOpenItems extends StatelessWidget { class SOAPOpenItems extends StatelessWidget {
final Function onTap; final Function? onTap;
final String label; final String label;
const SOAPOpenItems({Key key, this.onTap, this.label}) : super(key: key); const SOAPOpenItems({Key? key, this.onTap, this.label = ''}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: onTap, onTap: onTap!(),
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8.0), padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8.0),
margin: EdgeInsets.symmetric(vertical: 8), margin: EdgeInsets.symmetric(vertical: 8),

@ -7,15 +7,15 @@ import 'package:flutter/material.dart';
class SOAPStepHeader extends StatelessWidget { class SOAPStepHeader extends StatelessWidget {
const SOAPStepHeader({ const SOAPStepHeader({
Key key, Key? key,
this.currentIndex, this.currentIndex,
this.changePageViewIndex, this.changePageViewIndex,
this.patientInfo, this.patientInfo,
}) : super(key: key); }) : super(key: key);
final int currentIndex; final int? currentIndex;
final Function changePageViewIndex; final Function? changePageViewIndex;
final PatiantInformtion patientInfo; final PatiantInformtion? patientInfo;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,16 +32,14 @@ class SOAPStepHeader extends StatelessWidget {
), ),
AppText( AppText(
TranslationBase.of(context).createNew, TranslationBase.of(context).createNew,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 4),
(SizeConfig.isWidthLarge ? 3 : 4),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: -0.72, letterSpacing: -0.72,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
TranslationBase.of(context).episode, TranslationBase.of(context).episode,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 6 : 8),
(SizeConfig.isWidthLarge ? 6 : 8),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
letterSpacing: -1.44, letterSpacing: -1.44,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
@ -49,14 +47,13 @@ class SOAPStepHeader extends StatelessWidget {
Container( Container(
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).scaffoldBackgroundColor,
child: StepsWidget( child: StepsWidget(
index: currentIndex, index: currentIndex ?? 0,
changeCurrentTab: changePageViewIndex, changeCurrentTab: changePageViewIndex,
patientInfo: patientInfo, patientInfo: patientInfo,
), ),
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 1 : 2),
(SizeConfig.isHeightVeryShort ? 1 : 2),
), ),
], ],
); );

@ -2,10 +2,10 @@ import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { class BottomSheetTitle extends StatelessWidget {
BottomSheetTitle({ BottomSheetTitle({
Key key, Key? key,
this.title, this.title = '',
}) : super(key: key); }) : super(key: key);
final String title; final String title;

@ -8,25 +8,17 @@ import 'package:hexcolor/hexcolor.dart';
class ExpandableSOAPWidget extends StatelessWidget { class ExpandableSOAPWidget extends StatelessWidget {
final bool isExpanded; final bool isExpanded;
final Widget child; final Widget? child;
final Function onTap; final Function? onTap;
final headerTitle; final headerTitle;
final bool isRequired; final bool isRequired;
const ExpandableSOAPWidget( const ExpandableSOAPWidget({Key? key, this.isExpanded = false, this.child, this.onTap, this.headerTitle, this.isRequired = true}) : super(key: key);
{Key key,
this.isExpanded,
this.child,
this.onTap,
this.headerTitle,
this.isRequired = true})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: SizeConfig.isHeightVeryShort ? 10 : 20, horizontal: 10),
vertical: SizeConfig.isHeightVeryShort ? 10 : 20, horizontal: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
@ -36,12 +28,12 @@ class ExpandableSOAPWidget extends StatelessWidget {
), ),
child: HeaderBodyExpandableNotifier( child: HeaderBodyExpandableNotifier(
headerWidget: InkWell( headerWidget: InkWell(
onTap: onTap, onTap: onTap!(),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( InkWell(
onTap: onTap, onTap: onTap!(),
child: Row( child: Row(
children: [ children: [
AppText( AppText(
@ -66,15 +58,13 @@ class ExpandableSOAPWidget extends StatelessWidget {
), ),
), ),
InkWell( InkWell(
onTap: onTap, onTap: onTap!(),
child: Icon(isExpanded child: Icon(isExpanded ? EvaIcons.arrowIosUpwardOutline : EvaIcons.arrowIosDownwardOutline),
? EvaIcons.arrowIosUpwardOutline
: EvaIcons.arrowIosDownwardOutline),
) )
], ],
), ),
), ),
bodyWidget: child, bodyWidget: child!,
isExpand: isExpanded, isExpand: isExpanded,
), ),
); );

@ -5,8 +5,8 @@ class RemarkText extends StatelessWidget {
final String remark; final String remark;
const RemarkText({ const RemarkText({
Key key, Key? key,
this.remark, this.remark = '',
}) : super(key: key); }) : super(key: key);
@override @override

@ -6,10 +6,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
class RemoveButton extends StatelessWidget { class RemoveButton extends StatelessWidget {
final Function onTap; final Function? onTap;
final String label; final String label;
const RemoveButton({Key key, this.onTap, this.label}) : super(key: key); const RemoveButton({Key? key, this.onTap, this.label = ''}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,7 +32,7 @@ class RemoveButton extends StatelessWidget {
), ),
], ],
), ),
onTap: onTap, onTap: onTap!(),
); );
} }
} }

@ -7,8 +7,8 @@ class StepDetailsWidget extends StatelessWidget {
final double marginLeft; final double marginLeft;
const StepDetailsWidget({ const StepDetailsWidget({
Key key, Key? key,
this.stepLabel, this.stepLabel = '',
this.marginLeft = 0, this.marginLeft = 0,
}) : super(key: key); }) : super(key: key);

@ -1,16 +1,15 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../../../../../config/config.dart';
class StatusLabel extends StatelessWidget { class StatusLabel extends StatelessWidget {
const StatusLabel({ const StatusLabel({
Key key, Key? key,
this.stepId, this.stepId = 0,
this.selectedStepId, this.selectedStepId = 0,
}) : super(key: key); }) : super(key: key);
final int stepId; final int stepId;

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; 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/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
@ -7,21 +8,15 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../../../../config/config.dart';
import 'Step_details_widget.dart'; import 'Step_details_widget.dart';
class StepsWidget extends StatelessWidget { class StepsWidget extends StatelessWidget {
final int index; final int index;
final Function changeCurrentTab; final Function? changeCurrentTab;
final double height; final double height;
final PatiantInformtion patientInfo; final PatiantInformtion? patientInfo;
StepsWidget( StepsWidget({Key? key, this.index = 0, this.changeCurrentTab, this.height = 0.0, this.patientInfo});
{Key key,
this.index,
this.changeCurrentTab,
this.height = 0.0,
this.patientInfo});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,8 +31,7 @@ class StepsWidget extends StatelessWidget {
: SizeConfig.isHeightShort : SizeConfig.isHeightShort
? 10 ? 10
: 10); : 10);
double containerHeight = double containerHeight = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : 15);
SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : 15);
return !projectViewModel.isArabic return !projectViewModel.isArabic
? Stack( ? Stack(
@ -51,11 +45,7 @@ class StepsWidget extends StatelessWidget {
top: 30, top: 30,
child: Center( child: Center(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * width: MediaQuery.of(context).size.width * (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? 0.9 : 0.85),
(patientInfo.admissionNo == null ||
patientInfo.admissionNo.isEmpty
? 0.9
: 0.85),
child: Divider( child: Divider(
color: Colors.grey, color: Colors.grey,
height: 0.75, height: 0.75,
@ -68,7 +58,7 @@ class StepsWidget extends StatelessWidget {
top: circleTop, top: circleTop,
left: 0, left: 0,
child: InkWell( child: InkWell(
onTap: () => changeCurrentTab(0), onTap: () => changeCurrentTab!(0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -80,8 +70,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 0 : index > 0
? null ? null
: Border.all( : Border.all(color: Colors.black, width: 0.75),
color: Colors.black, width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 0 color: index == 0
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -115,12 +104,9 @@ class StepsWidget extends StatelessWidget {
), ),
Positioned( Positioned(
top: circleTop, top: circleTop,
left: patientInfo.admissionNo == null || left: patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? MediaQuery.of(context).size.width * 0.25 : MediaQuery.of(context).size.width * 0.71,
patientInfo.admissionNo.isEmpty
? MediaQuery.of(context).size.width * 0.25
: MediaQuery.of(context).size.width * 0.71,
child: InkWell( child: InkWell(
onTap: () => index >= 1 ? changeCurrentTab(1) : null, onTap: () => index >= 1 ? changeCurrentTab!(1) : null,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -132,8 +118,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 2 : index > 2
? null ? null
: Border.all( : Border.all(color: Color(0xFFCCCCCC), width: 0.75),
color: Color(0xFFCCCCCC), width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 1 color: index == 1
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -167,14 +152,13 @@ class StepsWidget extends StatelessWidget {
), ),
), ),
), ),
if (patientInfo.admissionNo == null || if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty)
patientInfo.admissionNo.isEmpty)
Positioned( Positioned(
top: circleTop, top: circleTop,
left: MediaQuery.of(context).size.width * 0.47, left: MediaQuery.of(context).size.width * 0.47,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
if (index >= 3) changeCurrentTab(2); if (index >= 3) changeCurrentTab!(2);
}, },
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -187,8 +171,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 2 : index > 2
? null ? null
: Border.all( : Border.all(color: Color(0xFFCCCCCC), width: 0.75),
color: Color(0xFFCCCCCC), width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 2 color: index == 2
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -222,13 +205,12 @@ class StepsWidget extends StatelessWidget {
), ),
), ),
), ),
if (patientInfo.admissionNo == null || if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty)
patientInfo.admissionNo.isEmpty)
Positioned( Positioned(
top: circleTop, top: circleTop,
right: 0, right: 0,
child: InkWell( child: InkWell(
onTap: () => index >= 3 ? changeCurrentTab(4) : null, onTap: () => index >= 3 ? changeCurrentTab!(4) : null,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
@ -240,8 +222,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 3 : index > 3
? null ? null
: Border.all( : Border.all(color: Color(0xFFCCCCCC), width: 0.75),
color: Color(0xFFCCCCCC), width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 3 color: index == 3
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -289,11 +270,7 @@ class StepsWidget extends StatelessWidget {
top: 30, top: 30,
child: Center( child: Center(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * width: MediaQuery.of(context).size.width * (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? 0.9 : 0.85),
(patientInfo.admissionNo == null ||
patientInfo.admissionNo.isEmpty
? 0.9
: 0.85),
child: Divider( child: Divider(
color: Colors.grey, color: Colors.grey,
height: 0.75, height: 0.75,
@ -306,7 +283,7 @@ class StepsWidget extends StatelessWidget {
top: circleTop, top: circleTop,
right: 0, right: 0,
child: InkWell( child: InkWell(
onTap: () => changeCurrentTab(0), onTap: () => changeCurrentTab!(0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -318,8 +295,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 0 : index > 0
? null ? null
: Border.all( : Border.all(color: Colors.black, width: 0.75),
color: Colors.black, width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 0 color: index == 0
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -352,13 +328,9 @@ class StepsWidget extends StatelessWidget {
), ),
Positioned( Positioned(
top: circleTop, top: circleTop,
right: MediaQuery.of(context).size.width * right: MediaQuery.of(context).size.width * (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? 0.25 : 0.71),
(patientInfo.admissionNo == null ||
patientInfo.admissionNo.isEmpty
? 0.25
: 0.71),
child: InkWell( child: InkWell(
onTap: () => index >= 2 ? changeCurrentTab(1) : null, onTap: () => index >= 2 ? changeCurrentTab!(1) : null,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -370,8 +342,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 2 : index > 2
? null ? null
: Border.all( : Border.all(color: Color(0xFFCCCCCC), width: 0.75),
color: Color(0xFFCCCCCC), width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 1 color: index == 1
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -402,13 +373,12 @@ class StepsWidget extends StatelessWidget {
), ),
), ),
), ),
if (patientInfo.admissionNo == null || if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty)
patientInfo.admissionNo.isEmpty)
Positioned( Positioned(
top: circleTop, top: circleTop,
right: MediaQuery.of(context).size.width * 0.50, right: MediaQuery.of(context).size.width * 0.50,
child: InkWell( child: InkWell(
onTap: () => index >= 3 ? changeCurrentTab(2) : null, onTap: () => index >= 3 ? changeCurrentTab!(2) : null,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -420,8 +390,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 2 : index > 2
? null ? null
: Border.all( : Border.all(color: Color(0xFFCCCCCC), width: 0.75),
color: Color(0xFFCCCCCC), width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 2 color: index == 2
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
@ -457,13 +426,12 @@ class StepsWidget extends StatelessWidget {
), ),
), ),
), ),
if (patientInfo.admissionNo == null || if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty)
patientInfo.admissionNo.isEmpty)
Positioned( Positioned(
top: circleTop, top: circleTop,
left: 0, left: 0,
child: InkWell( child: InkWell(
onTap: () => index >= 3 ? changeCurrentTab(4) : null, onTap: () => index >= 3 ? changeCurrentTab!(4) : null,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
@ -475,8 +443,7 @@ class StepsWidget extends StatelessWidget {
? Border.all(color: Color(0xFFCC9B14), width: 2) ? Border.all(color: Color(0xFFCC9B14), width: 2)
: index > 3 : index > 3
? null ? null
: Border.all( : Border.all(color: Color(0xFFCCCCCC), width: 0.75),
color: Color(0xFFCCCCCC), width: 0.75),
shape: BoxShape.circle, shape: BoxShape.circle,
color: index == 3 color: index == 3
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)

@ -20,7 +20,7 @@ class SoapUtils {
isChecked = false, isChecked = false,
remark, remark,
isLocal = true, isLocal = true,
int createdBy, int? createdBy,
bool isExpanded = false}) { bool isExpanded = false}) {
MySelectedAllergy mySelectedAllergy = MySelectedAllergy( MySelectedAllergy mySelectedAllergy = MySelectedAllergy(
selectedAllergy: allergy, selectedAllergy: allergy,

@ -16,25 +16,24 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart';
import 'master_key_checkbox_search_allergies_widget.dart'; import 'master_key_checkbox_search_allergies_widget.dart';
class AddAllergies extends StatefulWidget { class AddAllergies extends StatefulWidget {
final Function addAllergiesFun; final Function? addAllergiesFun;
final List<MySelectedAllergy> myAllergiesList; final List<MySelectedAllergy>? myAllergiesList;
const AddAllergies({Key key, this.addAllergiesFun, this.myAllergiesList}) const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList}) : super(key: key);
: super(key: key);
@override @override
_AddAllergiesState createState() => _AddAllergiesState(); _AddAllergiesState createState() => _AddAllergiesState();
} }
class _AddAllergiesState extends State<AddAllergies> { class _AddAllergiesState extends State<AddAllergies> {
List<MasterKeyModel> allergiesList; List<MasterKeyModel> allergiesList = [];
List<MasterKeyModel> allergySeverityList; List<MasterKeyModel> allergySeverityList = [];
List<MySelectedAllergy> myAllergiesListLocal; List<MySelectedAllergy> myAllergiesListLocal = [];
@override @override
initState() { initState() {
super.initState(); super.initState();
myAllergiesListLocal = [...widget.myAllergiesList]; myAllergiesListLocal = [...?widget.myAllergiesList];
} }
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>(); GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
@ -61,54 +60,48 @@ class _AddAllergiesState extends State<AddAllergies> {
), ),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, SizedBox(
children: [ height: 10,
SizedBox( ),
height: 10, SizedBox(
), height: 16,
SizedBox( ),
height: 16, Expanded(
), child: Center(
Expanded( child: FractionallySizedBox(
widthFactor: 0.9,
child: Center( child: Center(
child: FractionallySizedBox( child: NetworkBaseView(
widthFactor: 0.9, baseViewModel: model,
child: Center( child: MasterKeyCheckboxSearchAllergiesWidget(
child: NetworkBaseView( model: model,
baseViewModel: model, masterList: model.allergiesList,
child: MasterKeyCheckboxSearchAllergiesWidget( removeAllergy: (master) {
model: model, setState(() {
masterList: model.allergiesList, removeAllergyFromLocalList(master);
removeAllergy: (master) { });
setState(() { },
removeAllergyFromLocalList(master); addAllergy: (MySelectedAllergy mySelectedAllergy) {
}); addAllergyLocally(mySelectedAllergy);
}, },
addAllergy: addSelectedAllergy: () {
(MySelectedAllergy mySelectedAllergy) { setState(() {
addAllergyLocally(mySelectedAllergy); widget.addAllergiesFun!(myAllergiesListLocal);
}, });
addSelectedAllergy: () { },
setState(() { isServiceSelected: (master) => isServiceSelected(master),
widget getServiceSelectedAllergy: (master) => getSelectedAllergy(master),
.addAllergiesFun(myAllergiesListLocal);
});
},
isServiceSelected: (master) =>
isServiceSelected(master),
getServiceSelectedAllergy: (master) =>
getSelectedAllergy(master),
),
),
), ),
), ),
), ),
), ),
SizedBox( ),
height: MediaQuery.of(context).size.height * 0.11, ),
), SizedBox(
]), height: MediaQuery.of(context).size.height * 0.11,
),
]),
), ),
), ),
bottomSheet: model.state != ViewState.Idle bottomSheet: model.state != ViewState.Idle
@ -119,7 +112,7 @@ class _AddAllergiesState extends State<AddAllergies> {
label: TranslationBase.of(context).addAllergies, label: TranslationBase.of(context).addAllergies,
onTap: () { onTap: () {
setState(() { setState(() {
widget.addAllergiesFun(myAllergiesListLocal); widget.addAllergiesFun!(myAllergiesListLocal);
}); });
}, },
), ),
@ -129,11 +122,8 @@ class _AddAllergiesState extends State<AddAllergies> {
} }
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedAllergy> allergy = myAllergiesListLocal.where( Iterable<MySelectedAllergy> allergy =
(element) => myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy?.id && masterKey.typeId == element.selectedAllergy?.typeId && element.isChecked!);
masterKey.id == element.selectedAllergy.id &&
masterKey.typeId == element.selectedAllergy.typeId &&
element.isChecked);
if (allergy.length > 0) { if (allergy.length > 0) {
return true; return true;
} }
@ -141,20 +131,16 @@ class _AddAllergiesState extends State<AddAllergies> {
} }
removeAllergyFromLocalList(MasterKeyModel masterKey) { removeAllergyFromLocalList(MasterKeyModel masterKey) {
myAllergiesListLocal myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id);
.removeWhere((element) => element.selectedAllergy.id == masterKey.id);
} }
MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) { MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) {
Iterable<MySelectedAllergy> allergy = myAllergiesListLocal.where( Iterable<MySelectedAllergy> allergy =
(element) => myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked!);
masterKey.id == element.selectedAllergy.id &&
masterKey.typeId == element.selectedAllergy.typeId &&
element.isChecked);
if (allergy.length > 0) { if (allergy.length > 0) {
return allergy.first; return allergy.first;
} }
return null; return MySelectedAllergy();
} }
addAllergyLocally(MySelectedAllergy mySelectedAllergy) { addAllergyLocally(MySelectedAllergy mySelectedAllergy) {
@ -164,18 +150,13 @@ class _AddAllergiesState extends State<AddAllergies> {
setState(() { setState(() {
List<MySelectedAllergy> allergy = List<MySelectedAllergy> allergy =
// ignore: missing_return // ignore: missing_return
myAllergiesListLocal myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList();
.where((element) =>
mySelectedAllergy.selectedAllergy.id ==
element.selectedAllergy.id)
.toList();
if (allergy.isEmpty) { if (allergy.isEmpty) {
myAllergiesListLocal.add(mySelectedAllergy); myAllergiesListLocal.add(mySelectedAllergy);
} else { } else {
allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy; allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy;
allergy.first.selectedAllergySeverity = allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity;
mySelectedAllergy.selectedAllergySeverity;
allergy.first.remark = mySelectedAllergy.remark; allergy.first.remark = mySelectedAllergy.remark;
allergy.first.isChecked = mySelectedAllergy.isChecked; allergy.first.isChecked = mySelectedAllergy.isChecked;
} }

@ -17,49 +17,39 @@ import 'package:provider/provider.dart';
import '../../soap_utils.dart'; import '../../soap_utils.dart';
class AddAllergiesItem extends StatefulWidget { class AddAllergiesItem extends StatefulWidget {
final SOAPViewModel model; final SOAPViewModel? model;
final Function(MasterKeyModel) removeAllergy; final Function(MasterKeyModel)? removeAllergy;
final Function(MySelectedAllergy mySelectedAllergy) addAllergy; final Function(MySelectedAllergy mySelectedAllergy)? addAllergy;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel)? isServiceSelected;
final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; final MySelectedAllergy Function(MasterKeyModel)? getServiceSelectedAllergy;
final MasterKeyModel? item;
final MasterKeyModel item; const AddAllergiesItem({Key? key, this.model, this.removeAllergy, this.addAllergy, this.isServiceSelected, this.getServiceSelectedAllergy, this.item}) : super(key: key);
const AddAllergiesItem(
{Key key,
this.model,
this.removeAllergy,
this.addAllergy,
this.isServiceSelected,
this.getServiceSelectedAllergy,
this.item})
: super(key: key);
@override @override
_AddAllergiesItemState createState() => _AddAllergiesItemState(); _AddAllergiesItemState createState() => _AddAllergiesItemState();
} }
class _AddAllergiesItemState extends State<AddAllergiesItem> { class _AddAllergiesItemState extends State<AddAllergiesItem> {
MasterKeyModel _selectedAllergySeverity; MasterKeyModel _selectedAllergySeverity = MasterKeyModel();
bool isSubmitted = false; bool isSubmitted = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
bool isSelected = widget.isServiceSelected(widget.item); bool isSelected = widget.isServiceSelected!(widget.item!);
MySelectedAllergy mySelectedAllergy; MySelectedAllergy mySelectedAllergy = MySelectedAllergy();
if (isSelected) { if (isSelected) {
mySelectedAllergy = widget.getServiceSelectedAllergy(widget.item); mySelectedAllergy = widget.getServiceSelectedAllergy!(widget.item!);
} }
TextEditingController remarkController = TextEditingController( TextEditingController remarkController = TextEditingController(text: isSelected ? mySelectedAllergy.remark : null);
text: isSelected ? mySelectedAllergy.remark : null);
TextEditingController severityController = TextEditingController( TextEditingController severityController = TextEditingController(
text: isSelected text: isSelected
? mySelectedAllergy.selectedAllergySeverity != null ? mySelectedAllergy.selectedAllergySeverity != null
? projectViewModel.isArabic ? projectViewModel.isArabic
? mySelectedAllergy.selectedAllergySeverity.nameAr ? mySelectedAllergy.selectedAllergySeverity!.nameAr
: mySelectedAllergy.selectedAllergySeverity.nameEn : mySelectedAllergy.selectedAllergySeverity!.nameEn
: null : null
: null); : null);
return HeaderBodyExpandableNotifier( return HeaderBodyExpandableNotifier(
@ -69,9 +59,9 @@ class _AddAllergiesItemState extends State<AddAllergiesItem> {
Row( Row(
children: [ children: [
Checkbox( Checkbox(
value: widget.isServiceSelected(widget.item), value: widget.isServiceSelected!(widget.item!),
activeColor: Colors.red[800], activeColor: Colors.red[800],
onChanged: (bool newValue) { onChanged: (bool? newValue) {
onTapItem(); onTapItem();
}), }),
InkWell( InkWell(
@ -79,13 +69,12 @@ class _AddAllergiesItemState extends State<AddAllergiesItem> {
child: Container( child: Container(
child: AppText( child: AppText(
projectViewModel.isArabic projectViewModel.isArabic
? widget.item.nameAr != "" ? widget.item!.nameAr != ""
? widget.item.nameAr ? widget.item!.nameAr!
: widget.item.nameEn : widget.item!.nameEn!
: widget.item.nameEn, : widget.item!.nameEn!,
color: Color(0xFF575757), color: Color(0xFF575757),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8),
(SizeConfig.isWidthLarge ? 3 : 3.8),
letterSpacing: -0.56, letterSpacing: -0.56,
), ),
width: MediaQuery.of(context).size.width * 0.55, width: MediaQuery.of(context).size.width * 0.55,
@ -97,15 +86,12 @@ class _AddAllergiesItemState extends State<AddAllergiesItem> {
onTap: () { onTap: () {
if (mySelectedAllergy != null) { if (mySelectedAllergy != null) {
setState(() { setState(() {
mySelectedAllergy.isExpanded = mySelectedAllergy.isExpanded = mySelectedAllergy.isExpanded == null ? false : true;
mySelectedAllergy.isExpanded ? false : true;
}); });
} }
}, },
child: Icon( child: Icon(
(mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false) (mySelectedAllergy != null ? mySelectedAllergy.isExpanded! : false) ? EvaIcons.arrowIosUpwardOutline : EvaIcons.arrowIosDownwardOutline,
? EvaIcons.arrowIosUpwardOutline
: EvaIcons.arrowIosDownwardOutline,
color: Color(0xFF575757), color: Color(0xFF575757),
size: 20, size: 20,
), ),
@ -119,17 +105,15 @@ class _AddAllergiesItemState extends State<AddAllergiesItem> {
child: Column( child: Column(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
onClick: widget.model.allergySeverityList != null onClick: widget.model!.allergySeverityList != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: widget.model.allergySeverityList, list: widget.model!.allergySeverityList,
selectedValue: selectedValue: mySelectedAllergy.selectedAllergySeverity!,
mySelectedAllergy.selectedAllergySeverity,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
mySelectedAllergy.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity = selectedValue;
selectedValue;
}); });
}, },
); );
@ -141,18 +125,15 @@ class _AddAllergiesItemState extends State<AddAllergiesItem> {
}, },
); );
} }
: null, : () {},
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
hintText: TranslationBase.of(context).selectSeverity + "*", hintText: TranslationBase.of(context).selectSeverity + "*",
enabled: false, enabled: false,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
height: Utils.getTextFieldHeight(), height: Utils.getTextFieldHeight(),
validationError: mySelectedAllergy != null && validationError:
mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy.hasValidationError! ? TranslationBase.of(context).severityValidationError : "",
mySelectedAllergy.hasValidationError
? TranslationBase.of(context).severityValidationError
: null,
controller: severityController, controller: severityController,
), ),
SizedBox( SizedBox(
@ -177,24 +158,17 @@ class _AddAllergiesItemState extends State<AddAllergiesItem> {
), ),
), ),
), ),
isExpand: isExpand: mySelectedAllergy != null ? mySelectedAllergy.isExpanded! : false,
mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false,
); );
} }
onTapItem() { onTapItem() {
setState(() { setState(() {
if (widget.isServiceSelected(widget.item)) { if (widget.isServiceSelected!(widget.item!)) {
widget.removeAllergy(widget.item); widget.removeAllergy!(widget.item!);
} else { } else {
MySelectedAllergy mySelectedAllergy = MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(allergy: widget.item, allergySeverity: _selectedAllergySeverity, remark: null, isChecked: true, isExpanded: true);
SoapUtils.generateMySelectedAllergy( widget.addAllergy!(mySelectedAllergy);
allergy: widget.item,
allergySeverity: _selectedAllergySeverity,
remark: null,
isChecked: true,
isExpanded: true);
widget.addAllergy(mySelectedAllergy);
} }
}); });
} }

@ -11,19 +11,19 @@ import 'package:flutter/material.dart';
import 'allergies_item.dart'; import 'allergies_item.dart';
class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
final SOAPViewModel model; final SOAPViewModel? model;
final Function() addSelectedAllergy; final Function()? addSelectedAllergy;
final Function(MasterKeyModel) removeAllergy; final Function(MasterKeyModel)? removeAllergy;
final Function(MySelectedAllergy mySelectedAllergy) addAllergy; final Function(MySelectedAllergy mySelectedAllergy)? addAllergy;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel)? isServiceSelected;
final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; final MySelectedAllergy Function(MasterKeyModel)? getServiceSelectedAllergy;
final List<MasterKeyModel> masterList; final List<MasterKeyModel>? masterList;
final String buttonName; final String? buttonName;
final String hintSearchText; final String? hintSearchText;
MasterKeyCheckboxSearchAllergiesWidget( MasterKeyCheckboxSearchAllergiesWidget(
{Key key, {Key? key,
this.model, this.model,
this.addSelectedAllergy, this.addSelectedAllergy,
this.removeAllergy, this.removeAllergy,
@ -47,7 +47,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
@override @override
void initState() { void initState() {
items.addAll(widget.masterList); items.addAll(widget.masterList!);
super.initState(); super.initState();
} }
@ -78,7 +78,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
icon: Icon( icon: Icon(
Icons.search, Icons.search,
color: Colors.black, color: Colors.black,
)), ), onPressed: () { },),
), ),
DividerWithSpacesAround(), DividerWithSpacesAround(),
SizedBox( SizedBox(
@ -122,12 +122,12 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
void filterSearchResults(String query) { void filterSearchResults(String query) {
List<MasterKeyModel> dummySearchList = []; List<MasterKeyModel> dummySearchList = [];
dummySearchList.addAll(widget.masterList); dummySearchList.addAll(widget.masterList as Iterable<MasterKeyModel>);
if (query.isNotEmpty) { if (query.isNotEmpty) {
List<MasterKeyModel> dummyListData = []; List<MasterKeyModel> dummyListData = [];
dummySearchList.forEach((items) { dummySearchList.forEach((items) {
if (items.nameAr.toLowerCase().contains(query.toLowerCase()) || if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) ||
items.nameEn.toLowerCase().contains(query.toLowerCase())) { items.nameEn!.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(items); dummyListData.add(items);
} }
}); });
@ -139,7 +139,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
} else { } else {
setState(() { setState(() {
items.clear(); items.clear();
items.addAll(widget.masterList); items.addAll(widget.masterList as Iterable<MasterKeyModel>);
}); });
} }
} }

@ -15,9 +15,9 @@ import 'add_allergies.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class UpdateAllergiesWidget extends StatefulWidget { class UpdateAllergiesWidget extends StatefulWidget {
List<MySelectedAllergy> myAllergiesList; List<MySelectedAllergy>? myAllergiesList;
UpdateAllergiesWidget({Key key, this.myAllergiesList}); UpdateAllergiesWidget({Key? key, this.myAllergiesList});
@override @override
_UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState();
@ -45,7 +45,7 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
Container( Container(
margin: EdgeInsets.only(left: 15, right: 15, top: 15), margin: EdgeInsets.only(left: 15, right: 15, top: 15),
child: Column( child: Column(
children: widget.myAllergiesList.map((selectedAllergy) { children: widget.myAllergiesList!.map((selectedAllergy) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -62,36 +62,20 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
projectViewModel.isArabic projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(),
? selectedAllergy.selectedAllergy.nameAr textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
: selectedAllergy.selectedAllergy.nameEn
.toUpperCase(),
textDecoration: selectedAllergy.isChecked
? null
: TextDecoration.lineThrough,
bold: true, bold: true,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
fontSize: fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
SizeConfig.getTextMultiplierBasedOnWidth() *
3.5,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: -0.48, letterSpacing: -0.48,
// fontHeight:0.18 , // fontHeight:0.18 ,
), ),
AppText( AppText(
projectViewModel.isArabic projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn!.toUpperCase(),
? selectedAllergy textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
.selectedAllergySeverity.nameAr
: selectedAllergy
.selectedAllergySeverity.nameEn
.toUpperCase(),
textDecoration: selectedAllergy.isChecked
? null
: TextDecoration.lineThrough,
color: Color(0xFFCC9B14), color: Color(0xFFCC9B14),
fontSize: fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
SizeConfig.getTextMultiplierBasedOnWidth() *
3,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
@ -110,7 +94,7 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
child: Row( child: Row(
children: [ children: [
RemarkText( RemarkText(
remark: selectedAllergy.remark, remark: selectedAllergy.remark!,
), ),
], ],
), ),
@ -132,18 +116,14 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
removeAllergy(MySelectedAllergy mySelectedAllergy) { removeAllergy(MySelectedAllergy mySelectedAllergy) {
List<MySelectedAllergy> allergy = List<MySelectedAllergy> allergy =
// ignore: missing_return // ignore: missing_return
widget.myAllergiesList widget.myAllergiesList!
.where((element) => .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id)
mySelectedAllergy.selectedAllergySeverity.id ==
element.selectedAllergySeverity.id &&
mySelectedAllergy.selectedAllergy.id ==
element.selectedAllergy.id)
.toList(); .toList();
if (allergy.length > 0) { if (allergy.length > 0) {
if (allergy.first.isLocal) { if (allergy.first.isLocal) {
setState(() { setState(() {
widget.myAllergiesList.remove(allergy.first); widget.myAllergiesList!.remove(allergy.first);
}); });
} }
setState(() { setState(() {
@ -152,8 +132,7 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
} }
} }
openAllergiesList( openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) {
BuildContext context, Function changeParentState, removeAllergy) {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
isScrollControlled: true, isScrollControlled: true,
@ -172,24 +151,26 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
}); });
if (isAllDataFilled) { if (isAllDataFilled) {
mySelectedAllergy.forEach((element) { mySelectedAllergy.forEach((element) {
if ((widget.myAllergiesList.singleWhere( if ((
(it) => widget.myAllergiesList!.singleWhere(
it.selectedAllergy.id == (it) => it.selectedAllergy!.id == element.selectedAllergy!.id,
element.selectedAllergy.id, orElse: () => MySelectedAllergy(),
orElse: () => null)) == ),
) ==
null) { null) {
widget.myAllergiesList.add(element); widget.myAllergiesList!.add(element);
} }
}); });
/// remove items. /// remove items.
List<MySelectedAllergy> removedList = []; List<MySelectedAllergy> removedList = [];
widget.myAllergiesList.forEach((element) { widget.myAllergiesList!.forEach((element) {
if ((mySelectedAllergy.singleWhere( if ((
(it) => mySelectedAllergy.singleWhere(
it.selectedAllergy.id == (it) => it.selectedAllergy!.id == element.selectedAllergy!.id,
element.selectedAllergy.id, orElse: () => MySelectedAllergy(),
orElse: () => null)) == ),
) ==
null) { null) {
removedList.add(element); removedList.add(element);
} }
@ -201,8 +182,7 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
changeParentState(); changeParentState();
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
Utils.showErrorToast( Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
TranslationBase.of(context).requiredMsg);
} }
}); });
}); });

@ -7,14 +7,14 @@ import '../medication/update_medication_widget.dart';
class UpdateChiefComplaints extends StatelessWidget { class UpdateChiefComplaints extends StatelessWidget {
const UpdateChiefComplaints({ const UpdateChiefComplaints({
Key key, Key? key,
@required this.formKey, required this.formKey,
@required this.complaintsController, required this.complaintsController,
@required this.illnessController, required this.illnessController,
@required this.medicationController, required this.medicationController,
this.complaintsControllerError, this.complaintsControllerError = '',
this.illnessControllerError, this.illnessControllerError = '',
this.medicationControllerError, this.medicationControllerError = '',
}) : super(key: key); }) : super(key: key);
final GlobalKey<FormState> formKey; final GlobalKey<FormState> formKey;
@ -41,9 +41,7 @@ class UpdateChiefComplaints extends StatelessWidget {
minLines: 7, minLines: 7,
hasBorder: true, hasBorder: true,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
validationError: complaintsControllerError != '' validationError: complaintsControllerError != '' ? complaintsControllerError : "",
? complaintsControllerError
: null,
), ),
SizedBox( SizedBox(
height: 20, height: 20,
@ -56,8 +54,7 @@ class UpdateChiefComplaints extends StatelessWidget {
maxLines: 25, maxLines: 25,
minLines: 7, minLines: 7,
hasBorder: true, hasBorder: true,
validationError: validationError: illnessControllerError != '' ? illnessControllerError : "",
illnessControllerError != '' ? illnessControllerError : null,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -75,9 +72,7 @@ class UpdateChiefComplaints extends StatelessWidget {
minLines: 7, minLines: 7,
hasBorder: true, hasBorder: true,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
validationError: medicationControllerError != '' validationError: medicationControllerError != '' ? medicationControllerError : "",
? medicationControllerError
: null,
), ),
SizedBox( SizedBox(
height: 10, height: 10,

@ -16,20 +16,13 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart';
import 'priority_bar.dart'; import 'priority_bar.dart';
class AddHistoryDialog extends StatefulWidget { class AddHistoryDialog extends StatefulWidget {
final Function changePageViewIndex; final Function? changePageViewIndex;
final PageController controller; final PageController? controller;
final List<MySelectedHistory> myHistoryList; final List<MySelectedHistory>? myHistoryList;
final Function addSelectedHistories; final Function? addSelectedHistories;
final Function(MasterKeyModel) removeHistory; final Function(MasterKeyModel)? removeHistory;
const AddHistoryDialog( const AddHistoryDialog({Key? key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) : super(key: key);
{Key key,
this.changePageViewIndex,
this.controller,
this.myHistoryList,
this.addSelectedHistories,
this.removeHistory})
: super(key: key);
@override @override
_AddHistoryDialogState createState() => _AddHistoryDialogState(); _AddHistoryDialogState createState() => _AddHistoryDialogState();
@ -58,8 +51,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: appBar: BottomSheetTitle(title: TranslationBase.of(context).addHistory),
BottomSheetTitle(title: TranslationBase.of(context).addHistory),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(
@ -68,7 +60,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
height: 10, height: 10,
), ),
PriorityBar(onTap: (activePriority) async { PriorityBar(onTap: (activePriority) async {
widget.changePageViewIndex(activePriority); widget.changePageViewIndex!(activePriority);
}), }),
SizedBox( SizedBox(
height: 20, height: 20,
@ -91,7 +83,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
masterList: model.historyFamilyList, masterList: model.historyFamilyList,
removeHistory: (history) { removeHistory: (history) {
setState(() { setState(() {
widget.removeHistory(history); widget.removeHistory!(history);
}); });
}, },
addHistory: (history) { addHistory: (history) {
@ -100,21 +92,19 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}); });
}, },
addSelectedHistories: () { addSelectedHistories: () {
widget.addSelectedHistories(); widget.addSelectedHistories!();
}, },
isServiceSelected: (master) => isServiceSelected: (master) => isServiceSelected(master),
isServiceSelected(master),
), ),
), ),
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: MasterKeyCheckboxSearchWidget( child: MasterKeyCheckboxSearchWidget(
model: model, model: model,
masterList: model masterList: model.mergeHistorySurgicalWithHistorySportList,
.mergeHistorySurgicalWithHistorySportList,
removeHistory: (history) { removeHistory: (history) {
setState(() { setState(() {
widget.removeHistory(history); widget.removeHistory!(history);
}); });
}, },
addHistory: (history) { addHistory: (history) {
@ -123,10 +113,9 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}); });
}, },
addSelectedHistories: () { addSelectedHistories: () {
widget.addSelectedHistories(); widget.addSelectedHistories!();
}, },
isServiceSelected: (master) => isServiceSelected: (master) => isServiceSelected(master),
isServiceSelected(master),
), ),
), ),
NetworkBaseView( NetworkBaseView(
@ -136,7 +125,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
masterList: model.historyMedicalList, masterList: model.historyMedicalList,
removeHistory: (history) { removeHistory: (history) {
setState(() { setState(() {
widget.removeHistory(history); widget.removeHistory!(history);
}); });
}, },
addHistory: (history) { addHistory: (history) {
@ -145,10 +134,9 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}); });
}, },
addSelectedHistories: () { addSelectedHistories: () {
widget.addSelectedHistories(); widget.addSelectedHistories!();
}, },
isServiceSelected: (master) => isServiceSelected: (master) => isServiceSelected(master),
isServiceSelected(master),
), ),
), ),
], ],
@ -168,7 +156,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
: CustomBottomSheetContainer( : CustomBottomSheetContainer(
label: TranslationBase.of(context).addSelectedHistories, label: TranslationBase.of(context).addSelectedHistories,
onTap: () { onTap: () {
widget.addSelectedHistories(); widget.addSelectedHistories!();
}, },
), ),
), ),
@ -176,21 +164,13 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
createAndAddHistory(MasterKeyModel history) { createAndAddHistory(MasterKeyModel history) {
List<MySelectedHistory> myhistory = widget.myHistoryList List<MySelectedHistory> myhistory = widget.myHistoryList!.where((element) => history.id == element.selectedHistory!.id && history.typeId == element.selectedHistory!.typeId).toList();
.where((element) =>
history.id == element.selectedHistory.id &&
history.typeId == element.selectedHistory.typeId)
.toList();
if (myhistory.isEmpty) { if (myhistory.isEmpty) {
setState(() { setState(() {
MySelectedHistory mySelectedHistory = MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(remark: history.remarks ?? "", history: history, isChecked: true);
SoapUtils.generateMySelectedHistory(
remark: history.remarks ?? "",
history: history,
isChecked: true);
widget.myHistoryList.add(mySelectedHistory); widget.myHistoryList!.add(mySelectedHistory);
}); });
} else { } else {
myhistory.first.isChecked = true; myhistory.first.isChecked = true;
@ -198,11 +178,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedHistory> history = widget.myHistoryList.where( Iterable<MySelectedHistory> history =
(element) => widget.myHistoryList!.where((element) => masterKey.id == element.selectedHistory!.id && masterKey.typeId == element.selectedHistory!.typeId && element.isChecked!);
masterKey.id == element.selectedHistory.id &&
masterKey.typeId == element.selectedHistory.typeId &&
element.isChecked);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -6,9 +6,9 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class PriorityBar extends StatefulWidget { class PriorityBar extends StatefulWidget {
final Function onTap; final Function? onTap;
const PriorityBar({Key key, this.onTap}) : super(key: key); const PriorityBar({Key? key, this.onTap}) : super(key: key);
@override @override
_PriorityBarState createState() => _PriorityBarState(); _PriorityBarState createState() => _PriorityBarState();
@ -28,8 +28,7 @@ class _PriorityBarState extends State<PriorityBar> {
"طبي", "طبي",
]; ];
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
Color containerColor, Color borderColor) {
return BoxDecoration(); return BoxDecoration();
} }
@ -58,19 +57,13 @@ class _PriorityBarState extends State<PriorityBar> {
children: [ children: [
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
decoration: containerBorderDecoration( decoration: containerBorderDecoration(_isActive ? HexColor("#B8382B") : Colors.white, _isActive ? HexColor("#B8382B") : Colors.white),
_isActive ? HexColor("#B8382B") : Colors.white,
_isActive ? HexColor("#B8382B") : Colors.white),
child: Center( child: Center(
child: Text( child: Text(
(projectViewModel.isArabic) (projectViewModel.isArabic) ? _prioritiesAr[index] : item,
? _prioritiesAr[index]
: item,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
SizeConfig.getTextMultiplierBasedOnWidth() *
3.5,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -87,7 +80,7 @@ class _PriorityBarState extends State<PriorityBar> {
), ),
), ),
onTap: () { onTap: () {
widget.onTap(_priorities.indexOf(item)); widget.onTap!(_priorities.indexOf(item));
setState(() { setState(() {
_activePriority = _priorities.indexOf(item); _activePriority = _priorities.indexOf(item);

@ -12,20 +12,19 @@ import '../../shared_soap_widgets/SOAP_open_items.dart';
import 'add_history_dialog.dart'; import 'add_history_dialog.dart';
class UpdateHistoryWidget extends StatefulWidget { class UpdateHistoryWidget extends StatefulWidget {
final List<MySelectedHistory> myHistoryList; final List<MySelectedHistory>? myHistoryList;
const UpdateHistoryWidget({Key key, this.myHistoryList}) : super(key: key); const UpdateHistoryWidget({Key? key, this.myHistoryList}) : super(key: key);
@override @override
_UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState(); _UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState();
} }
class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget> class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget> with TickerProviderStateMixin {
with TickerProviderStateMixin { PageController? _controller;
PageController _controller;
changePageViewIndex(pageIndex) { changePageViewIndex(pageIndex) {
_controller.jumpToPage(pageIndex); _controller!.jumpToPage(pageIndex);
} }
@override @override
@ -52,7 +51,7 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
Container( Container(
margin: EdgeInsets.only(left: 15, right: 15, top: 15), margin: EdgeInsets.only(left: 15, right: 15, top: 15),
child: Column( child: Column(
children: widget.myHistoryList.map((myHistory) { children: widget.myHistoryList!.map((myHistory) {
return Column( return Column(
children: [ children: [
Row( Row(
@ -60,23 +59,18 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
children: [ children: [
Container( Container(
child: AppText( child: AppText(
projectViewModel.isArabic projectViewModel.isArabic ? myHistory.selectedHistory!.nameAr! : myHistory.selectedHistory!.nameEn!,
? myHistory.selectedHistory.nameAr textDecoration: myHistory.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
: myHistory.selectedHistory.nameEn,
textDecoration: myHistory.isChecked
? null
: TextDecoration.lineThrough,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
fontSize: fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
width: MediaQuery.of(context).size.width * 0.5, width: MediaQuery.of(context).size.width * 0.5,
), ),
if (myHistory.isChecked) if (myHistory.isChecked!)
RemoveButton( RemoveButton(
onTap: () => removeHistory(myHistory.selectedHistory), onTap: () => removeHistory(myHistory.selectedHistory!),
) )
], ],
), ),
@ -95,16 +89,12 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
removeHistory(MasterKeyModel historyKey) { removeHistory(MasterKeyModel historyKey) {
List<MySelectedHistory> history = List<MySelectedHistory> history =
// ignore: missing_return // ignore: missing_return
widget.myHistoryList widget.myHistoryList!.where((element) => historyKey.id == element.selectedHistory!.id && historyKey.typeId == element.selectedHistory!.typeId).toList();
.where((element) =>
historyKey.id == element.selectedHistory.id &&
historyKey.typeId == element.selectedHistory.typeId)
.toList();
if (history.length > 0) { if (history.length > 0) {
if (history.first.isLocal) { if (history.first.isLocal!) {
setState(() { setState(() {
widget.myHistoryList.remove(history.first); widget.myHistoryList!.remove(history.first);
}); });
} else { } else {
setState(() { setState(() {

@ -23,30 +23,28 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class AddMedication extends StatefulWidget { class AddMedication extends StatefulWidget {
final Function addMedicationFun; final Function? addMedicationFun;
TextEditingController medicationController; TextEditingController? medicationController;
AddMedication({Key key, this.addMedicationFun, this.medicationController}) AddMedication({Key? key, this.addMedicationFun, this.medicationController}) : super(key: key);
: super(key: key);
@override @override
_AddMedicationState createState() => _AddMedicationState(); _AddMedicationState createState() => _AddMedicationState();
} }
class _AddMedicationState extends State<AddMedication> { class _AddMedicationState extends State<AddMedication> {
MasterKeyModel _selectedMedicationDose; MasterKeyModel _selectedMedicationDose = MasterKeyModel();
MasterKeyModel _selectedMedicationStrength; MasterKeyModel _selectedMedicationStrength = MasterKeyModel();
MasterKeyModel _selectedMedicationRoute; MasterKeyModel _selectedMedicationRoute = MasterKeyModel();
MasterKeyModel _selectedMedicationFrequency; MasterKeyModel _selectedMedicationFrequency = MasterKeyModel();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
TextEditingController strengthController = TextEditingController(); TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController(); TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController(); TextEditingController frequencyController = TextEditingController();
GetMedicationResponseModel _selectedMedication; GetMedicationResponseModel _selectedMedication = GetMedicationResponseModel();
GlobalKey key = GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>> key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
bool isFormSubmitted = false; bool isFormSubmitted = false;
@override @override
@ -65,359 +63,248 @@ class _AddMedicationState extends State<AddMedication> {
), ),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, SizedBox(
children: [ height: 10,
SizedBox( ),
height: 10, Expanded(
), child: FractionallySizedBox(
Expanded( widthFactor: 0.9,
child: FractionallySizedBox( child: SingleChildScrollView(
widthFactor: 0.9, child: Column(
child: SingleChildScrollView( children: [
child: Column( SizedBox(
children: [ height: SizeConfig.heightMultiplier! *
SizedBox( (SizeConfig.isHeightVeryShort
height: SizeConfig.heightMultiplier! * ? 2
(SizeConfig.isHeightVeryShort : SizeConfig.isHeightShort
? 2 ? 2
: SizeConfig.isHeightShort : 2),
? 2 ),
: 2), Container(
), // height: screenSize.height * 0.070,
Container( child: InkWell(
// height: screenSize.height * 0.070, onTap: model.allMedicationList != null
child: InkWell( ? () {
onTap: model.allMedicationList != null setState(() {
? () { _selectedMedication = GetMedicationResponseModel();
setState(() { });
_selectedMedication = null; }
}); : null,
} child: _selectedMedication == null
: null, ? CustomAutoCompleteTextField(
child: _selectedMedication == null isShowError: isFormSubmitted && _selectedMedication == null,
? CustomAutoCompleteTextField( child: AutoCompleteTextField<GetMedicationResponseModel>(
isShowError: isFormSubmitted && decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).searchMedicineNameHere, "", true, suffixIcon: Icons.search),
_selectedMedication == null, itemSubmitted: (item) => setState(() => _selectedMedication = item),
child: AutoCompleteTextField< key: key,
GetMedicationResponseModel>( suggestions: model.allMedicationList,
decoration: TextFieldsUtils itemBuilder: (context, suggestion) => new Padding(child: AppText(suggestion.description! + '/' + suggestion.genericName!), padding: EdgeInsets.all(8.0)),
.textFieldSelectorDecoration( itemSorter: (a, b) => 1,
TranslationBase.of( itemFilter: (suggestion, input) =>
context) suggestion.genericName!.toLowerCase().startsWith(input.toLowerCase()) ||
.searchMedicineNameHere, suggestion.description!.toLowerCase().startsWith(input.toLowerCase()) ||
null, suggestion.keywords!.toLowerCase().startsWith(input.toLowerCase()),
true,
suffixIcon:
Icons.search),
itemSubmitted: (item) =>
setState(() =>
_selectedMedication =
item),
key: key,
suggestions:
model.allMedicationList,
itemBuilder: (context,
suggestion) =>
new Padding(
child: AppText(suggestion
.description +
'/' +
suggestion
.genericName),
padding: EdgeInsets.all(
8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion,
input) =>
suggestion.genericName.toLowerCase().startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(input
.toLowerCase()) ||
suggestion.keywords
.toLowerCase()
.startsWith(input
.toLowerCase()),
),
)
: AppTextFieldCustom(
height:
Utils.getTextFieldHeight(),
hintText: _selectedMedication !=
null
? _selectedMedication
.description +
(' (${_selectedMedication.genericName} )')
: TranslationBase.of(context)
.searchMedicineNameHere,
minLines: 1,
maxLines: 1,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
)),
enabled: false,
),
),
),
if (_selectedMedication != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.7,
child: AppText(
_selectedMedication.description +
(' (${_selectedMedication.genericName} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
), ),
)
: AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
hintText: _selectedMedication != null
? _selectedMedication.description! + (' (${_selectedMedication.genericName} )')
: TranslationBase.of(context).searchMedicineNameHere,
minLines: 1,
maxLines: 1,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
), onPressed: () { },),
enabled: false,
), ),
], ),
),
if (_selectedMedication != null)
Column(
children: [
SizedBox(
height: 3,
), ),
SizedBox( Container(
height: 5, width: MediaQuery.of(context).size.width * 0.7,
), child: AppText(
AppTextFieldCustom( _selectedMedication.description! + (' (${_selectedMedication.genericName} )'),
height: Utils.getTextFieldHeight(), color: Color(0xFF575757),
enabled: false, fontSize: 10,
onClick: model.medicationDoseTimeList != fontWeight: FontWeight.w700,
null letterSpacing: -0.4,
? () { ),
MasterKeyDailog dialog = ),
MasterKeyDailog( ],
list: ),
model.medicationDoseTimeList, SizedBox(
okText: height: 5,
TranslationBase.of(context) ),
.ok, AppTextFieldCustom(
selectedValue: height: Utils.getTextFieldHeight(),
_selectedMedicationDose, enabled: false,
okFunction: (selectedValue) { onClick: model.medicationDoseTimeList != null
setState(() { ? () {
_selectedMedicationDose = MasterKeyDailog dialog = MasterKeyDailog(
selectedValue; list: model.medicationDoseTimeList,
okText: TranslationBase.of(context).ok,
selectedValue: _selectedMedicationDose,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationDose = selectedValue;
doseController doseController.text = projectViewModel.isArabic ? _selectedMedicationDose.nameAr! : _selectedMedicationDose.nameEn!;
.text = projectViewModel });
.isArabic },
? _selectedMedicationDose );
.nameAr showDialog(
: _selectedMedicationDose barrierDismissible: false,
.nameEn; context: context,
}); builder: (BuildContext context) {
}, return dialog;
); },
showDialog( );
barrierDismissible: false, }
context: context, : (){},
builder: (BuildContext context) { hintText: TranslationBase.of(context).doseTime,
return dialog; maxLines: 1,
}, minLines: 1,
); isTextFieldHasSuffix: true,
} controller: doseController,
: null, validationError: isFormSubmitted && _selectedMedicationDose == null ? TranslationBase.of(context).emptyMessage : "",
hintText: ),
TranslationBase.of(context).doseTime, SizedBox(
maxLines: 1, height: 5,
minLines: 1, ),
isTextFieldHasSuffix: true, AppTextFieldCustom(
controller: doseController, height: Utils.getTextFieldHeight(),
validationError: isFormSubmitted && enabled: false,
_selectedMedicationDose == null isTextFieldHasSuffix: true,
? TranslationBase.of(context) onClick: model.medicationStrengthList != null
.emptyMessage ? () {
: null, MasterKeyDailog dialog = MasterKeyDailog(
), list: model.medicationStrengthList,
SizedBox( okText: TranslationBase.of(context).ok,
height: 5, selectedValue: _selectedMedicationStrength,
), okFunction: (selectedValue) {
AppTextFieldCustom( setState(() {
height: Utils.getTextFieldHeight(), _selectedMedicationStrength = selectedValue;
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList !=
null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list:
model.medicationStrengthList,
okText:
TranslationBase.of(context)
.ok,
selectedValue:
_selectedMedicationStrength,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
strengthController strengthController.text = projectViewModel.isArabic ? _selectedMedicationStrength.nameAr! : _selectedMedicationStrength.nameEn!;
.text = projectViewModel });
.isArabic },
? _selectedMedicationStrength );
.nameAr showDialog(
: _selectedMedicationStrength barrierDismissible: false,
.nameEn; context: context,
}); builder: (BuildContext context) {
}, return dialog;
); },
showDialog( );
barrierDismissible: false, }
context: context, : (){},
builder: (BuildContext context) { hintText: TranslationBase.of(context).strength,
return dialog; maxLines: 1,
}, minLines: 1,
); controller: strengthController,
} validationError: isFormSubmitted && _selectedMedicationStrength == null ? TranslationBase.of(context).emptyMessage : "",
: null, ),
hintText: SizedBox(
TranslationBase.of(context).strength, height: 5,
maxLines: 1, ),
minLines: 1, SizedBox(
controller: strengthController, height: 5,
validationError: isFormSubmitted && ),
_selectedMedicationStrength == null AppTextFieldCustom(
? TranslationBase.of(context) height: Utils.getTextFieldHeight(),
.emptyMessage enabled: false,
: null, isTextFieldHasSuffix: true,
), onClick: model.medicationRouteList != null
SizedBox( ? () {
height: 5, MasterKeyDailog dialog = MasterKeyDailog(
), list: model.medicationRouteList,
SizedBox( selectedValue: _selectedMedicationRoute,
height: 5, okText: TranslationBase.of(context).ok,
), okFunction: (selectedValue) {
AppTextFieldCustom( setState(() {
height: Utils.getTextFieldHeight(), _selectedMedicationRoute = selectedValue;
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationRouteList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationRouteList,
selectedValue:
_selectedMedicationRoute,
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute =
selectedValue;
routeController routeController.text = projectViewModel.isArabic ? _selectedMedicationRoute.nameAr! : _selectedMedicationRoute.nameEn!;
.text = projectViewModel });
.isArabic },
? _selectedMedicationRoute );
.nameAr showDialog(
: _selectedMedicationRoute barrierDismissible: false,
.nameEn; context: context,
}); builder: (BuildContext context) {
}, return dialog;
); },
showDialog( );
barrierDismissible: false, }
context: context, : (){},
builder: (BuildContext context) { hintText: TranslationBase.of(context).route,
return dialog; maxLines: 1,
}, minLines: 1,
); controller: routeController,
} validationError: isFormSubmitted && _selectedMedicationRoute == null ? TranslationBase.of(context).emptyMessage : "",
: null, ),
hintText: TranslationBase.of(context).route, SizedBox(
maxLines: 1, height: 5,
minLines: 1, ),
controller: routeController, SizedBox(
validationError: isFormSubmitted && height: 5,
_selectedMedicationRoute == null ),
? TranslationBase.of(context) AppTextFieldCustom(
.emptyMessage height: Utils.getTextFieldHeight(),
: null, onClick: model.medicationFrequencyList != null
), ? () {
SizedBox( MasterKeyDailog dialog = MasterKeyDailog(
height: 5, list: model.medicationFrequencyList,
), okText: TranslationBase.of(context).ok,
SizedBox( selectedValue: _selectedMedicationFrequency,
height: 5, okFunction: (selectedValue) {
), setState(() {
AppTextFieldCustom( _selectedMedicationFrequency = selectedValue;
height: Utils.getTextFieldHeight(),
onClick: model.medicationFrequencyList !=
null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list:
model.medicationFrequencyList,
okText:
TranslationBase.of(context)
.ok,
selectedValue:
_selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
frequencyController frequencyController.text = projectViewModel.isArabic ? _selectedMedicationFrequency.nameAr! : _selectedMedicationFrequency.nameEn!;
.text = projectViewModel });
.isArabic },
? _selectedMedicationFrequency );
.nameAr showDialog(
: _selectedMedicationFrequency barrierDismissible: false,
.nameEn; context: context,
}); builder: (BuildContext context) {
}, return dialog;
); },
showDialog( );
barrierDismissible: false, }
context: context, : (){},
builder: (BuildContext context) { hintText: TranslationBase.of(context).frequency,
return dialog; enabled: false,
}, maxLines: 1,
); minLines: 1,
} isTextFieldHasSuffix: true,
: null, controller: frequencyController,
hintText: validationError: isFormSubmitted && _selectedMedicationFrequency == null ? TranslationBase.of(context).emptyMessage : "",
TranslationBase.of(context).frequency, ),
enabled: false, SizedBox(
maxLines: 1, height: SizeConfig.heightMultiplier! *
minLines: 1, (SizeConfig.isHeightVeryShort
isTextFieldHasSuffix: true, ? 20
controller: frequencyController, : SizeConfig.isHeightShort
validationError: isFormSubmitted && ? 15
_selectedMedicationFrequency == null : 10),
? TranslationBase.of(context)
.emptyMessage
: null,
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort
? 20
: SizeConfig.isHeightShort
? 15
: 10),
),
],
), ),
)), ],
), ),
]), )),
),
]),
), ),
), ),
bottomSheet: model.state != ViewState.Idle bottomSheet: model.state != ViewState.Idle
@ -435,8 +322,7 @@ class _AddMedicationState extends State<AddMedication> {
_selectedMedicationStrength != null && _selectedMedicationStrength != null &&
_selectedMedicationRoute != null && _selectedMedicationRoute != null &&
_selectedMedicationFrequency != null) { _selectedMedicationFrequency != null) {
widget.medicationController.text = widget widget.medicationController!.text = widget.medicationController!.text +
.medicationController.text +
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
Navigator.of(context).pop(); Navigator.of(context).pop();
} }

@ -6,10 +6,10 @@ import '../../shared_soap_widgets/SOAP_open_items.dart';
import 'add_medication.dart'; import 'add_medication.dart';
class UpdateMedicationWidget extends StatefulWidget { class UpdateMedicationWidget extends StatefulWidget {
final TextEditingController medicationController; final TextEditingController? medicationController;
UpdateMedicationWidget({ UpdateMedicationWidget({
Key key, Key? key,
this.medicationController, this.medicationController,
}); });

@ -20,24 +20,18 @@ import 'cheif_complaints/update_Chief_complaints.dart';
import 'history/update_history_widget.dart'; import 'history/update_history_widget.dart';
class UpdateSubjectivePage extends StatefulWidget { class UpdateSubjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function? changePageViewIndex;
final Function changeLoadingState; final Function? changeLoadingState;
final PatiantInformtion patientInfo; final PatiantInformtion? patientInfo;
final int currentIndex; final int? currentIndex;
UpdateSubjectivePage( UpdateSubjectivePage({Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
{Key key,
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@override @override
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
} }
class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> implements SubjectiveCallBack {
implements SubjectiveCallBack {
bool isChiefExpand = false; bool isChiefExpand = false;
bool isHistoryExpand = false; bool isHistoryExpand = false;
bool isAllergiesExpand = false; bool isAllergiesExpand = false;
@ -50,70 +44,46 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
List<MySelectedHistory> myHistoryList = []; List<MySelectedHistory> myHistoryList = [];
getHistory(SOAPViewModel model) async { getHistory(SOAPViewModel model) async {
widget.changeLoadingState(true); widget.changeLoadingState!(true);
if (model.patientHistoryList.isNotEmpty) { if (model.patientHistoryList.isNotEmpty) {
model.patientHistoryList.forEach((element) { model.patientHistoryList.forEach((element) {
if (element.historyType == if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) {
MasterKeysService.HistoryFamily.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryFamily, masterKeys: MasterKeysService.HistoryFamily,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
if (element.historyType == if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
MasterKeysService.HistoryMedical.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryMedical, masterKeys: MasterKeysService.HistoryMedical,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
if (element.historyType == if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
MasterKeysService.HistorySports.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySports, masterKeys: MasterKeysService.HistorySports,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
if (element.historyType == if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
MasterKeysService.HistorySurgical.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySurgical, masterKeys: MasterKeysService.HistorySurgical,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
@ -124,17 +94,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
getAllergies(SOAPViewModel model) async { getAllergies(SOAPViewModel model) async {
if (model.patientAllergiesList.isNotEmpty) { if (model.patientAllergiesList.isNotEmpty) {
model.patientAllergiesList.forEach((element) { model.patientAllergiesList.forEach((element) {
MasterKeyModel selectedAllergy = model.getOneMasterKey( MasterKeyModel selectedAllergy = model.getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType);
masterKeys: MasterKeysService.Allergies,
id: element.allergyDiseaseId,
typeId: element.allergyDiseaseType);
MasterKeyModel selectedAllergySeverity; MasterKeyModel selectedAllergySeverity;
if (element.severity == 0) { if (element.severity == 0) {
selectedAllergySeverity = MasterKeyModel( selectedAllergySeverity = MasterKeyModel(id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
id: 0,
typeId: MasterKeysService.AllergySeverity.getMasterKeyService(),
nameAr: '',
nameEn: '');
} else { } else {
selectedAllergySeverity = model.getOneMasterKey( selectedAllergySeverity = model.getOneMasterKey(
masterKeys: MasterKeysService.AllergySeverity, masterKeys: MasterKeysService.AllergySeverity,
@ -142,17 +105,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
); );
} }
MySelectedAllergy mySelectedAllergy = MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(
SoapUtils.generateMySelectedAllergy( allergy: selectedAllergy, isChecked: element.isChecked, createdBy: element.createdBy!, remark: element.remarks, isLocal: false, allergySeverity: selectedAllergySeverity);
allergy: selectedAllergy,
isChecked: element.isChecked,
createdBy: element.createdBy,
remark: element.remarks,
isLocal: false,
allergySeverity: selectedAllergySeverity);
if (selectedAllergy != null && selectedAllergySeverity != null) if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
myAllergiesList.add(mySelectedAllergy);
}); });
} }
} }
@ -164,26 +120,23 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
myAllergiesList.clear(); myAllergiesList.clear();
myHistoryList.clear(); myHistoryList.clear();
model.setSubjectiveCallBack(this); model.setSubjectiveCallBack(this);
await model.onUpdateSubjectStepStart(widget.patientInfo); await model.onUpdateSubjectStepStart(widget.patientInfo!);
if (model.patientChiefComplaintList.isNotEmpty) { if (model.patientChiefComplaintList.isNotEmpty) {
isChiefExpand = true; isChiefExpand = true;
complaintsController.text = Utils.parseHtmlString( complaintsController.text = Utils.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint!);
model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi!;
illnessController.text = model.patientChiefComplaintList[0].hopi; medicationController.text = !(model.patientChiefComplaintList[0].currentMedication)!.isNotEmpty
medicationController.text = ? model.patientChiefComplaintList[0].currentMedication! + '\n \n'
!(model.patientChiefComplaintList[0].currentMedication).isNotEmpty : model.patientChiefComplaintList[0].currentMedication!;
? model.patientChiefComplaintList[0].currentMedication +
'\n \n'
: model.patientChiefComplaintList[0].currentMedication;
} }
if (widget.patientInfo.admissionNo == null) { if (widget.patientInfo!.admissionNo == null) {
await getHistory(model); await getHistory(model);
await getAllergies(model); await getAllergies(model);
} }
widget.changeLoadingState(false); widget.changeLoadingState!(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
@ -214,19 +167,16 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
complaintsController: complaintsController, complaintsController: complaintsController,
illnessController: illnessController, illnessController: illnessController,
medicationController: medicationController, medicationController: medicationController,
complaintsControllerError: complaintsControllerError: model.complaintsControllerError,
model.complaintsControllerError,
illnessControllerError: model.illnessControllerError, illnessControllerError: model.illnessControllerError,
medicationControllerError: medicationControllerError: model.medicationControllerError,
model.medicationControllerError,
), ),
isExpanded: isChiefExpand, isExpanded: isChiefExpand,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2),
(SizeConfig.isHeightVeryShort ? 4 : 2),
), ),
if (widget.patientInfo.admissionNo == null) if (widget.patientInfo!.admissionNo == null)
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).histories, headerTitle: TranslationBase.of(context).histories,
isRequired: false, isRequired: false,
@ -236,17 +186,14 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
}); });
}, },
child: Column( child: Column(
children: [ children: [UpdateHistoryWidget(myHistoryList: myHistoryList)],
UpdateHistoryWidget(myHistoryList: myHistoryList)
],
), ),
isExpanded: isHistoryExpand, isExpanded: isHistoryExpand,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2),
(SizeConfig.isHeightVeryShort ? 4 : 2),
), ),
if (widget.patientInfo.admissionNo == null) if (widget.patientInfo!.admissionNo == null)
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).allergiesSoap, headerTitle: TranslationBase.of(context).allergiesSoap,
isRequired: false, isRequired: false,
@ -268,8 +215,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
isExpanded: isAllergiesExpand, isExpanded: isAllergiesExpand,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10),
(SizeConfig.isHeightVeryShort ? 20 : 10),
), ),
], ],
), ),
@ -280,20 +226,16 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
); );
} }
addSubjectiveInfo( addSubjectiveInfo({SOAPViewModel? model, List<MySelectedAllergy>? myAllergiesList, List<MySelectedHistory>? myHistoryList}) async {
{SOAPViewModel model,
List<MySelectedAllergy> myAllergiesList,
List<MySelectedHistory> myHistoryList}) async {
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
widget.changeLoadingState(true); widget.changeLoadingState!(true);
formKey.currentState.save(); formKey.currentState!.save();
formKey.currentState.validate(); formKey.currentState!.validate();
model.complaintsControllerError = ''; model!.complaintsControllerError = '';
model.medicationControllerError = ''; model.medicationControllerError = '';
model.illnessControllerError = ''; model.illnessControllerError = '';
if (complaintsController.text.isNotEmpty && if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty) {
illnessController.text.isNotEmpty) {
await model.postSubjectServices( await model.postSubjectServices(
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo,
complaintsText: complaintsController.text, complaintsText: complaintsController.text,
@ -303,38 +245,31 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
myAllergiesList: myAllergiesList, myAllergiesList: myAllergiesList,
); );
widget.changeLoadingState(true); widget.changeLoadingState!(true);
widget.changePageViewIndex(1); widget.changePageViewIndex!(1);
} else { } else {
setState(() { setState(() {
if (complaintsController.text.isEmpty) { if (complaintsController.text.isEmpty) {
model.complaintsControllerError = model.complaintsControllerError = TranslationBase.of(context).emptyMessage;
TranslationBase.of(context).emptyMessage;
} }
if (illnessController.text.isEmpty) { if (illnessController.text.isEmpty) {
model.illnessControllerError = model.illnessControllerError = TranslationBase.of(context).emptyMessage;
TranslationBase.of(context).emptyMessage;
} }
if (medicationController.text.isEmpty) { if (medicationController.text.isEmpty) {
model.medicationControllerError = model.medicationControllerError = TranslationBase.of(context).emptyMessage;
TranslationBase.of(context).emptyMessage;
} }
}); });
widget.changeLoadingState(false); widget.changeLoadingState!(false);
Utils.showErrorToast( Utils.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
TranslationBase.of(context).chiefComplaintErrorMsg);
} }
} }
@override @override
Function nextFunction(model) { Function nextFunction(model) {
addSubjectiveInfo( return addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
model: model,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList);
} }
} }

@ -21,22 +21,21 @@ import 'plan/update_plan_page.dart';
class UpdateSoapIndex extends StatefulWidget { class UpdateSoapIndex extends StatefulWidget {
final bool isUpdate; final bool isUpdate;
const UpdateSoapIndex({Key key, this.isUpdate}) : super(key: key); const UpdateSoapIndex({Key? key, this.isUpdate = false}) : super(key: key);
@override @override
_UpdateSoapIndexState createState() => _UpdateSoapIndexState(); _UpdateSoapIndexState createState() => _UpdateSoapIndexState();
} }
class _UpdateSoapIndexState extends State<UpdateSoapIndex> class _UpdateSoapIndexState extends State<UpdateSoapIndex> with TickerProviderStateMixin {
with TickerProviderStateMixin { PageController? _controller;
PageController _controller;
int _currentIndex = 0; int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList = []; List<MySelectedAllergy> myAllergiesList = [];
List<MySelectedHistory> myHistoryList = []; List<MySelectedHistory> myHistoryList = [];
changePageViewIndex(pageIndex, {isChangeState = true}) { changePageViewIndex(pageIndex, {isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
_controller.jumpToPage(pageIndex); _controller!.jumpToPage(pageIndex);
setState(() { setState(() {
_currentIndex = pageIndex; _currentIndex = pageIndex;
}); });
@ -63,7 +62,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -75,9 +74,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(boxShadow: <BoxShadow>[], color: Theme.of(context).scaffoldBackgroundColor),
boxShadow: <BoxShadow>[],
color: Theme.of(context).scaffoldBackgroundColor),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -95,21 +92,9 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
UpdateSubjectivePage( UpdateSubjectivePage(changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState),
changePageViewIndex: changePageViewIndex, UpdateObjectivePage(changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState),
currentIndex: _currentIndex, UpdateAssessmentPage(changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState),
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateObjectivePage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdatePlanPage( UpdatePlanPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
@ -138,8 +123,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
), ),
border: Border.all(color: HexColor('#707070'), width: 0), border: Border.all(color: HexColor('#707070'), width: 0),
), ),
height: SizeConfig.heightMultiplier! * height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 12 : 10),
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity, width: double.infinity,
child: Column( child: Column(
children: [ children: [
@ -147,9 +131,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
height: 10, height: 10,
), ),
Container( Container(
child: FractionallySizedBox( child: FractionallySizedBox(widthFactor: .80, child: getBottomSheet(model, patient)),
widthFactor: .80,
child: getBottomSheet(model, patient)),
), ),
SizedBox( SizedBox(
height: 5, height: 5,
@ -169,7 +151,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
child: AppButton( child: AppButton(
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700]!,
onPressed: () async { onPressed: () async {
model.nextOnSubjectPage(model); model.nextOnSubjectPage(model);
}, },
@ -185,7 +167,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Expanded( Expanded(
child: AppButton( child: AppButton(
title: TranslationBase.of(context).previous, title: TranslationBase.of(context).previous,
color: Colors.grey[300], color: Colors.grey[300]!,
// height: SizeConfig.heightMultiplier! * // height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort ? 8 : 6), // (SizeConfig.isHeightVeryShort ? 8 : 6),
// padding: 10, // padding: 10,
@ -201,13 +183,9 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
), ),
Expanded( Expanded(
child: AppButton( child: AppButton(
title: patient.admissionNo != null && title: patient.admissionNo != null && patient.admissionNo!.isNotEmpty && !model.isAddExamInProgress ? TranslationBase.of(context).finish : TranslationBase.of(context).next,
patient.admissionNo.isNotEmpty &&
!model.isAddExamInProgress
? TranslationBase.of(context).finish
: TranslationBase.of(context).next,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700]!,
// height: SizeConfig.heightMultiplier! * // height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort ? 8 : 6), // (SizeConfig.isHeightVeryShort ? 8 : 6),
// padding: 10, // padding: 10,
@ -230,7 +208,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Expanded( Expanded(
child: AppButton( child: AppButton(
title: TranslationBase.of(context).previous, title: TranslationBase.of(context).previous,
color: Colors.grey[300], color: Colors.grey[300]!,
fontColor: Colors.black, fontColor: Colors.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
@ -246,8 +224,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
child: AppButton( child: AppButton(
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700]!,
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
model.nextOnAssessmentPage(model); model.nextOnAssessmentPage(model);
@ -267,7 +244,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Expanded( Expanded(
child: AppButton( child: AppButton(
title: TranslationBase.of(context).previous, title: TranslationBase.of(context).previous,
color: Colors.grey[300], color: Colors.grey[300]!,
fontColor: Colors.black, fontColor: Colors.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
@ -281,12 +258,9 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
), ),
Expanded( Expanded(
child: AppButton( child: AppButton(
title: model.isAddProgress ? TranslationBase.of(context).next : TranslationBase.of(context).finish,
title: model.isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700]!,
disabled: model.progressNoteText.isEmpty, disabled: model.progressNoteText.isEmpty,
onPressed: () async { onPressed: () async {
model.nextOnPlanPage(model); model.nextOnPlanPage(model);
@ -299,5 +273,6 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
} }
break; break;
} }
return SizedBox();
} }
} }

@ -7,10 +7,10 @@ import 'package:intl/intl.dart';
class LineChartCurved extends StatelessWidget { class LineChartCurved extends StatelessWidget {
final String title; final String title;
final List<TimeSeriesSales2> timeSeries; final List<TimeSeriesSales2>? timeSeries;
final int indexes; final int indexes;
LineChartCurved({this.title, this.timeSeries, this.indexes}); LineChartCurved({this.title = '', this.timeSeries, this.indexes = 0});
List<int> xAxixs = []; List<int> xAxixs = [];
List<double> yAxixs = []; List<double> yAxixs = [];
@ -46,7 +46,7 @@ class LineChartCurved extends StatelessWidget {
children: [ children: [
AppText( AppText(
title, title,
fontSize: SizeConfig.textMultiplier * 2.1, fontSize: SizeConfig.textMultiplier! * 2.1,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -62,7 +62,7 @@ class LineChartCurved extends StatelessWidget {
padding: const EdgeInsets.only(right: 18.0, left: 16.0), padding: const EdgeInsets.only(right: 18.0, left: 16.0),
child: LineChart( child: LineChart(
sampleData1(context), sampleData1(context),
swapAnimationDuration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
), ),
), ),
), ),
@ -78,110 +78,97 @@ class LineChartCurved extends StatelessWidget {
} }
getXaxix() { getXaxix() {
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries!.length; index++) {
int mIndex = indexes * index; int mIndex = indexes * index;
if (mIndex < timeSeries.length) { if (mIndex < timeSeries!.length) {
xAxixs.add(mIndex); xAxixs.add(mIndex);
} }
} }
} }
getYaxix() { getYaxix() {
int indexess = (timeSeries.length * 0.30).toInt(); int indexess = (timeSeries!.length * 0.30).toInt();
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries!.length; index++) {
int mIndex = indexess * index; int mIndex = indexess * index;
if (mIndex < timeSeries.length) { if (mIndex < timeSeries!.length) {
yAxixs.add(timeSeries[mIndex].sales); yAxixs.add(timeSeries![mIndex].sales!);
} }
} }
} }
LineChartData sampleData1(context) { LineChartData sampleData1(context) {
return LineChartData( return LineChartData(
lineTouchData: LineTouchData( lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white, tooltipBgColor: Colors.white,
), ),
touchCallback: (LineTouchResponse touchResponse) {}, touchCallback: (event, LineTouchResponse? touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData( gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: AxisTitles(
showTitles: true, sideTitles: SideTitles(
getTextStyles: (context, value) { showTitles: true,
return TextStyle( //rotateAngle: -65,
color: Colors.black, //rotateAngle:-65,
fontSize: 10, reservedSize: 22,
); getTitlesWidget: (value, meta) {
}, if (timeSeries!.length < 15) {
rotateAngle: -65, if (timeSeries!.length > value.toInt()) {
//rotateAngle:-65, DateTime dateTime = timeSeries![value.toInt()].time;
margin: 22, if (isDatesSameYear) {
getTitles: (value) { return Text(
if (timeSeries.length < 15) { monthFormat.format(dateTime),
if (timeSeries.length > value.toInt()) { style: TextStyle(
DateTime dateTime = timeSeries[value.toInt()].time; color: Colors.black,
if (isDatesSameYear) { fontSize: 10,
return monthFormat.format(dateTime); ),
);
} else {
return Text(
yearFormat.format(dateTime),
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
}
} else { } else {
return yearFormat.format(dateTime); return Text('');
} }
} else { } else {
return ''; if (value.toInt() == 0 || value.toInt() == timeSeries!.length - 1 || xAxixs.contains(value.toInt())) {
} DateTime dateTime = timeSeries![value.toInt()].time;
} else { if (isDatesSameYear) {
if (value.toInt() == 0 || return Text(
value.toInt() == timeSeries.length - 1 || monthFormat.format(dateTime),
xAxixs.contains(value.toInt())) { style: TextStyle(
DateTime dateTime = timeSeries[value.toInt()].time; color: Colors.black,
if (isDatesSameYear) { fontSize: 10,
return monthFormat.format(dateTime); ),
} else { );
return yearFormat.format(dateTime); } else {
return Text(
yearFormat.format(dateTime),
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
}
} }
} }
} return Text('');
},
/*if (timeSeries.length < 15) {
if (timeSeries.length > value.toInt()) {
DateTime dateTime = timeSeries[value.toInt()].time;
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
} else
return '';
} else {
if (value.toInt() == 0)
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
if (value.toInt() == timeSeries.length - 1)
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
if (xAxixs.contains(value.toInt())) {
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
}
}*/
return '';
},
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,
),
interval:getInterval(),
// getTitles: (value) {
// if (value.toInt() == 0)
// return '${value.toInt()}';
// else if (value.toInt() % horizontalInterval == 0)
// return '${value.toInt()}';
// else
// return '';
// },
margin: 12,
), ),
),
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
interval: getInterval(),
reservedSize: 12,
)),
), ),
borderData: FlBorderData( borderData: FlBorderData(
show: true, show: true,
@ -202,7 +189,7 @@ class LineChartCurved extends StatelessWidget {
), ),
), ),
minX: 0, minX: 0,
maxX: (timeSeries.length - 1).toDouble(), maxX: (timeSeries!.length - 1).toDouble(),
maxY: getMaxY() + getInterval(), maxY: getMaxY() + getInterval(),
minY: 0, minY: 0,
lineBarsData: getData(context), lineBarsData: getData(context),
@ -230,21 +217,18 @@ class LineChartCurved extends StatelessWidget {
// return value.toDouble(); // return value.toDouble();
// } // }
double getInterval() {
double getInterval(){
return getMaxY() - getMinY() <= 100 return getMaxY() - getMinY() <= 100
? 20 ? 20
: getMaxY() - getMinY() <= 1000 : getMaxY() - getMinY() <= 1000
? 100 ? 100
: 200; : 200;
} }
double getMaxY() { double getMaxY() {
double max = 0; double max = 0;
timeSeries.forEach((element) { timeSeries!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales!;
if (resultValueDouble > max) max = resultValueDouble; if (resultValueDouble > max) max = resultValueDouble;
}); });
@ -252,9 +236,9 @@ class LineChartCurved extends StatelessWidget {
} }
double getMinY() { double getMinY() {
double min = timeSeries[0].sales; double min = timeSeries![0].sales!;
timeSeries.forEach((element) { timeSeries!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales!;
if (resultValueDouble < min) min = resultValueDouble; if (resultValueDouble < min) min = resultValueDouble;
}); });
int value = min.toInt(); int value = min.toInt();
@ -266,20 +250,18 @@ class LineChartCurved extends StatelessWidget {
List<FlSpot> spots = []; List<FlSpot> spots = [];
isDatesSameYear = true; isDatesSameYear = true;
int previousDateYear = 0; int previousDateYear = 0;
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries!.length; index++) {
spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); spots.add(FlSpot(index.toDouble(), timeSeries![index].sales!));
if (isDatesSameYear == false || if (isDatesSameYear == false || (previousDateYear != 0 && previousDateYear != timeSeries![index].time.year)) {
(previousDateYear != 0 &&
previousDateYear != timeSeries[index].time.year)) {
isDatesSameYear = false; isDatesSameYear = false;
} }
previousDateYear = timeSeries[index].time.year; previousDateYear = timeSeries![index].time.year;
} }
final LineChartBarData lineChartBarData1 = LineChartBarData( final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [Colors.red] /*[Theme.of(context).primaryColor]*/, color: Colors.red /*[Theme.of(context).primaryColor]*/,
barWidth: 5, barWidth: 5,
isStrokeCapRound: true, isStrokeCapRound: true,
dotData: FlDotData( dotData: FlDotData(

@ -7,17 +7,12 @@ import 'package:flutter/material.dart';
class LineChartCurvedBloodPressure extends StatelessWidget { class LineChartCurvedBloodPressure extends StatelessWidget {
final String title; final String title;
final List<TimeSeriesSales2> timeSeries1; final List<TimeSeriesSales2>? timeSeries1;
final List<TimeSeriesSales2> timeSeries2; final List<TimeSeriesSales2>? timeSeries2;
final int indexes; final int indexes;
final bool isOX; final bool isOX;
LineChartCurvedBloodPressure( LineChartCurvedBloodPressure({this.title = '', this.timeSeries1, this.indexes = 0, this.timeSeries2, this.isOX = false});
{this.title,
this.timeSeries1,
this.indexes,
this.timeSeries2,
this.isOX = false});
List<int> xAxixs = []; List<int> xAxixs = [];
List<double> yAxixs = []; List<double> yAxixs = [];
@ -45,7 +40,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
children: [ children: [
AppText( AppText(
title, title,
fontSize: SizeConfig.textMultiplier * 2.1, fontSize: SizeConfig.textMultiplier! * 2.1,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -58,11 +53,10 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
), ),
Expanded( Expanded(
child: Padding( child: Padding(
padding: padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15),
const EdgeInsets.only(right: 18.0, left: 16.0, top: 15),
child: LineChart( child: LineChart(
sampleData1(context), sampleData1(context),
swapAnimationDuration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
), ),
), ),
), ),
@ -78,15 +72,12 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
Container( Container(
width: 20, width: 20,
height: 20, height: 20,
decoration: BoxDecoration( decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor),
shape: BoxShape.rectangle,
color: Theme.of(context).primaryColor),
), ),
SizedBox( SizedBox(
width: 5, width: 5,
), ),
AppText( AppText(isOX ? "SAO2" : TranslationBase.of(context).systolicLng)
isOX ? "SAO2" : TranslationBase.of(context).systolicLng)
], ],
), ),
SizedBox( SizedBox(
@ -97,8 +88,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
Container( Container(
width: 20, width: 20,
height: 20, height: 20,
decoration: BoxDecoration( decoration: BoxDecoration(shape: BoxShape.rectangle, color: Colors.red),
shape: BoxShape.rectangle, color: Colors.red),
), ),
SizedBox( SizedBox(
width: 5, width: 5,
@ -117,9 +107,9 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
} }
getXaxix() { getXaxix() {
for (int index = 0; index < timeSeries1.length; index++) { for (int index = 0; index < timeSeries1!.length; index++) {
int mIndex = indexes * index; int mIndex = indexes * index;
if (mIndex < timeSeries1.length) { if (mIndex < timeSeries1!.length) {
xAxixs.add(mIndex); xAxixs.add(mIndex);
} }
} }
@ -131,54 +121,73 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white, tooltipBgColor: Colors.white,
), ),
touchCallback: (LineTouchResponse touchResponse) {}, touchCallback: (event, LineTouchResponse? touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData( gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true, showTitles: true,
getTextStyles: (context, value) { //rotateAngle: -65,
return TextStyle(
color: Colors.black,
fontSize: 10,
);
},
rotateAngle: -65,
//rotateAngle:-65, //rotateAngle:-65,
margin: 22, reservedSize: 22,
getTitles: (value) { getTitlesWidget: (value, meta) {
if (timeSeries1.length < 15) { if (timeSeries1!.length < 15) {
if (timeSeries1.length > value.toInt()) { if (timeSeries1!.length > value.toInt()) {
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; return Text(
'${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
} else } else
return ''; return Text("");
} else { } else {
if (value.toInt() == 0) if (value.toInt() == 0)
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; return Text(
if (value.toInt() == timeSeries1.length - 1) '${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}',
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
if (value.toInt() == timeSeries1!.length - 1)
return Text('${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
));
if (xAxixs.contains(value.toInt())) { if (xAxixs.contains(value.toInt())) {
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; return Text(
'${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
);
} }
} }
return ''; return Text("");
}, },
), )),
leftTitles: SideTitles( leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true, showTitles: true,
getTextStyles: (cxt, value) => const TextStyle( interval: getInterval(),
color: Colors.black, getTitlesWidget: (value, meta) {
fontWeight: FontWeight.bold, return Text(
fontSize: 10, '${value.toInt()}',
), style: TextStyle(
interval:getInterval(), color: Colors.black,
getTitles: (value) { fontWeight: FontWeight.bold,
return '${value.toInt()}'; fontSize: 10,
),
);
}, },
margin: 12, reservedSize: 12,
), )),
), ),
borderData: FlBorderData( borderData: FlBorderData(
show: true, show: true,
@ -200,28 +209,24 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
), ),
minX: 0, minX: 0,
maxX: 0, maxX: 0,
maxY: getMaxY() + getInterval(), maxY: getMaxY() + getInterval(),
minY: 0, minY: 0,
lineBarsData: getData(context), lineBarsData: getData(context),
); );
} }
double getInterval(){ double getInterval() {
return getMaxY() - getMinY() <= 100 return getMaxY() - getMinY() <= 100
? 20 ? 20
: getMaxY() - getMinY() <= 1000 : getMaxY() - getMinY() <= 1000
? 100 ? 100
: 200; : 200;
} }
double getMaxY() { double getMaxY() {
double max = 0; double max = 0;
timeSeries1.forEach((element) { timeSeries1!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales!;
if (resultValueDouble > max) max = resultValueDouble; if (resultValueDouble > max) max = resultValueDouble;
}); });
@ -229,15 +234,16 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
} }
double getMinY() { double getMinY() {
double min = timeSeries1[0].sales; double min = timeSeries1![0].sales!;
timeSeries1.forEach((element) { timeSeries1!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales!;
if (resultValueDouble < min) min = resultValueDouble; if (resultValueDouble < min) min = resultValueDouble;
}); });
int value = min.toInt(); int value = min.toInt();
return value.toDouble(); return value.toDouble();
} }
// double getMaxY() { // double getMaxY() {
// double max = 0; // double max = 0;
// timeSeries1.forEach((element) { // timeSeries1.forEach((element) {
@ -270,19 +276,19 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
List<LineChartBarData> getData(context) { List<LineChartBarData> getData(context) {
List<FlSpot> spots = []; List<FlSpot> spots = [];
for (int index = 0; index < timeSeries1.length; index++) { for (int index = 0; index < timeSeries1!.length; index++) {
spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); spots.add(FlSpot(index.toDouble(), timeSeries1![index].sales!));
} }
List<FlSpot> spots2 = []; List<FlSpot> spots2 = [];
for (int index = 0; index < timeSeries2.length; index++) { for (int index = 0; index < timeSeries2!.length; index++) {
spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); spots2.add(FlSpot(index.toDouble(), timeSeries2![index].sales!));
} }
final LineChartBarData lineChartBarData1 = LineChartBarData( final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [Theme.of(context).primaryColor], color: Theme.of(context).primaryColor,
barWidth: 5, barWidth: 5,
isStrokeCapRound: true, isStrokeCapRound: true,
dotData: FlDotData( dotData: FlDotData(
@ -295,7 +301,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
final LineChartBarData lineChartBarData2 = LineChartBarData( final LineChartBarData lineChartBarData2 = LineChartBarData(
spots: spots2, spots: spots2,
isCurved: true, isCurved: true,
colors: [Colors.red], color: Colors.red,
barWidth: 5, barWidth: 5,
isStrokeCapRound: true, isStrokeCapRound: true,
dotData: FlDotData( dotData: FlDotData(

@ -98,7 +98,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
TranslationBase.of(context) TranslationBase.of(context)
.painScale, .painScale,
fontSize: fontSize:
SizeConfig.textMultiplier * 1.5, SizeConfig.textMultiplier! * 1.5,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -112,7 +112,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier! *
1.3, 1.3,
), ),
), ),
@ -128,7 +128,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
child: AppText( child: AppText(
"Location", "Location",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.5, SizeConfig.textMultiplier! * 1.5,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -142,7 +142,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier! *
1.3, 1.3,
), ),
), ),
@ -157,7 +157,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
child: AppText( child: AppText(
"Character", "Character",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.5, SizeConfig.textMultiplier! * 1.5,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -171,7 +171,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier! *
1.3, 1.3,
), ),
), ),
@ -186,7 +186,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
child: AppText( child: AppText(
"Duration", "Duration",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.5, SizeConfig.textMultiplier! * 1.5,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -200,7 +200,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier! *
1.3, 1.3,
), ),
), ),
@ -216,7 +216,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
TranslationBase.of(context) TranslationBase.of(context)
.painManagement, .painManagement,
fontSize: fontSize:
SizeConfig.textMultiplier * 1.5, SizeConfig.textMultiplier! * 1.5,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -230,7 +230,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier! *
1.3, 1.3,
), ),
), ),
@ -245,7 +245,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
child: AppText( child: AppText(
"Frequency", "Frequency",
fontSize: fontSize:
SizeConfig.textMultiplier * 1.5, SizeConfig.textMultiplier! * 1.5,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -259,7 +259,7 @@ class VitalSignDetailPainScale extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier! *
1.3, 1.3,
), ),
), ),
@ -281,13 +281,13 @@ class VitalSignDetailPainScale extends StatelessWidget {
"${AppDateUtils.convertDateFromServerFormat(vitalList[index].createdOn, "E , dd MMM")}", "${AppDateUtils.convertDateFromServerFormat(vitalList[index].createdOn, "E , dd MMM")}",
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
AppText( AppText(
"${AppDateUtils.convertDateFromServerFormat(vitalList[index].createdOn, "hh:mm a")}", "${AppDateUtils.convertDateFromServerFormat(vitalList[index].createdOn, "hh:mm a")}",
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF28353E), color: Color(0XFF28353E),
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
), ),
], ],
), ),

@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class VitalSignBloodPressureWidget extends StatefulWidget { class VitalSignBloodPressureWidget extends StatefulWidget {
final List<VitalSignHistory> vitalList; final List<VitalSignHistory>? vitalList;
final String title1; final String title1;
final String title2; final String title2;
final String title3; final String title3;
@ -17,13 +17,13 @@ class VitalSignBloodPressureWidget extends StatefulWidget {
final String viewKey2; final String viewKey2;
VitalSignBloodPressureWidget( VitalSignBloodPressureWidget(
{Key key, {Key? key,
this.vitalList, this.vitalList,
this.title1, this.title1 = '' ,
this.title2, this.title2 = '',
this.viewKey1, this.viewKey1 = '',
this.title3, this.title3 = '',
this.viewKey2}); this.viewKey2 = ''});
@override @override
_VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState();
@ -48,7 +48,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: AppText( child: AppText(
TranslationBase.of(context).date, TranslationBase.of(context).date,
fontSize: SizeConfig.textMultiplier * 1.5, fontSize: SizeConfig.textMultiplier! * 1.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -62,7 +62,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
child: Container( child: Container(
child: AppText( child: AppText(
widget.title2, widget.title2,
fontSize: SizeConfig.textMultiplier * 1.5, fontSize: SizeConfig.textMultiplier! * 1.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -76,7 +76,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
child: Container( child: Container(
child: AppText( child: AppText(
widget.title3, widget.title3,
fontSize: SizeConfig.textMultiplier * 1.5, fontSize: SizeConfig.textMultiplier! * 1.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -94,7 +94,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
Table( Table(
border: TableBorder( border: TableBorder(
horizontalInside: horizontalInside:
BorderSide(width: 1.0, color: Colors.grey[300]), BorderSide(width: 1.0, color: Colors.grey[300]!),
), ),
children: fullData(projectViewModel), children: fullData(projectViewModel),
), ),
@ -122,7 +122,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
height: 60), height: 60),
), ),
]));*/ ]));*/
widget.vitalList.forEach((vital) { widget.vitalList!.forEach((vital) {
var data = vital.toJson()[widget.viewKey1]; var data = vital.toJson()[widget.viewKey1];
DateTime elementDate = DateTime elementDate =
AppDateUtils.getDateTimeFromServerFormat(vital.createdOn); AppDateUtils.getDateTimeFromServerFormat(vital.createdOn);
@ -135,7 +135,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
child: AppText( child: AppText(
'${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}', '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}',
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -149,7 +149,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
child: AppText( child: AppText(
'${vital.toJson()[widget.viewKey1]}', '${vital.toJson()[widget.viewKey1]}',
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -163,7 +163,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignBloodPressureWidget> {
child: AppText( child: AppText(
'${vital.toJson()[widget.viewKey2]}', '${vital.toJson()[widget.viewKey2]}',
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',

@ -20,12 +20,11 @@ class VitalSignDetailsScreen extends StatelessWidget {
int projectID; int projectID;
bool isNotOneAppointment; bool isNotOneAppointment;
VitalSignDetailsScreen( VitalSignDetailsScreen({this.appointmentNo = 0, this.projectID = 0, this.isNotOneAppointment = true});
{this.appointmentNo, this.projectID, this.isNotOneAppointment = true});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
@ -36,8 +35,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
String assetBasePath = "${imageBasePath}patient/vital_signs/"; String assetBasePath = "${imageBasePath}patient/vital_signs/";
return BaseView<VitalSignsViewModel>( return BaseView<VitalSignsViewModel>(
onModelReady: (model) => onModelReady: (model) => model.getPatientVitalSignHistory(patient, from, to, isInpatient),
model.getPatientVitalSignHistory(patient, from, to, isInpatient),
builder: (_, mode, widget) => AppScaffold( builder: (_, mode, widget) => AppScaffold(
baseViewModel: mode, baseViewModel: mode,
isShowAppBar: true, isShowAppBar: true,
@ -59,13 +57,13 @@ class VitalSignDetailsScreen extends StatelessWidget {
children: [ children: [
AppText( AppText(
"${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s",
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
TranslationBase.of(context).vitalSign, TranslationBase.of(context).vitalSign,
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier! * 3,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
) )
@ -76,8 +74,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
height: MediaQuery.of(context).size.height * 0.23, height: MediaQuery.of(context).size.height * 0.23,
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(12.0), padding: EdgeInsets.all(12.0),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
horizontal: 16.0, vertical: 8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
color: Colors.white, color: Colors.white,
@ -93,7 +90,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).yourBodyMassIndex} ${mode.bodyMax}", "${TranslationBase.of(context).yourBodyMassIndex} ${mode.bodyMax}",
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: SizeConfig.textMultiplier * 2.0, fontSize: SizeConfig.textMultiplier! * 2.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
Row( Row(
@ -101,17 +98,11 @@ class VitalSignDetailsScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 1 mode.getBMIStatus() != 1 ? '${assetBasePath}underweight_BMI.png' : '${assetBasePath}underweight_BMI-r.png',
? '${assetBasePath}underweight_BMI.png' height: MediaQuery.of(context).size.height * 0.10,
: '${assetBasePath}underweight_BMI-r.png',
height: MediaQuery.of(context)
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -119,38 +110,26 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).bmiUnderWeight}", "${TranslationBase.of(context).bmiUnderWeight}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier * 1.15, color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : Colors.grey,
color: mode.getBMIStatus() == 1
? Color(0XFFD02127)
: null,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
AppText( AppText(
"(<18.5)", "(<18.5)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier * 1.15, color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : Colors.grey,
color: mode.getBMIStatus() == 1
? Color(0XFFD02127)
: null,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 2 mode.getBMIStatus() != 2 ? '${assetBasePath}health_BMI.png' : '${assetBasePath}health_BMI-r.png',
? '${assetBasePath}health_BMI.png' height: MediaQuery.of(context).size.height * 0.10,
: '${assetBasePath}health_BMI-r.png',
height: MediaQuery.of(context)
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -159,40 +138,27 @@ class VitalSignDetailsScreen extends StatelessWidget {
child: AppText( child: AppText(
"${TranslationBase.of(context).normal}", "${TranslationBase.of(context).normal}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier *
1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 2 color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
), ),
AppText( AppText(
"(18.5-24.9)", "(18.5-24.9)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 2 color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 3 mode.getBMIStatus() != 3 ? '${assetBasePath}ovrweight_BMI.png' : '${assetBasePath}ovrweight_BMI-r.png',
? '${assetBasePath}ovrweight_BMI.png' height: MediaQuery.of(context).size.height * 0.10,
: '${assetBasePath}ovrweight_BMI-r.png',
height: MediaQuery.of(context)
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -200,38 +166,26 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).bmiOverWeight}", "${TranslationBase.of(context).bmiOverWeight}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.155,
SizeConfig.textMultiplier * 1.155,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 3 color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
AppText( AppText(
"(25-29.9)", "(25-29.9)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.155,
SizeConfig.textMultiplier * 1.155,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 3 color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 4 mode.getBMIStatus() != 4 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png',
? '${assetBasePath}Obese_BMI.png' height: MediaQuery.of(context).size.height * 0.10,
: '${assetBasePath}Obese_BMI-r.png',
height: MediaQuery.of(context)
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -239,38 +193,26 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).bmiObese}", "${TranslationBase.of(context).bmiObese}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 4 color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
AppText( AppText(
"(30-34.9)", "(30-34.9)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 4 color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 5 mode.getBMIStatus() != 5 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png',
? '${assetBasePath}Obese_BMI.png' height: MediaQuery.of(context).size.height * 0.10,
: '${assetBasePath}Obese_BMI-r.png',
height: MediaQuery.of(context)
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -280,24 +222,17 @@ class VitalSignDetailsScreen extends StatelessWidget {
child: AppText( child: AppText(
"${TranslationBase.of(context).bmiObeseExtreme}", "${TranslationBase.of(context).bmiObeseExtreme}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier *
1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 5 color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
), ),
AppText( AppText(
"(35<)", "(35<)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier! * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 5 color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : Colors.grey,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
@ -309,8 +244,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16),
horizontal: 16.0, vertical: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -326,16 +260,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Height,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).height,
.Height, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.height,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -345,40 +273,28 @@ class VitalSignDetailsScreen extends StatelessWidget {
: null, : null,
child: Container( child: Container(
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).height,
.height, imagePath: "${assetBasePath}height.png",
imagePath:
"${assetBasePath}height.png",
lastVal: mode.heightCm, lastVal: mode.heightCm,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).cm,
.cm,
), ),
), ),
), ),
if (isNotOneAppointment) if (isNotOneAppointment)
InkWell( InkWell(
onTap: () async { onTap: () async {
await locator<AnalyticsService>() await locator<AnalyticsService>().logEvent(
.logEvent( eventCategory: "Vital Sign Details Screen",
eventCategory: eventAction: "Vital Sign Details",
"Vital Sign Details Screen",
eventAction:
"Vital Sign Details",
); );
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Weight,
pageKey: pageTitle: TranslationBase.of(context).weight,
vitalSignDetails.Weight, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.weight,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -387,12 +303,9 @@ class VitalSignDetailsScreen extends StatelessWidget {
); );
}, },
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).weight,
.weight, imagePath: "${assetBasePath}weight.png",
imagePath: unit: TranslationBase.of(context).kg,
"${assetBasePath}weight.png",
unit: TranslationBase.of(context)
.kg,
lastVal: mode.weightKg, lastVal: mode.weightKg,
), ),
), ),
@ -401,16 +314,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Temperature,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).temperature,
.Temperature, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.temperature,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -420,13 +327,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
: null, : null,
child: Container( child: Container(
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).temperature,
.temperature, imagePath: "${assetBasePath}temperature.png",
imagePath:
"${assetBasePath}temperature.png",
lastVal: mode.temperatureCelcius, lastVal: mode.temperatureCelcius,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).tempC,
.tempC,
), ),
), ),
), ),
@ -435,16 +339,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.heart,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).heart,
.heart, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.heart,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -453,13 +351,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).heart,
.heart, imagePath: "${assetBasePath}heart_rate.png",
imagePath:
"${assetBasePath}heart_rate.png",
lastVal: mode.hartRat, lastVal: mode.hartRat,
unit: unit: TranslationBase.of(context).bpm,
TranslationBase.of(context).bpm,
), ),
), ),
InkWell( InkWell(
@ -467,16 +362,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Respiration,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).respirationRate,
.Respiration, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.respirationRate,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -485,14 +374,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).respirationRate,
.respirationRate, imagePath: "${assetBasePath}respiration_rate.png",
imagePath: lastVal: mode.respirationBeatPerMinute,
"${assetBasePath}respiration_rate.png", unit: TranslationBase.of(context).respirationSigns,
lastVal:
mode.respirationBeatPerMinute,
unit: TranslationBase.of(context)
.respirationSigns,
), ),
), ),
InkWell( InkWell(
@ -500,16 +385,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.BloodPressure,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).bloodPressure,
.BloodPressure, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.bloodPressure,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -518,13 +397,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).bloodPressure,
.bloodPressure, imagePath: "${assetBasePath}blood_pressure.png",
imagePath:
"${assetBasePath}blood_pressure.png",
lastVal: mode.bloodPressure, lastVal: mode.bloodPressure,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).sysDias,
.sysDias,
), ),
), ),
InkWell( InkWell(
@ -532,16 +408,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Oxygenation,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).oxygenation,
.Oxygenation, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.oxygenation,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -550,10 +420,8 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).oxygenation,
.oxygenation, imagePath: "${assetBasePath}oxg.png",
imagePath:
"${assetBasePath}oxg.png",
lastVal: "${mode.oxygenation}%", lastVal: "${mode.oxygenation}%",
unit: "", unit: "",
), ),
@ -563,16 +431,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.PainScale,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).painScale,
.PainScale, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.painScale,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -581,13 +443,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).painScale,
.painScale, imagePath: "${assetBasePath}painScale.png",
imagePath:
"${assetBasePath}painScale.png",
lastVal: mode.painScore, lastVal: mode.painScore,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).severe,
.severe,
), ),
), ),
], ],

@ -9,13 +9,13 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class VitalSignDetailsWidget extends StatefulWidget { class VitalSignDetailsWidget extends StatefulWidget {
final List<VitalSignHistory> vitalList; final List<VitalSignHistory>? vitalList;
final String title1; final String title1;
final String title2; final String title2;
final String viewKey; final String viewKey;
VitalSignDetailsWidget( VitalSignDetailsWidget(
{Key key, this.vitalList, this.title1, this.title2, this.viewKey}); {Key? key, this.vitalList, this.title1 = '', this.title2 = '', this.viewKey =''});
@override @override
_VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState();
@ -53,7 +53,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
),*/ ),*/
child: AppText( child: AppText(
TranslationBase.of(context).date, TranslationBase.of(context).date,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -74,7 +74,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
),*/ ),*/
child: AppText( child: AppText(
widget.title2, widget.title2,
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
@ -92,7 +92,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
Table( Table(
border: TableBorder( border: TableBorder(
horizontalInside: horizontalInside:
BorderSide(width: 1.0, color: Colors.grey[300]), BorderSide(width: 1.0, color: Colors.grey[300]!),
), ),
children: fullData(projectViewModel), children: fullData(projectViewModel),
), ),
@ -107,7 +107,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
/* tableRow.add(TableRow(children: [ /* tableRow.add(TableRow(children: [
]));*/ ]));*/
widget.vitalList.forEach((vital) { widget.vitalList!.forEach((vital) {
var data = vital.toJson()[widget.viewKey]; var data = vital.toJson()[widget.viewKey];
DateTime elementDate = DateTime elementDate =
AppDateUtils.getDateTimeFromServerFormat(vital.createdOn); AppDateUtils.getDateTimeFromServerFormat(vital.createdOn);
@ -120,7 +120,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
child: AppText( child: AppText(
'${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}', '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}',
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -134,7 +134,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
child: AppText( child: AppText(
'${vital.toJson()[widget.viewKey]}', '${vital.toJson()[widget.viewKey]}',
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Poppins', fontFamily: 'Poppins',

@ -13,13 +13,13 @@ class VitalSignItem extends StatelessWidget {
final double width; final double width;
const VitalSignItem( const VitalSignItem(
{Key key, {Key? key,
@required this.des, required this.des,
this.lastVal = 'N/A', this.lastVal = 'N/A',
this.unit = '', this.unit = '',
this.height, this.height = 0,
this.width, this.width = 0,
@required this.imagePath}) required this.imagePath})
: super(key: key); : super(key: key);
@override @override
@ -50,7 +50,7 @@ class VitalSignItem extends StatelessWidget {
AppText( AppText(
"$lastVal", "$lastVal",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.4, fontSize: SizeConfig.textMultiplier! * 1.4,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
margin: 0, margin: 0,
@ -61,7 +61,7 @@ class VitalSignItem extends StatelessWidget {
AppText( AppText(
"$unit", "$unit",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.2, fontSize: SizeConfig.textMultiplier! * 1.2,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFFD02127), color: Color(0xFFD02127),
margin: 0, margin: 0,
@ -100,7 +100,7 @@ class VitalSignItem extends StatelessWidget {
child: AppText( child: AppText(
"$des", "$des",
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: SizeConfig.textMultiplier * 1.3, fontSize: SizeConfig.textMultiplier! * 1.3,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

@ -14,22 +14,22 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class VitalSignItemDetailsScreen extends StatelessWidget { class VitalSignItemDetailsScreen extends StatelessWidget {
final vitalSignDetails pageKey; final vitalSignDetails? pageKey;
final String pageTitle; final String pageTitle;
List<Map> VSchart; List<Map>? VSchart;
PatiantInformtion patient; PatiantInformtion? patient;
String patientType; String patientType;
String arrivalType; String arrivalType;
VitalSignItemDetailsScreen( VitalSignItemDetailsScreen(
{this.vitalList, {this.vitalList,
this.pageKey, this.pageKey,
this.pageTitle, this.pageTitle = '',
this.patient, this.patient,
this.patientType, this.patientType = '',
this.arrivalType}); this.arrivalType = ''});
final List<VitalSignHistory> vitalList; final List<VitalSignHistory>? vitalList;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -191,7 +191,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget {
backgroundColor: Color.fromRGBO(248, 248, 248, 1), backgroundColor: Color.fromRGBO(248, 248, 248, 1),
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient!,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
@ -203,15 +203,15 @@ class VitalSignItemDetailsScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
"${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", "${patient!.firstName ?? patient?.patientDetails?.firstName ?? patient!.fullName ?? ''}'s",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
AppText( AppText(
TranslationBase.of(context).vitalSign, TranslationBase.of(context).vitalSign,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier! * 3,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
) )
], ],
@ -221,20 +221,20 @@ class VitalSignItemDetailsScreen extends StatelessWidget {
child: ListView( child: ListView(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
children: VSchart.map((chartInfo) { children: VSchart!.map((chartInfo) {
var vitalListTemp = vitalList.where( var vitalListTemp = vitalList!.where(
(element) => element.toJson()[chartInfo['viewKey']] != null, (element) => element.toJson()[chartInfo['viewKey']] != null,
); );
if (chartInfo['viewKey'] == 'PainScore') { if (chartInfo['viewKey'] == 'PainScore') {
return VitalSignDetailPainScale(vitalList); return VitalSignDetailPainScale(vitalList!);
} }
if (vitalListTemp.length != 0 && if (vitalListTemp.length != 0 &&
chartInfo['viewKey'] == 'BloodPressure' || chartInfo['viewKey'] == 'BloodPressure' ||
chartInfo['viewKey'] == 'O2') { chartInfo['viewKey'] == 'O2') {
return VitalSingChartBloodPressure( return VitalSingChartBloodPressure(
vitalList: vitalList, vitalList: vitalList!,
name: projectViewModel.isArabic name: projectViewModel.isArabic
? chartInfo['nameAr'] ? chartInfo['nameAr']
: chartInfo['name'], : chartInfo['name'],
@ -256,7 +256,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget {
return vitalListTemp.length != 0 return vitalListTemp.length != 0
? VitalSingChartAndDetials( ? VitalSingChartAndDetials(
vitalList: vitalList, vitalList: vitalList!,
name: projectViewModel.isArabic name: projectViewModel.isArabic
? chartInfo['nameAr'] ? chartInfo['nameAr']
: chartInfo['name'], : chartInfo['name'],

@ -11,12 +11,12 @@ import 'line_chart_curved.dart';
class VitalSingChartAndDetials extends StatelessWidget { class VitalSingChartAndDetials extends StatelessWidget {
VitalSingChartAndDetials({ VitalSingChartAndDetials({
Key key, Key? key,
@required this.vitalList, required this.vitalList,
@required this.name, required this.name,
@required this.viewKey, required this.viewKey,
@required this.title1, required this.title1,
@required this.title2, required this.title2,
}) : super(key: key); }) : super(key: key);
final List<VitalSignHistory> vitalList; final List<VitalSignHistory> vitalList;
@ -57,7 +57,7 @@ class VitalSingChartAndDetials extends StatelessWidget {
children: [ children: [
AppText( AppText(
TranslationBase.of(context).graphDetails, TranslationBase.of(context).graphDetails,
fontSize: SizeConfig.textMultiplier * 2.1, fontSize: SizeConfig.textMultiplier! * 2.1,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),

@ -11,14 +11,14 @@ import 'line_chart_curved_blood_pressure.dart';
class VitalSingChartBloodPressure extends StatelessWidget { class VitalSingChartBloodPressure extends StatelessWidget {
VitalSingChartBloodPressure({ VitalSingChartBloodPressure({
Key key, Key? key,
@required this.vitalList, required this.vitalList,
@required this.name, required this.name,
@required this.viewKey1, required this.viewKey1,
@required this.viewKey2, required this.viewKey2,
@required this.title1, required this.title1,
@required this.title2, required this.title2,
@required this.title3, required this.title3,
}) : super(key: key); }) : super(key: key);
final List<VitalSignHistory> vitalList; final List<VitalSignHistory> vitalList;
@ -64,7 +64,7 @@ class VitalSingChartBloodPressure extends StatelessWidget {
children: [ children: [
AppText( AppText(
TranslationBase.of(context).graphDetails, TranslationBase.of(context).graphDetails,
fontSize: SizeConfig.textMultiplier * 2.3, fontSize: SizeConfig.textMultiplier! * 2.3,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save