simple changes

merge-requests/263/head
mosazaid 5 years ago
parent e808d48035
commit cd95a581f0

@ -40,7 +40,8 @@ class MyReferralDetailScreen extends StatelessWidget {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
body: model.patientArrivalList != null ? Column( body: model.patientArrivalList != null
? Column(
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
@ -52,7 +53,8 @@ class MyReferralDetailScreen extends StatelessWidget {
AppText( AppText(
authProvider.selectedClinicName != null authProvider.selectedClinicName != null
? authProvider.selectedClinicName ? authProvider.selectedClinicName
: authProvider.doctorProfile.clinicDescription, : authProvider
.doctorProfile.clinicDescription,
fontSize: SizeConfig.textMultiplier * 1.7, fontSize: SizeConfig.textMultiplier * 1.7,
color: Colors.white, color: Colors.white,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -63,7 +65,8 @@ class MyReferralDetailScreen extends StatelessWidget {
height: 16, height: 16,
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: AppText( child: AppText(
TranslationBase.of(context).myReferralPatient, TranslationBase.of(context).myReferralPatient,
color: Colors.black, color: Colors.black,
@ -87,34 +90,39 @@ class MyReferralDetailScreen extends StatelessWidget {
childAspectRatio: 1.8, childAspectRatio: 1.8,
crossAxisSpacing: 8, crossAxisSpacing: 8,
mainAxisSpacing: 10, mainAxisSpacing: 10,
controller: controller: new ScrollController(
new ScrollController(keepScrollOffset: false), keepScrollOffset: false),
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
crossAxisCount: 2, crossAxisCount: 2,
children: [ children: [
PatientProfileButton( PatientProfileButton(
key: key, key: key,
// patient: patient, patient: model.patientArrivalList[0],
// route: RADIOLOGY, route: MEDICAL_FILE,
nameLine1: nameLine1: TranslationBase.of(context)
TranslationBase.of(context).previewHealth, .previewHealth,
nameLine2: nameLine2: TranslationBase.of(context)
TranslationBase.of(context).summaryReport, .summaryReport,
icon: 'radiology-1.png'), icon: 'radiology-1.png'),
PatientProfileButton( PatientProfileButton(
key: key, key: key,
// patient: patient, patient: model.patientArrivalList[0],
// route: LAB_ORDERS, route: LAB_ORDERS,
nameLine1: TranslationBase.of(context).lab, nameLine1:
nameLine2: TranslationBase.of(context).result, TranslationBase.of(context).lab,
nameLine2:
TranslationBase.of(context).result,
icon: 'lab.png'), icon: 'lab.png'),
PatientProfileButton( PatientProfileButton(
key: key, key: key,
patient: model.patientArrivalList[0], patient: model.patientArrivalList[0],
route: VITAL_SIGN_DETAILS /*PATIENT_VITAL_SIGN*/, route:
nameLine1: TranslationBase.of(context).vital, VITAL_SIGN_DETAILS /*PATIENT_VITAL_SIGN*/,
nameLine2: TranslationBase.of(context).signs, nameLine1:
TranslationBase.of(context).vital,
nameLine2:
TranslationBase.of(context).signs,
icon: 'heartbeat.png'), icon: 'heartbeat.png'),
], ],
), ),
@ -161,7 +169,8 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
), ),
], ],
) : Container( )
: Container(
child: Center( child: Center(
child: AppText( child: AppText(
TranslationBase.of(context).patientNoDetailErrMsg, TranslationBase.of(context).patientNoDetailErrMsg,

@ -18,6 +18,24 @@ import './profile_medical_info_widget.dart';
class PatientProfileWidget extends StatelessWidget { class PatientProfileWidget extends StatelessWidget {
PatiantInformtion patient; PatiantInformtion patient;
String getPatientAge(dynamic birthday){
// https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate = DateUtils.getDateTimeFromServerFormat(birthday);
final now = DateTime.now();
int years = now.year - birthDate .year;
int months = now.month - birthDate.month;
int days = now.day - birthDate.day;
if (months < 0 || (months == 0 && days < 0)) {
years--;
months += (days < 0 ? 11 : 12);
}
if (days < 0) {
final monthAgo = new DateTime(now.year, now.month - 1, birthDate.day);
days = now.difference(monthAgo).inDays + 1;
}
return "$years Yr $months Mnth $days Day";
}
@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;
@ -115,7 +133,7 @@ class PatientProfileWidget extends StatelessWidget {
height: 4, height: 4,
), ),
AppText( AppText(
"${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${patient.age}", "${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${getPatientAge(patient.dateofBirth)/*patient.age*/}",
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 1.6 * SizeConfig.textMultiplier, fontSize: 1.6 * SizeConfig.textMultiplier,
), ),

Loading…
Cancel
Save