diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fb65ae25..9c86879d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -18,7 +18,7 @@ PODS: - Firebase/Messaging (6.33.0): - Firebase/CoreOnly - FirebaseMessaging (~> 4.7.0) - - firebase_core (0.5.2): + - firebase_core (0.5.3): - Firebase/CoreOnly (~> 6.33.0) - Flutter - firebase_core_web (0.1.0): @@ -250,7 +250,7 @@ SPEC CHECKSUMS: connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_core: 350ba329d1641211bc6183a3236893cafdacfea7 + firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 50b89148..733a1b9c 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,12 +1,3 @@ -/* - *@author: Amjad Amireh Merge to Elham rababah - *@Date:27/4/2020 - *@param: - *@return:PatientsScreen - - *@desc: - */ - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; @@ -19,6 +10,7 @@ import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; @@ -93,14 +85,6 @@ class _PatientsScreenState extends State { } } -/* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: - *@return:Convert time from Milesecond to date with time - - *@desc: - */ convertDate(String str) { String timeConvert; const start = "/Date("; @@ -129,14 +113,6 @@ class _PatientsScreenState extends State { return newDateformat.toString(); } -/* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: - *@return:Convert time from Milesecond to date - - *@desc: - */ convertDateFormat(String str) { String timeConvert; const start = "/Date("; @@ -156,24 +132,6 @@ class _PatientsScreenState extends State { return newDate.toString(); } - convertDateFormat2(String str) { - String timeConvert; - const start = "/Date("; - const end = "+0300)"; - - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - - return newDate.toString(); - } filterBooking(String str) { this.responseModelList = this.responseModelList2; @@ -228,14 +186,6 @@ class _PatientsScreenState extends State { return TranslationBase.of(context).all; } -/* - *@author: Amjad Amireh Modified New design - *@Date:21/5/2020 - *@param: - *@return:PatientsScreen - - *@desc: - */ @override Widget build(BuildContext context) { _locations = [ @@ -401,322 +351,19 @@ class _PatientsScreenState extends State { children: responseModelList .map((PatiantInformtion item) { - return Container( - decoration: - myBoxDecoration(), - child: InkWell( - child: Row( - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: < - Widget>[ - Padding( - padding: EdgeInsets - .only( - left: - 12.0), - child: - Container( - decoration: - BoxDecoration( - boxShadow: [ - 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)), - color: Color( - 0xffCCCCCC), - ), - width: 70, - height: 70, - child: Icon( - item.genderDescription == - "Male" - ? DoctorApp - .male - : DoctorApp - .female_icon, - size: 70, - color: Colors - .white, - ), - ), - ), - ], - ), - - SizedBox( - width: 10, - ), - - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Column( - children: [ - SizedBox( - height: - 10.0, - ), - AppText( - item.firstName + - " " + - item.lastName, - fontSize: - 2.0 * SizeConfig.textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: - 5, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: < - Widget>[ - Wrap( - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.patientId.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - SizedBox( - width: 10, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - Container( - child: - AppText( - TranslationBase.of(context).nationality + " : " + (item.nationalityName ?? item.nationality), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - margin: - EdgeInsets.only(right: projectsProvider.isArabic ? 0 : 10, left: projectsProvider.isArabic ? 10 : 0), - ), - SizedBox( - width: - 10, - ), - SizedBox( - height: - 15.5, - ), - SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 0.5, - ) - ], - ) - : SizedBox( - height: 5, - ), - ], - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - // mainAxisAlignment: - // MainAxisAlignment - // .spaceBetween, - children: < - Widget>[ - SizedBox( - height: - 0.5, - ), - SizedBox( - height: - 0, - ), - Wrap( - children: [ - AppText( - TranslationBase - .of( - context) - .age2, - fontSize: 1.8 * - SizeConfig - .textMultiplier, - fontWeight: FontWeight - .bold, - backGroundcolor: Colors - .white, - ), - AppText( - " ${DateUtils.getAgeByBirthday(item.dateofBirth, context)}", - - fontSize: 1.8 * - SizeConfig - .textMultiplier, - fontWeight: FontWeight - .w300, - backGroundcolor: Colors - .white, - ), - SizedBox( - width: 10, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - - Wrap( - children: [ - AppText( - TranslationBase.of(context).gender2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.gender.toString() == '1' ? 'Male' : 'Female', - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 8, - ), - SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 25.5, - ), - ], - ) - : SizedBox( - height: 15, - ), - ], - ), - ), - ], - ), - ], - ), - ), - // Divider(color: Colors.grey) - ], - ), - onTap: () { - Navigator.of(context) - .pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": item, - "patientType":patientType, - "from" : patient.getFrom, - "to" : patient.getTo, - }); - }, - ), - ); + return PatientCard(patientInfo: item, + patientType: patientType, + onTap: () { + Navigator.of(context) + .pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": item, + "patientType":patientType, + "from" : patient.getFrom, + "to" : patient.getTo, + }); + },); }).toList(), ) : Center( @@ -754,88 +401,78 @@ class _PatientsScreenState extends State { } Widget _locationBar(BuildContext _context) { - return Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.0619, - width: SizeConfig.screenWidth * 0.94, - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: BorderRadius.circular(12.5), - border: Border.all( - width: 0.5, - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _locations.map((item) { - bool _isActive = _locations[_activeLocation] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.058, - width: SizeConfig.screenWidth * 0.2334, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12.5), - topRight: Radius.circular(12.5), - topLeft: Radius.circular(9.5), - bottomLeft: Radius.circular(9.5)), - color: - _isActive ? HexColor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - - fontWeight: FontWeight.normal, - ), - ), - )), - ), - ), - onTap: () { - filterBooking(item.toString()); - - setState(() { - _activeLocation = _locations.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10), - topRight: Radius.circular(10)), - color: Colors.white), - alignment: Alignment.center, - height: 1, - width: SizeConfig.screenWidth * 0.23, - ) - : Container() - ]); - }).toList(), + return Container( + height: MediaQuery.of(context).size.height * 0.0619, + width: SizeConfig.screenWidth * 0.94, + decoration: BoxDecoration( + color: Color(0Xffffffff), + borderRadius: BorderRadius.circular(12.5), + border: Border.all( + width: 0.5, ), ), - ); - } + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _locations.map((item) { + bool _isActive = _locations[_activeLocation] == item ? true : false; + return Column(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.058, + width: SizeConfig.screenWidth * 0.2334, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(12.5), + topRight: Radius.circular(12.5), + topLeft: Radius.circular(9.5), + bottomLeft: Radius.circular(9.5)), + color: + _isActive ? HexColor("#B8382B") : Colors.white, + ), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + + fontWeight: FontWeight.normal, + ), + ), + )), + ), + onTap: () { + filterBooking(item.toString()); - myBoxDecoration() { - return BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color(0xffCCCCCC), - width: 0.5, - ), + setState(() { + _activeLocation = _locations.indexOf(item); + }); + }), + _isActive + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10), + topRight: Radius.circular(10)), + color: Colors.white), + alignment: Alignment.center, + height: 1, + width: SizeConfig.screenWidth * 0.23, + ) + : Container() + ]); + }).toList(), ), ); } + + } + + + diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart new file mode 100644 index 00000000..5ccae18f --- /dev/null +++ b/lib/widgets/patients/PatientCard.dart @@ -0,0 +1,244 @@ +import 'package:doctor_app_flutter/config/config.dart'; +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/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +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'; + +class PatientCard extends StatelessWidget { + final PatiantInformtion patientInfo; + final Function onTap; + final String patientType; + const PatientCard({Key key, this.patientInfo, this.onTap, this.patientType}) : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(10), + decoration: myBoxDecoration(), + margin: EdgeInsets.only(bottom: 12), + child: InkWell( + child: Row( + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: < + Widget>[ + Padding( + padding: EdgeInsets + .only( + left: + 12.0), + child: + Container( + decoration: + BoxDecoration( + boxShadow: [ + 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)), + color: Color( + 0xffCCCCCC), + ), + width: 70, + height: 70, + child: Icon( + patientInfo.genderDescription == + "Male" + ? DoctorApp + .male + : DoctorApp + .female_icon, + size: 70, + color: Colors + .white, + ), + ), + ), + ], + ), + + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment:CrossAxisAlignment.start, + children: [ + AppText( + patientInfo.firstName + + " " + + patientInfo.lastName, + fontSize: + 2.0 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox(height: 12,), + Table( + border: TableBorder.symmetric( + // inside: BorderSide(width: 2.0, color: Colors.white), + ), + // defaultVerticalAlignment:TableCellVerticalAlignment.middle , + children: [ + TableRow(children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).fileNo, + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 2.2 * SizeConfig.textMultiplier)), + new TextSpan(text: patientInfo.patientId.toString()), + ],),), + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).age+ " : ", + style: TextStyle(fontWeight: FontWeight.w700, )), + new TextSpan(text: "${DateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}"), + ],),), + ), + ] + ), + TableRow(children: [ + SizedBox(height: 5,), + SizedBox(height: 5,) + ]), + TableRow(children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).nationality + " : ", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 2.2 * SizeConfig.textMultiplier)), + new TextSpan(text: (patientInfo.nationalityName ?? patientInfo.nationality)), + ],),), + ), + + + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).gender + " : ", + style: TextStyle(fontWeight: FontWeight.w700, )), + new TextSpan(text: patientInfo.gender.toString() == '1' ? 'Male' : 'Female'), + ],),), + ), + ] + ), + + ], + ), + if(SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient") + Container( + + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + patientInfo.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(patientInfo.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 0.5, + ) + ], + ), + margin: EdgeInsets.only(top: 8,), + ) + ], + ), + ), + + // Divider(color: Colors.grey) + ], + ), + onTap: onTap, + ), + ); + } + + convertDateFormat2(String str) { + String timeConvert; + const start = "/Date("; + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } + + myBoxDecoration() { + return BoxDecoration( + border: Border( + bottom: BorderSide( + color: Color(0xffCCCCCC), + width: 0.5, + ), + ), + ); + } +} \ No newline at end of file