Merge branch 'master' into haroon_dev

pull/72/head
haroon amjad 4 weeks ago
commit 3d64ddf78b

@ -864,5 +864,14 @@
"regionAndLocation": "المنطقة والمواقع",
"clearAllFilters": "مسح جميع الفلاتر",
"filters": "فلاتر",
"searchClinic": "بحث عن عيادة"
"searchClinic": "بحث عن عيادة",
"normal": "عادي",
"attention": "انتباه",
"monitor": "مراقبة",
"noSpecialResult": "لا توجد نتائج خاصة",
"setTheDateRange": "تعيين النطاق الزمني",
"historyFlowchart": "مخطط تدفق التاريخ",
"to": "إلى",
"startDate": "تاريخ البدء",
"endDate": "تاريخ الانتهاء"
}

@ -853,6 +853,15 @@
"onboardingBody1": "In few clicks find yourself having consultation with the doctor of your choice.",
"onboardingHeading2": "Access the medical history on finger tips",
"onboardingBody2": "Keep track on your medical history including labs, prescription, insurance, etc",
"normal": "Normal",
"attention": "Attention",
"monitor": "Monitor",
"noSpecialResult": "No Special Results",
"setTheDateRange": "Set The Date Range",
"historyFlowchart": "History FlowChart",
"to": "to",
"startDate" : "Start Date",
"endDate": "End Date",
"hmgHospitals": "HMG Hospitals",
"hmcMedicalClinic": "HMC Medical Centers",
"applyFilter": "AppLy Filter",

@ -174,7 +174,11 @@ class ApiClientImp implements ApiClient {
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 4770714;
// body['PatientID'] = 1018977;
// body['PatientTypeID'] = 1;
//
// body['PatientOutSA'] = 0;
// body['SessionID'] = "45786230487560q";
}
body.removeWhere((key, value) => value == null);

