diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 50ba6655..a4c1ea94 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -818,6 +818,7 @@ const Map localizedValues = { "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, "GeneralResult": {"en": "General Result", "ar": "نتيجة عامة"}, "show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"}, + "view_flow_chart": {"en": "View Flowchart", "ar": "النتائج التراكمية"}, "value": {"en": "Value", "ar": "القيمة"}, "range": {"en": "Range", "ar": "المدى"}, diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index eccf0efe..ffadbb5d 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -2,5 +2,5 @@ extension CapExtension on String { String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; String get allInCaps => this.toUpperCase(); - String get capitalizeFirstofEach => this.split(" ").map((str) => str.inCaps).join(" "); -} \ No newline at end of file + String get capitalizeFirstofEach => this.length > 0 ? this.split(" ").map((str) => str.inCaps).join(" ") : ""; +} diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 8f1e774b..2cce6dc2 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -35,6 +35,7 @@ class _LaboratoryResultPageState extends State { backgroundColor: Color(0xffF8F8F8), body: ListView.builder( physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(bottom: 12), itemBuilder: (context, index) => LaboratoryResultWidget( onTap: () async { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index b5671704..c0a07cc5 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -57,7 +57,7 @@ class DateUtil { } static String formatDateToTime(DateTime date) { - return DateFormat('kk:mm a').format(date); + return DateFormat('hh:mm a').format(date); } static String yearMonthDay(DateTime dateTime) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index cbadca71..d340c515 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1202,6 +1202,8 @@ class TranslationBase { String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode]; + String get viewFlowChart => localizedValues['view_flow_chart'][locale.languageCode]; + String get value => localizedValues['value'][locale.languageCode]; String get range => localizedValues['range'][locale.languageCode]; diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index ea2ede44..09d62f3f 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -6,18 +6,16 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import '../../text.dart'; import 'FlowChartPage.dart'; - class LabResultWidget extends StatelessWidget { - - final String filterName ; + final String filterName; final List patientLabResultList; final PatientLabOrders patientLabOrder; - LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key); + LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key); ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -28,11 +26,14 @@ class LabResultWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox(height: 8), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(filterName), + Text( + filterName, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.56, height: 21 / 14), + ),SizedBox(width: 16), InkWell( onTap: () { Navigator.push( @@ -40,135 +41,94 @@ class LabResultWidget extends StatelessWidget { FadePage( page: FlowChartPage( filterName: filterName, - patientLabOrder: patientLabOrder, + patientLabOrder: patientLabOrder, ), ), ); }, - child: Texts( - TranslationBase.of(context).showMoreBtn, - decoration: TextDecoration.underline, - color: Colors.blue, + child: Text( + TranslationBase.of(context).viewFlowChart, + style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12), ), ), ], ), Table( - border: TableBorder.symmetric( - inside: BorderSide( - width: 2.0, color: Colors.grey[300]), - ), - children: fullData(patientLabResultList,context), + columnWidths: { + 0: FlexColumnWidth(2), + 1: FlexColumnWidth(1.5), + 2: FlexColumnWidth(1), + }, + children: fullData(patientLabResultList, context), ), ], ), ); } - List fullData(List labResultList,context) { + + List fullData(List labResultList, context) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - topRight: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).description, - color: Colors.white, - ), - ), - height: 60, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts(TranslationBase.of(context).value, color: Colors.white), - ), - height: 60), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - topRight: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts(TranslationBase.of(context).range, color: Colors.white), - ), - height: 60), - ), + _tableColumnTitle(TranslationBase.of(context).description), + _tableColumnTitle(TranslationBase.of(context).value), + _tableColumnTitle(TranslationBase.of(context).range), ], ), ); - labResultList.forEach((lab) { + + for (int i = 0; i < labResultList.length; i++) tableRow.add( TableRow( children: [ - Container( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - lab.description, - textAlign: TextAlign.center, - ), - ), - ), - ), - Container( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - lab.resultValue+" "+lab.uOM, - textAlign: TextAlign.center, - ), - ), - ), - ), - Container( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - lab.referanceRange, - textAlign: TextAlign.center, - ), - ), - ), - ), + _tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)), + _tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)), + _tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)), ], ), ); - }); return tableRow; } -} - + Widget _tableColumnTitle(String text) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 6), + Text( + text, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), + ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xff2E303A), + thickness: 1, + ) + ], + ); + } + Widget _tableColumnValue(String text, {bool isLast = false}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 12), + Text( + text.toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (!isLast) + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ], + ); + } +} diff --git a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart index ccd1fc4b..29b94b50 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.d import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; @@ -19,6 +20,7 @@ import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import '../../text.dart'; +import 'FlowChartPage.dart'; import 'LabResultWidget.dart'; class LaboratoryResultWidget extends StatefulWidget { @@ -43,7 +45,7 @@ class _LaboratoryResultWidgetState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - // onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder), + onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder), builder: (_, model, w) => NetworkBaseView( baseViewModel: model, child: Column( @@ -69,7 +71,7 @@ class _LaboratoryResultWidgetState extends State { ); }, child: Container( - padding: EdgeInsets.only(left: 17, top: 14, right: 13, bottom: 10), + padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12), margin: EdgeInsets.only(left: 21, right: 21, top: 12), decoration: BoxDecoration( shape: BoxShape.rectangle, @@ -86,41 +88,32 @@ class _LaboratoryResultWidgetState extends State { ), ], ), - child: Row( - children: [ - Expanded(child: Texts(TranslationBase.of(context).generalResult)), - Container( - width: 25, - height: 25, - decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Icon( - _isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, - color: Colors.white, - size: 22, - ), - ) - ], - ), - ), - ), - if (_isShowMoreGeneral) - AnimatedContainer( - padding: EdgeInsets.all(10.0), - margin: EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(5.0), - bottomRight: Radius.circular(5.0), - ), - ), - duration: Duration(milliseconds: 7000), - child: Container( - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Row( + children: [ + Text( + TranslationBase.of(context).generalResult, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + // todo 'sikander' discuss about chart flow chart + ], + ), + ), + Icon( + _isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + color: Color(0xff575757), + size: 22, + ) + ], + ), + if (_isShowMoreGeneral) ...List.generate( model.labResultLists.length, (index) => LabResultWidget( @@ -129,10 +122,10 @@ class _LaboratoryResultWidgetState extends State { patientLabResultList: model.labResultLists[index].patientLabResultList, ), ) - ], - ), + ], ), ), + ), ], ), ), @@ -160,41 +153,34 @@ class _LaboratoryResultWidgetState extends State { ), ], ), - child: Row( - children: [ - Expanded(child: Texts(TranslationBase.of(context).specialResult)), - Container( - width: 25, - height: 25, - decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Icon( - _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, - color: Colors.white, - size: 22, + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).specialResult, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Icon( + _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + color: Color(0xff575757), + size: 22, + ) + ], + ), + if (_isShowMore) + Container( + width: double.infinity, + child: Html( + data: widget.details ?? TranslationBase.of(context).noDataAvailable, + ), ), - ) ], ), ), ), - if (_isShowMore) - AnimatedContainer( - padding: EdgeInsets.all(10.0), - margin: EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(5.0), - bottomRight: Radius.circular(5.0), - )), - duration: Duration(milliseconds: 7000), - child: Container( - width: double.infinity, - child: Html( - data: widget.details ?? TranslationBase.of(context).noDataAvailable, - )), - ), ], ), ), diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 8d48ff2b..e3377fad 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -58,9 +58,9 @@ class DoctorCard extends StatelessWidget { //Colors.red[900] Color(0xff404545) color: isLiveCareAppointment ? Color(0xff404545) - : !isInOutPatient + : (!isInOutPatient ? Colors.red[900] - : Theme.of(context).primaryColor, + : Theme.of(context).primaryColor), borderRadius: BorderRadius.only( topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), @@ -73,9 +73,9 @@ class DoctorCard extends StatelessWidget { child: Text( isLiveCareAppointment ? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach - : !isInOutPatient + : (!isInOutPatient ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach - : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, + : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach), style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), ), ), diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 6fab1b60..d413229c 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -64,7 +64,7 @@ class DoctorHeader extends StatelessWidget { ), Padding( padding: const EdgeInsets.only(top: 8.0), - child: Image.network(patientLabOrder.nationalityFlagURL, height: 16), + child: Image.network(patientLabOrder?.nationalityFlagURL ?? "", height: 16), ), ], ) diff --git a/lib/widgets/others/app_expandable_notifier.dart b/lib/widgets/others/app_expandable_notifier.dart index 5144fca9..ad97ba11 100644 --- a/lib/widgets/others/app_expandable_notifier.dart +++ b/lib/widgets/others/app_expandable_notifier.dart @@ -86,7 +86,7 @@ class _AppExpandableNotifier extends State { ), IconButton( icon: Icon( - widget.expandFlag ? Icons.remove : Icons.add, + widget.expandFlag ?Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Color(0xff2E303A), // size: 30.0, ),