From 27bbb9ac5986b873b876593b9ac5890c2778dc3a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 21 Mar 2021 17:29:51 +0300 Subject: [PATCH] changes updated --- lib/screens/dashboard_screen.dart | 163 +++++++++--------- lib/screens/patients/patients_screen.dart | 88 +++++----- lib/widgets/patients/PatientCard.dart | 13 +- .../profile/profile-welcome-widget.dart | 127 +++++++------- 4 files changed, 203 insertions(+), 188 deletions(-) diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index ac8119f0..77bbe042 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -148,87 +148,90 @@ class _DashboardScreenState extends State { Column( children: [ ProfileWelcomeWidget( - Container( - width: MediaQuery.of(context).size.width * .6, - // // height: 100, - // child: projectsProvider.doctorClinicsList.length > 0 - // ? Stack( - // children: [ - // DropdownButtonHideUnderline( - // child: DropdownButton( - // dropdownColor: Colors.white, - // iconEnabledColor: Colors.white, - // isExpanded: true, - // value: clinicId == null - // ? projectsProvider - // .doctorClinicsList[0].clinicID - // : clinicId, - // iconSize: 25, - // elevation: 16, - // selectedItemBuilder: - // (BuildContext context) { - // return projectsProvider.doctorClinicsList - // .map((item) { - // return Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // AppText( - // item.clinicName, - // fontSize: - // SizeConfig.textMultiplier * - // 2.1, - // color: Colors.white, - // ), - // ], - // ); - // }).toList(); - // }, - // onChanged: (newValue) { - // clinicId = newValue; - // changeClinic(newValue, context, model); - // }, - // items: projectsProvider.doctorClinicsList - // .map((item) { - // return DropdownMenuItem( - // child: Text( - // item.clinicName, - // textAlign: TextAlign.end, - // ), - // value: item.clinicID, - // ); - // }).toList(), - // )), - // Positioned( - // right: projectsProvider.isArabic ? 35 : 0, - // top: 0, - // child: new Container( - // padding: EdgeInsets.all(4), - // decoration: new BoxDecoration( - // color: Colors.red[800], - // borderRadius: BorderRadius.circular(20), - // ), - // constraints: BoxConstraints( - // minWidth: 20, - // minHeight: 20, - // ), - // child: new Text( - // projectsProvider - // .doctorClinicsList.length - // .toString(), - // style: new TextStyle( - // color: Colors.white, - // fontSize: projectsProvider.isArabic - // ? 10 - // : 11, - // ), - // textAlign: TextAlign.center, - // ), - // ), - // ) - // ], - // ) - // : AppText(TranslationBase.of(context).noClinic), + Row( + children: [ + Container( + padding: EdgeInsets.all(4), + margin: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + projectsProvider.doctorClinicsList.length + .toString(), + style: new TextStyle( + color: Colors.white, + fontSize: projectsProvider.isArabic ? 10 : 11, + ), + textAlign: TextAlign.center, + ), + ), + Container( + width: MediaQuery.of(context).size.width * .6, + // // height: 100, + child: projectsProvider.doctorClinicsList.length > 0 + ? Stack( + children: [ + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[0].clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return projectsProvider + .doctorClinicsList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item.clinicName, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + clinicId = newValue; + changeClinic( + newValue, context, model); + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )), + ], + ) + : AppText(TranslationBase.of(context).noClinic), + ), + ], ), + isClilic: true, ), Container( height: MediaQuery.of(context).size.height * 0.20, diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 5da9f397..9f75a731 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -221,7 +221,7 @@ class _PatientsScreenState extends State { ? widget.selectedType : routeArgs['selectedType']; - if(routeArgs != null && routeArgs.containsKey("isSearch")){ + if (routeArgs != null && routeArgs.containsKey("isSearch")) { isSearch = routeArgs['isSearch']; } @@ -306,25 +306,27 @@ class _PatientsScreenState extends State { ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 ? Column( - children: [ - - if(int.parse(patientType)==7) + children: [ + if (int.parse(patientType) == 7) + Container( + margin: EdgeInsets.only(top: 10), + child: ClinicList( + clinicId: clinicId, + onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + }, + ), + ), Container( - margin: EdgeInsets.only(top: 70), - child: ClinicList(clinicId: clinicId,onClinicChange: (newValue) { - clinicId = newValue; - changeClinic(newValue, context, model); - },), + margin: EdgeInsets.only( + top: MediaQuery.of(context).size.height * 0.35), + child: DrAppEmbeddedError( + error: TranslationBase.of(context) + .youDontHaveAnyPatient), ), - Container( - margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.35), - - child: DrAppEmbeddedError( - error: - TranslationBase.of(context).youDontHaveAnyPatient), - ), - ], - ) + ], + ) : Container( color: Colors.grey[200], child: ListView( @@ -368,11 +370,15 @@ class _PatientsScreenState extends State { SizedBox( height: 10.0, ), - if(int.parse(patientType)==7) - ClinicList(clinicId: clinicId,onClinicChange: (newValue) { - clinicId = newValue; - changeClinic(newValue, context, model); - },), + if (int.parse(patientType) == 7) + ClinicList( + clinicId: clinicId, + onClinicChange: (newValue) { + clinicId = newValue; + changeClinic( + newValue, context, model); + }, + ), Padding( padding: EdgeInsets.only( top: MediaQuery.of(context) @@ -522,27 +528,26 @@ class _PatientsScreenState extends State { tokenID: '', languageID: 2); - authProvider.getDocProfiles(docInfo.toJson(), allowChangeProfile: false) + authProvider + .getDocProfiles(docInfo.toJson(), allowChangeProfile: false) .then((profileList) async { print(profileList['DoctorProfileList'][0]); int val2 = int.parse(patientType); - GetPatientArrivalListRequestModel - - getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel( - from: patient.From, - to: patient.To, - clinicID: profileList['DoctorProfileList'][0]['ClinicID'], - doctorID: profileList['DoctorProfileList'][0]['DoctorID'].toString(), - patientMRN: patient.getPatientID, - pageIndex: 0, - pageSize: 0); - + GetPatientArrivalListRequestModel getPatientArrivalListRequestModel = + GetPatientArrivalListRequestModel( + from: patient.From, + to: patient.To, + clinicID: profileList['DoctorProfileList'][0]['ClinicID'], + doctorID: + profileList['DoctorProfileList'][0]['DoctorID'].toString(), + patientMRN: patient.getPatientID, + pageIndex: 0, + pageSize: 0); model .getPatientList( - getPatientArrivalListRequestModel.toJson(), - patientType) + getPatientArrivalListRequestModel.toJson(), patientType) .then((res) { setState(() { if (res != null && res['MessageStatus'] == 1) { @@ -572,20 +577,18 @@ class _PatientsScreenState extends State { _isError = false; } else { _isError = true; - error = model.error ?? res['ErrorEndUserMessage'] ?? + error = model.error ?? + res['ErrorEndUserMessage'] ?? res['ErrorMessage']; } _isLoading = false; }); GifLoaderDialogUtils.hideDialog(context); - }).catchError((error) { helpers.showErrorToast(error.toString()); GifLoaderDialogUtils.hideDialog(context); - }); - }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); helpers.showErrorToast(err); @@ -684,6 +687,3 @@ class _PatientsScreenState extends State { ); } } - - - diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index 94585e75..98d2a8f5 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; class PatientCard extends StatelessWidget { final PatiantInformtion patientInfo; @@ -42,7 +43,11 @@ class PatientCard extends StatelessWidget { color: Colors.green[800], fontWeight: FontWeight.bold, ), - AppText(patientInfo.arrivedOn) + isToday(patientInfo.arrivedOn) == false + ? AppText(DateUtils.convertStringToDateFormat( + patientInfo.arrivedOn, 'mm-dd-yyyy hh:mm')) + : AppText(DateUtils.convertStringToDateFormat( + patientInfo.arrivedOn, 'hh:mm')) ], ) : SizedBox(), @@ -293,6 +298,12 @@ class PatientCard extends StatelessWidget { return newDate.toString(); } + isToday(date) { + DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); + return DateFormat("yyyy-MM-dd").format(tempDate) == + DateFormat("yyyy-MM-dd").format(DateTime.now()); + } + myBoxDecoration() { return BoxDecoration( border: Border( diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index f2baac67..72f06fb1 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -9,8 +9,9 @@ import 'package:provider/provider.dart'; class ProfileWelcomeWidget extends StatelessWidget { final Widget clinicWidget; final double height; - - ProfileWelcomeWidget(this.clinicWidget, {this.height = 140}); + final bool isClilic; + ProfileWelcomeWidget(this.clinicWidget, + {this.height = 150, this.isClilic = false}); @override Widget build(BuildContext context) { @@ -21,70 +22,70 @@ class ProfileWelcomeWidget extends StatelessWidget { // color: HexColor('#515B5D'), width: double.infinity, child: FractionallySizedBox( - widthFactor: 0.9, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).welcome, - // fontSize: SizeConfig.textMultiplier * 1.7, - // color: Colors.black, - // ) - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - AppText( - // TranslationBase.of(context).dr + - ' ${authProvider.doctorProfile.doctorName}', - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - ), - SizedBox( - width: 20, - ), - CircleAvatar( - // radius: (52) - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: Image.network( - authProvider.doctorProfile.doctorImageURL, - fit: BoxFit.fill, - width: 75, - height: 75, + widthFactor: 0.9, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.isClilic == true ? clinicWidget : SizedBox(), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).welcome, + // fontSize: SizeConfig.textMultiplier * 1.7, + // color: Colors.black, + // ) + // ], + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // AppText( + // // TranslationBase.of(context).dr + + // ' ${authProvider.doctorProfile.doctorName}', + // fontWeight: FontWeight.bold, + // fontSize: SizeConfig.textMultiplier * 2.5, + // color: Colors.black, + // ), + SizedBox( + width: 20, + ), + CircleAvatar( + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.network( + authProvider.doctorProfile.doctorImageURL, + fit: BoxFit.fill, + width: 75, + height: 75, + ), ), + backgroundColor: Colors.transparent, ), - backgroundColor: Colors.transparent, - ) - // ], - // ), - // SizedBox( - // height: 4, - // ), - // clinicWidget, - /// ], - // ), - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ + // ], + // ), + SizedBox( + height: 20, + ), + + /// ], + // ), + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ - // ], - // ), - // ), - ], - ), - ), + // ], + // ), + // ), + ], + )), ); } }