From 717c7b3be49d25f5f5a86a5d4082e075194cf0f2 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Wed, 22 Sep 2021 10:13:01 +0300 Subject: [PATCH] Lab results designs enhancements --- lib/uitl/utils.dart | 25 ++++++++ .../medical/LabResult/LabResultWidget.dart | 61 ++++++++++++------- 2 files changed, 65 insertions(+), 21 deletions(-) diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index d4d0a7ce..1adb0308 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -3,6 +3,7 @@ import 'dart:core'; import 'dart:io'; import 'dart:typed_data'; +import 'package:auto_size_text/auto_size_text.dart'; import 'package:badges/badges.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:connectivity/connectivity.dart'; @@ -882,6 +883,30 @@ class Utils { ], ); } + + static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 14), + AutoSizeText( + isCapitable ? text.toLowerCase().capitalizeFirstofEach : text, + maxLines: 1, + minFontSize: 6, + style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12), + ), + SizedBox(height: 10), + if (!isLast) + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ], + ); + } } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index f9eb0427..5ce5ceba 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; @@ -6,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/medical/labs/passport_update_page.dar import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -45,23 +47,6 @@ class LabResultWidget extends StatelessWidget { style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.56, height: 21 / 14), ), SizedBox(width: 16), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: filterName, - patientLabOrder: patientLabOrder, - ), - ), - ); - }, - 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( @@ -69,6 +54,7 @@ class LabResultWidget extends StatelessWidget { 0: FlexColumnWidth(2), 1: FlexColumnWidth(1.5), 2: FlexColumnWidth(1), + 3: FlexColumnWidth(1.7), }, children: fullData(patientLabResultList, context), ), @@ -168,20 +154,53 @@ class LabResultWidget extends StatelessWidget { Utils.tableColumnTitle(TranslationBase.of(context).description), Utils.tableColumnTitle(TranslationBase.of(context).value), Utils.tableColumnTitle(TranslationBase.of(context).range), + Utils.tableColumnTitle(""), ], ), ); - for (int i = 0; i < labResultList.length; i++) + for (int i = 0; i < labResultList.length; i++) { tableRow.add( TableRow( children: [ - Utils.tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)), - Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)), - Utils.tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1), isCapitable: false), + mHeight(8), + mHeight(8), + mHeight(8), + mHeight(8), + ], + ), + ); + tableRow.add( + TableRow( + decoration: containerColorRadiusBorderWidth(Colors.grey[100], 12, Colors.grey[300], 0.6), + children: [ + Padding( + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 12, right: projectViewModel.isArabic ? 12 : 0), + child: Utils.tableColumnValue(labResultList[i].description, isLast: true), + ), + Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true), + Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FlowChartPage( + filterName: filterName, + patientLabOrder: patientLabOrder, + ), + ), + ); + }, + child: Padding( + padding: EdgeInsets.only(left: !projectViewModel.isArabic ? 0 : 12, right: !projectViewModel.isArabic ? 12 : 0), + child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false), + ), + ), ], ), ); + } return tableRow; } }