@ -727,7 +727,7 @@ const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatu
class ApiConsts {
static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -4,6 +4,7 @@ import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_special_result.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'models/resp_models/lab_result.dart' show LabResult;
@ -11,6 +12,14 @@ import 'models/resp_models/lab_result.dart' show LabResult;
abstract class LabRepo {
Future<Either<Failure, GenericApiModel<List<PatientLabOrdersResponseModel>>>> getPatientLabOrders();
Future<Either<Failure, GenericApiModel<List<LabResult>>>> getPatientLabResults(PatientLabOrdersResponseModel laborder, bool isVidaPlus, String procedureName);
Future<Either<Failure, GenericApiModel<List<LabResult>>>>
getPatientLabResultsByHospitals(
PatientLabOrdersResponseModel laborder, bool isVidaPlus);
Future<Either<Failure, GenericApiModel<List<PatientLabSpecialResult>>>>
getSpecialLabResult(
PatientLabOrdersResponseModel laborder, bool isVidaPlus);
}
class LabRepoImp implements LabRepo {
@ -73,7 +82,6 @@ class LabRepoImp implements LabRepo {
request['ProjectID'] = laborder.projectID;
request['ClinicID'] = laborder.clinicID;
request['Procedure'] = procedureName;
request['LanguageID'] = 1;
try {
GenericApiModel<List<LabResult>>? apiResponse;
Failure? failure;
@ -90,6 +98,58 @@ class LabRepoImp implements LabRepo {
throw Exception("lab list is empty");
}
final labOrders = list
.map((item) => LabResult.fromJson(item as Map<String, dynamic>))
.toList()
.cast<LabResult>();
apiResponse = GenericApiModel<List<LabResult>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: labOrders,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<LabResult>>>>
getPatientLabResultsByHospitals(
PatientLabOrdersResponseModel laborder, bool isVidaPlus) async {
Map<String, dynamic> request = Map();
request['InvoiceNo_VP'] = isVidaPlus ? laborder!.invoiceNo : "0";
request['InvoiceNo'] = isVidaPlus ? "0" : laborder!.invoiceNo;
request['OrderNo'] = laborder!.orderNo;
request['isDentalAllowedBackend'] = false;
request['SetupID'] = laborder!.setupID;
request['ProjectID'] = laborder.projectID;
request['ClinicID'] = laborder.clinicID;
try {
GenericApiModel<List<LabResult>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_Patient_LAB_RESULT,
body: request,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['ListPLR'];
if (list == null || list.isEmpty) {
throw Exception("lab list is empty");
}
final labOrders = list.map((item) => LabResult.fromJson(item as Map<String, dynamic>)).toList().cast<LabResult>();
apiResponse = GenericApiModel<List<LabResult>>(
@ -110,4 +170,57 @@ class LabRepoImp implements LabRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<PatientLabSpecialResult>>>>
getSpecialLabResult(
PatientLabOrdersResponseModel laborder, bool isVidaPlus) async {
Map<String, dynamic> request = Map();
request['InvoiceNo_VP'] = isVidaPlus ? laborder!.invoiceNo : "0";
request['InvoiceNo'] = isVidaPlus ? "0" : laborder!.invoiceNo;
request['OrderNo'] = laborder!.orderNo;
request['isDentalAllowedBackend'] = false;
request['SetupID'] = laborder!.setupID;
request['ProjectID'] = laborder.projectID;
request['ClinicID'] = laborder.clinicID;
try {
GenericApiModel<List<PatientLabSpecialResult>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_Patient_LAB_SPECIAL_RESULT,
body: request,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['ListPLSR'];
if (list == null || list.isEmpty) {
throw Exception("lab list is empty");
}
final labOrders = list
.map((item) => PatientLabSpecialResult.fromJson(
item as Map<String, dynamic>))
.toList()
.cast<PatientLabSpecialResult>();
apiResponse = GenericApiModel<List<PatientLabSpecialResult>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: labOrders,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -20,6 +20,8 @@ import 'package:logger/logger.dart';
class LabViewModel extends ChangeNotifier {
bool isLabOrdersLoading = false;
bool isLabResultsLoading = false;
bool isLabResultByHospitalLoading = false;
bool isSpecialResultsLoading = false;
LabRepo labRepo;
ErrorHandlerService errorHandlerService;
@ -28,6 +30,11 @@ class LabViewModel extends ChangeNotifier {
List<PatientLabOrdersResponseModel> patientLabOrders = [];
List<PatientLabOrdersResponseModel> filteredLabOrders = [];
List<PatientLabOrdersResponseModel> tempLabOrdersList = [];
String labSpecialResult = "";
PatientLabOrdersResponseModel? currentlySelectedPatientOrder;
List<LabResult> mainLabResultsByHospitals = [];
List<LabResult> mainLabResults = [];
List<DataPoint> mainGraphPoints = [];
@ -138,6 +145,31 @@ class LabViewModel extends ChangeNotifier {
};
}
Future<void> getPatientLabResultByHospital(
PatientLabOrdersResponseModel laborder) async {
isLabResultByHospitalLoading = true;
notifyListeners();
mainLabResultsByHospitals.clear;
final result = await labRepo.getPatientLabResultsByHospitals(laborder,
Utils.isVidaPlusProject(int.parse(laborder.projectID ?? "0")));
result.fold(
(failure) async {
isLabResultByHospitalLoading = false;
// await errorHandlerService.handleError(failure: failure);
},
(apiResponse) {
isLabResultByHospitalLoading = false;
if (apiResponse.messageStatus == 2) {
} else if (apiResponse.messageStatus == 1) {
mainLabResultsByHospitals = apiResponse.data ?? [];
notifyListeners();
}
},
);
}
Future<void> getPatientLabResult(
PatientLabOrdersResponseModel laborder, String procedureName) async {
LoaderBottomSheet.showLoader();
@ -199,6 +231,42 @@ class LabViewModel extends ChangeNotifier {
);
}
Future<void> getPatientSpecialResult(
PatientLabOrdersResponseModel laborder) async {
isSpecialResultsLoading = true;
labSpecialResult = "";
notifyListeners();
final result = await labRepo.getSpecialLabResult(
laborder,
Utils.isVidaPlusProject(int.parse(laborder.projectID ?? "0")),
);
result.fold(
(failure) async {
isSpecialResultsLoading = false;
notifyListeners();
// await errorHandlerService.handleError(failure: failure);
},
(apiResponse) {
isSpecialResultsLoading = false;
if (apiResponse.messageStatus == 2) {
} else if (apiResponse.messageStatus == 1) {
StringBuffer htmlbuffer = StringBuffer("");
apiResponse.data?.forEach((element) {
if(element.resultDataHTML != null && element.resultDataHTML?.isNotEmpty == true)
htmlbuffer.write("${element.resultDataHTML} <br/> <br/>");
});
labSpecialResult = htmlbuffer.toString();
notifyListeners();
}
notifyListeners();
},
);
}
String resultDate(DateTime date){
@ -460,4 +528,21 @@ class LabViewModel extends ChangeNotifier {
return true;
}
}
String getSeverityText(String refernceValue) {
switch (refernceValue) {
case 'N':
return "normal";
case 'L':
case 'H':
return "monitor";
case 'CL':
case 'LCL':
case 'CH':
case 'HCH':
return "attention";
default:
return "normal";
}
}
}

@ -24,6 +24,7 @@ class LabResult {
String? referenceHigh;
String? criticalLow;
String? referenceLow;
String? packageShortDescription;
LabResult(
{this.description,
@ -78,6 +79,7 @@ class LabResult {
referenceHigh = json['ReferenceHigh'];
criticalLow = json['CriticalLow'];
referenceLow = json['ReferenceLow'];
packageShortDescription = json['PackageShortDescription'];
}
Map<String, dynamic> toJson() {

@ -0,0 +1,32 @@
class PatientLabSpecialResult {
String? invoiceNo;
String? moduleID;
String? resultData;
String? resultDataHTML;
dynamic resultDataTxt;
PatientLabSpecialResult(
{this.invoiceNo,
this.moduleID,
this.resultData,
this.resultDataHTML,
this.resultDataTxt});
PatientLabSpecialResult.fromJson(Map<String, dynamic> json) {
invoiceNo = json['InvoiceNo'];
moduleID = json['ModuleID'];
resultData = json['ResultData'];
resultDataHTML = json['ResultDataHTML'];
resultDataTxt = json['ResultDataTxt'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['InvoiceNo'] = this.invoiceNo;
data['ModuleID'] = this.moduleID;
data['ResultData'] = this.resultData;
data['ResultDataHTML'] = this.resultDataHTML;
data['ResultDataTxt'] = this.resultDataTxt;
return data;
}
}

@ -863,5 +863,14 @@ abstract class LocaleKeys {
static const clearAllFilters = 'clearAllFilters';
static const filters = 'filters';
static const searchClinic = 'searchClinic';
static const normal = 'normal';
static const attention = 'attention';
static const monitor = 'monitor';
static const noSpecialResult = 'noSpecialResult';
static const setTheDateRange = 'setTheDateRange';
static const historyFlowchart = 'historyFlowchart';
static const to = 'to';
static const startDate = 'startDate';
static const endDate = 'endDate';
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,69 @@
import 'package:easy_localization/easy_localization.dart'
show tr, StringTranslateExtension;
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_hospital/LabResultList.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_hospital/lab_order_specialResult.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:provider/provider.dart';
class LabResultByHospitals extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CollapsingListView(
title: LocaleKeys.labResults.tr(),
child: SingleChildScrollView(
child: Column(
spacing: 8.h,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Selector<LabViewModel, bool>(
selector: (_, model) => model.isLabResultByHospitalLoading,
builder: (_, isLoading, __) {
if (isLoading) {
return Column(
children: [
LabResultItemView(
onTap: () {},
labOrder: null,
index: 0,
isLoading: true,
),
LabResultItemView(
onTap: () {},
labOrder: null,
index: 0,
isLoading: true,
),
LabResultItemView(
onTap: () {},
labOrder: null,
index: 0,
isLoading: true,
),
LabResultItemView(
onTap: () {},
labOrder: null,
index: 0,
isLoading: true,
),
],
);
} else {
return LabResultList();
}
},
),
LabOrderSpecialResult()
],
).paddingAll(24.h),
));
}
}

@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_hospital/lab_order_result_item.dart';
import 'package:provider/provider.dart' show Selector, Provider;
class LabResultList extends StatelessWidget {
late LabViewModel model;
@override
Widget build(BuildContext context) {
model = Provider.of<LabViewModel>(context);
return Selector<LabViewModel, List<LabResult>>(
selector: (_, model) => model.mainLabResultsByHospitals,
builder: (__, list, ___) {
if (list.isEmpty) {
return Utils.getNoDataWidget(context,
noDataText: "You don't have any lab results yet."
.needTranslation);
} else {
return ListView.builder(
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
shrinkWrap: true,itemCount: list.length,itemBuilder: (____, index) {
var labItem = list[index];
return LabOrderResultItem(onTap: () {
model.getPatientLabResult(model.currentlySelectedPatientOrder!, labItem.description??"");
},
tests: labItem,
index: index,
iconColor: model.getColor(labItem.calculatedResultFlag ?? "N"),
severityText: model.getSeverityText(labItem.calculatedResultFlag ?? "N"));
});
}
},
);
}
}

@ -0,0 +1,96 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart';
class LabOrderResultItem extends StatelessWidget {
final VoidCallback onTap;
final int index;
final LabResult? tests;
final String severityText;
final bool isLoading;
final bool isExpanded;
final Color iconColor;
const LabOrderResultItem({super.key, required this.onTap, this.tests, required this.index, this.isLoading = false, this.isExpanded = false,required this.iconColor, required this.severityText});
@override
build(BuildContext context) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
child: Container(
key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// ...labOrder!.testDetails!.map((detail) {
Padding(
padding: EdgeInsets.only(bottom: 8.h),
child: '${tests!.description}'.toText14(weight: FontWeight.w500),
),
'${tests!.packageShortDescription}'.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
//
SizedBox(height: 24.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
spacing: 6.h,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(severityText.tr(),
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 10.fSize,
fontWeight: FontWeight.w500,
color: AppColors.greyTextColor
)),
Utils.buildSvgWithAssets(
icon: AppAssets.lab_result_indicator,
width: 21,
height: 23,
iconColor: iconColor
),
],
),
CustomButton(
icon: AppAssets.view_report_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
text: LocaleKeys.viewReport.tr(context: context),
onPressed: () {
onTap();
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 14,
fontWeight: FontWeight.bold,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
],
),
],
),
));
}
}

@ -0,0 +1,120 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:provider/provider.dart';
class LabOrderSpecialResult extends StatelessWidget {
const LabOrderSpecialResult({super.key});
@override
Widget build(BuildContext context) {
return Selector<LabViewModel, bool>(
selector: (_, model) => model.isSpecialResultsLoading,
builder: (_, isLoading, __) {
return Selector<LabViewModel, String>(
selector: (_, model) => model.labSpecialResult,
builder: (_, data, __) {
if(isLoading){
return Container(
margin: EdgeInsets.symmetric(vertical: 8.h),
padding: EdgeInsets.symmetric(
horizontal: 16.h, vertical: 16.h),
width: MediaQuery.sizeOf(context).width - 24,
decoration: RoundedRectangleBorder()
.toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true),
child:Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12.h,
children: [
"loading".toText14().toShimmer2(isShow: isLoading),
"loading".toText14().toShimmer2(isShow: isLoading),
],
)
);
}
if(data.isNotEmpty ) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder()
.toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 16.h, vertical: 16.h),
width: MediaQuery.sizeOf(context).width - 24,
child: Column(
spacing: 8.h,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// ...labOrder!.testDetails!.map((detail) {
LocaleKeys.specialResult
.tr()
.toText14(weight: FontWeight.w500)
.toShimmer2(isShow: isLoading),
data.isEmpty
? LocaleKeys.noSpecialResult
.tr()
.toText12(
fontWeight: FontWeight.w500,
color: AppColors.textColorLight)
.toShimmer2(isShow: isLoading)
: HtmlWidget(data).toShimmer2(isShow: isLoading)
//
],
),
));
} return SizedBox.shrink();
});
});
}
}
/*Text(
"Special Results",
style: TextStyle(
fontSize: 18.fSize,
fontWeight: FontWeight.w600,
color: AppColors.blackColor),
),
Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true
),
padding: EdgeInsets.all(16.h),
width: MediaQuery.sizeOf(context).width-24,
child: Selector<LabViewModel, bool>(
selector: (_, model) =>
model.isLabResultByHospitalLoading,
builder: (_, isLoading, __) {
return Selector<LabViewModel, String>(
selector: (_, model) => model.labSpecialResult,
builder: (_, data, __) {
return (data.isEmpty)
? Text("No result available".needTranslation,
style: TextStyle(
fontSize: 12.fSize,
fontWeight: FontWeight.w500,
color: AppColors.textColorLight))
.toShimmer2(isShow: isLoading)
: HtmlWidget(data)
.toShimmer2(isShow: isLoading);
});
}))*/

