fix birthOfDate

html_editor
Elham Rababah 3 years ago
parent 8e140abee9
commit d49d52458b

@ -328,4 +328,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69
COCOAPODS: 1.10.1
COCOAPODS: 1.10.0.rc.1

@ -143,6 +143,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
"isInpatient": false,
"arrivalType": "0",
"isSearchAndOut": false,
"isFromLiveCare":true
});
},
// isFromSearch: widget.isSearch,

@ -97,18 +97,16 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Column(
children: [
PatientProfileHeaderNewDesignAppBar(
patient,
arrivalType ?? '0',
patientType,
patient, arrivalType ?? '0', patientType,
isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null &&
patient.patientStatusType == 43)
? 210
: isDischargedPatient
? 240
: 0,
isDischargedPatient:isDischargedPatient
),
isDischargedPatient: isDischargedPatient),
Container(
height: !isSearchAndOut
? isDischargedPatient

@ -305,12 +305,13 @@ class AppDateUtils {
return DateFormat('hh:mm a').format(dateTime);
}
static String getAgeByBirthday(dynamic birthday, BuildContext context, { bool isServerFormat = true}) {
static String getAgeByBirthday(String birthOfDate, BuildContext context, { bool isServerFormat = true}) {
// https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate;
if(isServerFormat){ birthDate = AppDateUtils.getDateTimeFromServerFormat(birthday);
if(birthOfDate.contains("/Date")) {
birthDate = AppDateUtils.getDateTimeFromServerFormat(birthOfDate);
}else{
birthDate = DateTime.parse('1986-08-15');
birthDate = DateTime.parse(birthOfDate);
}
final now = DateTime.now();
int years = now.year - birthDate.year;

@ -19,9 +19,10 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final double height;
final bool isInpatient;
final bool isDischargedPatient;
final bool isFromLiveCare;
PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false});
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false});
@override
Widget build(BuildContext context) {
@ -152,7 +153,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
))
: SizedBox(),
if (SERVICES_PATIANT2[int.parse(patientType)] ==
"List_MyOutPatient")
"List_MyOutPatient" && !isFromLiveCare)
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
@ -182,7 +183,6 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
SizedBox(
width: 3.5,
),
Container(
child: AppText(
convertDateFormat2(
@ -261,7 +261,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
style: TextStyle(fontSize: 14)),
new TextSpan(
text:
"${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,)}",
"${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,isServerFormat: !isFromLiveCare)}",
style: TextStyle(
fontWeight: FontWeight.w700, fontSize: 14)),
],

Loading…
Cancel
Save