@ -68,7 +68,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
children: [
fromDateComponent(),
Text(
"to".needTranslation,
LocaleKeys.to.tr(),
style: TextStyle(
color: AppColors.calenderTextColor,
fontSize: 14.h,
@ -205,7 +205,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
fromDateComponent() {
return Consumer<LabRangeViewModel>(
builder: (_, model, __) {
return displayDate("Start Date".needTranslation,
return displayDate(LocaleKeys.startDate.tr(),
model.getDateString(model.fromDate), model.fromDate == null);
},
);
@ -214,7 +214,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
toDateComponent() {
return Consumer<LabRangeViewModel>(
builder: (_, model, __) {
return displayDate("End Date".needTranslation,
return displayDate(LocaleKeys.endDate.tr(),
model.getDateString(model.toDate), model.toDate == null);
},
);

@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/lab_range_view_model.dart' show LabRangeViewModel;
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_results/lab_result_calender.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_results/lab_result_list_item.dart';
import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors;
@ -141,7 +142,7 @@ class LabResultDetails extends StatelessWidget {
borderRadius: 24.h,
hasShadow: true,
),
height: 260.h,
height: model.isGraphVisible?260.h:(labmodel.filteredGraphValues.length<3)?(labmodel.filteredGraphValues.length*64)+80.h:260.h,
padding: EdgeInsets.all(16.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -151,7 +152,7 @@ class LabResultDetails extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
model.isGraphVisible?"History FlowChart".needTranslation: "History".needTranslation,
model.isGraphVisible?LocaleKeys.historyFlowchart.tr(): LocaleKeys.history.tr(),
style: TextStyle(
fontSize: 16,
fontFamily: 'Poppins',
@ -166,8 +167,8 @@ class LabResultDetails extends StatelessWidget {
//todo handle when the graph icon is being displayed
Utils.buildSvgWithAssets(
icon: model.isGraphVisible?AppAssets.ic_list:AppAssets.ic_graph,
width: 24,
height: 24)
width: 24.h,
height: 24.h)
.onPress(() {
model.alterGraphVisibility();
}),
@ -177,7 +178,7 @@ class LabResultDetails extends StatelessWidget {
height: 24)
.onPress(() {
showCommonBottomSheetWithoutHeight(
title: "Set The Date Range".needTranslation,
title: LocaleKeys.setTheDateRange.tr(),
context,
child: LabResultCalender(
onRangeSelected: (start, end) {
@ -233,11 +234,12 @@ class LabResultDetails extends StatelessWidget {
return CustomGraph(
dataPoints: labmodel.filteredGraphValues,
// maxY: 100,
makeGraphBasedOnActualValue: true,
leftLabelReservedSize: 40,
leftLabelInterval: getInterval(labmodel),
maxY: (labmodel.maxY)+(getInterval(labmodel)??0)/2,
maxY: (labmodel.maxY)+(getInterval(labmodel)??0)/5,
maxX: labmodel.filteredGraphValues.length.toDouble()-.75,
leftLabelFormatter: (value) {
return leftLabels(value.toStringAsFixed(2).tr());
// switch (value.toInt()) {
@ -257,7 +259,7 @@ class LabResultDetails extends StatelessWidget {
// }
},
graphColor:graphColor ,
graphShadowColor: graphColor.withOpacity(.4),
graphShadowColor: graphColor.withOpacity(.1),
graphGridColor: graphColor.withOpacity(.4),
bottomLabelFormatter: (value, data) {
if(data.isEmpty) return SizedBox.shrink();
@ -282,7 +284,7 @@ class LabResultDetails extends StatelessWidget {
Widget labHistoryList(LabRangeViewModel model, LabViewModel labmodel) {
return SizedBox(
height: 180.h,
height: labmodel.filteredGraphValues.length<3?labmodel.filteredGraphValues.length*64:180.h,
child: ListView.separated(
padding: EdgeInsets.zero,
itemCount: labmodel.filteredGraphValues.length,itemBuilder: (context, index){
@ -304,6 +306,7 @@ class LabResultDetails extends StatelessWidget {
double? getInterval(LabViewModel labmodel) {
var maxX = labmodel.maxY;
if(maxX<1) return .5;
if(maxX >1 && maxX < 5) return 1;
if(maxX >5 && maxX < 10) return 5;
if(maxX >10 && maxX < 50) return 10;

@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_orders_page.dart';
import 'package:hmg_patient_app_new/presentation/onboarding/onboarding_screen.dart';
import 'package:hmg_patient_app_new/presentation/onboarding/splash_animation_screen.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';

@ -236,7 +236,7 @@ class CustomGraph extends StatelessWidget {
gradient: LinearGradient(
colors: [
graphShadowColor,
Colors.transparent,
Colors.white,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,

@ -85,6 +85,7 @@ dependencies:
gms_check: ^1.0.4
huawei_location: ^6.14.2+301
intl: ^0.20.2
flutter_widget_from_html: ^0.17.1
dev_dependencies:
flutter_test:

Loading…
Cancel
Save