diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8c99dddf..6959f799 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2147,8 +2147,8 @@ const Map localizedValues = { "readMore": {"en": "Read More", "ar": "اقرأ أكثر"}, "showLess": {"en": "Show Less", "ar": "عرض أقل"}, "change": {"en": "Change", "ar": "فرق"}, - "referenceRange": {"en": "Reference Range", "ar": "النطاق المرجعي"}, - "criticalLow": {"en": "Critical Low", "ar": "النطاق المرجعي"}, + "referenceRange": {"en": "Reference Range", "ar": "نطاق مرجعي"}, + "criticalLow": {"en": "Critical Low", "ar": "انخفاض حرج"}, "criticalHigh": {"en": "Critical High", "ar": "حرج مرتفع"}, "high": {"en": "High", "ar": "مرتفع"}, "normal": {"en": "Normal", "ar": "عادي"}, @@ -2843,6 +2843,7 @@ const Map localizedValues = { "pleaseEnterValidMobile": {"en": "Please enter valid phone number", "ar": "الرجاء إدخال رقم هاتف صالح"}, "pleaseEnterNationalIdOrFileNo": {"en": "Please enter National id or File no", "ar": "الرجاء إدخال رقم الهوية الوطنية أو رقم الملف"}, "thisResult": {"en": "This Result", "ar": "هذه النتيجة"}, - "seeAllGraphValues": {"en": "See all values", "ar": "شاهد جميع القيم"}, + "seeAllGraphValues": {"en": "View all results", "ar": "عرض جميع النتائج"}, + "verify-with-biometric": {"en": "Biometric", "ar": "الحيوية"}, "verify-with-biometric": {"en": "Biometric", "ar": "الحيوية"}, }; diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index b7106f46..a204630b 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -325,7 +325,7 @@ class LabsService extends BaseService { return bDate.compareTo(aDate); // descending }); - print("the copied item are $copy"); + // print("the copied item are $copy"); labOrdersResultsList = copy; return copy.take(3).toList(); } diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 9029894a..7a90e45b 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -32,8 +32,6 @@ class LabsViewModel extends BaseViewModel { List threshold = []; double maxYForThreeDots = 0.0; double maxYForCompleteGraph = 0.0; - List months = ['Jan','Feb','Mar','April','May','Jun','July','Aug','Sep','Oct','Nov','Dec']; - String get labReportPDF => _labsService.labReportPDF; @@ -94,13 +92,13 @@ class LabsViewModel extends BaseViewModel { await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, invoiceType: invoiceType, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, isVidaPlus: isVidaPlus); if (_labsService.hasError) { error = _labsService.error!; - setState(ViewState.Error); + // setState(ViewState.Error); } else { - setState(ViewState.Idle); + // setState(ViewState.Idle); } } - getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async { + getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async { setState(ViewState.Busy); await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder, isVidaPlus: isVidaPlus); if (_labsService.hasError) { @@ -109,54 +107,48 @@ class LabsViewModel extends BaseViewModel { } else { _labsService.labResultList.forEach((element) { List patientLabOrdersClinic = labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList(); - element.percentage = - getPercentage(element.calculatedResultFlag?? ResultFlag.N, isTablet); + element.percentage = getPercentage(element.calculatedResultFlag ?? ResultFlag.N, isTablet); if (patientLabOrdersClinic.length != 0) { - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element); + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element); } else { - labResultLists.add(LabResultList( - filterName: element.testCode, - description: element.packageShortDescription, - lab: element)); + labResultLists.add(LabResultList(filterName: element.testCode, description: element.packageShortDescription, lab: element)); } }); setState(ViewState.Idle); } } - recalculatePercentage(isTablet){ - for(int i = 0;i maxYForThreeDots){ - debugPrint("the double.parse(element.resultValue!) is ${double.parse(element.resultValue!)}"); - + if (double.parse(element.resultValue!) > maxYForThreeDots) { maxYForThreeDots = double.parse(element.resultValue!); } // threePointGraphValue.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime)); @@ -217,7 +203,6 @@ class LabsViewModel extends BaseViewModel { counter++; } catch (e) {} }); - debugPrint("the maxY is ${maxYForThreeDots}"); threePointGraphValue.last.label = "thisResult"; threePointGraphValue.last.isStringResource = true; @@ -227,9 +212,7 @@ class LabsViewModel extends BaseViewModel { /// This function is used to create a full graph data points for the lab results. /// @param onComplete: A callback function that is called when the data points are created. - createFullGraphDatPoints( - VoidCallback onComplete - ){ + createFullGraphDatPoints(VoidCallback onComplete) { maxYForCompleteGraph = 0.0; completeeGraphValues.clear(); setState(ViewState.Busy); @@ -245,14 +228,9 @@ class LabsViewModel extends BaseViewModel { completeeGraphValues.add(DataPoint( labelValue: counter,value : double.parse(element.resultValue!), label: formatDateAsMMYY(dateTime), date: dateTime,actualValue: element.resultValue!, referenceRangeValue:element.calculatedResultFlag??"IRR" )); } catch (e) { print("the mapping is having exception $e"); - } ++counter; - }); - print("the label values are $counter"); - print("the completeeGraphValues length are ${completeeGraphValues.length}"); - print("the completeeGraphValues last value of label ias ${completeeGraphValues.last.labelValue}"); completeeGraphValues.last.label = "thisResult"; completeeGraphValues.last.isStringResource = true; setState(ViewState.Idle); @@ -291,8 +269,7 @@ class LabsViewModel extends BaseViewModel { Future _createFileFromString(String encodedStr, String ext) async { Uint8List bytes = base64.decode(encodedStr); String dir = (await getApplicationDocumentsDirectory()).path; - File file = File( - "$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); + File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); await file.writeAsBytes(bytes); return file.path; } diff --git a/lib/main.dart b/lib/main.dart index f2e12729..45efd593 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -34,7 +34,6 @@ void main() async { await Firebase.initializeApp(); await initLocalStorage(); - // Pass all uncaught "fatal" errors from the framework to Crashlytics // FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; @@ -117,8 +116,7 @@ class _MyApp extends State { void openAppLink(Uri uri) { print("the uri is $uri"); - DeepLinkHandler.instance.handleDeepLinkAndNavigation( - locator().navigatorKey.currentState, uri, context); + DeepLinkHandler.instance.handleDeepLinkAndNavigation(locator().navigatorKey.currentState, uri, context); } @override @@ -142,7 +140,8 @@ class _MyApp extends State { providers: [ ChangeNotifierProvider( create: (context) => PharmacyPagesViewModel(), - ), ChangeNotifierProvider( + ), + ChangeNotifierProvider( create: (context) => AuthProviderViewModel(), ), ChangeNotifierProvider( diff --git a/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart b/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart index bd3757c7..e0f9d997 100644 --- a/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart +++ b/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart @@ -31,144 +31,126 @@ class FlowChartPage extends StatelessWidget { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, - procedure: filterName, - isVidaPlus: Utils.isVidaPlusProject( - projectViewModel!, int.parse(patientLabOrder!.projectID!))), - builder: (context, model, w) { - print("the maxY in builder is ${model.maxYForCompleteGraph}"); - return SizedBox( - height: MediaQuery.sizeOf(context).height * .75, - child: (model.state == ViewState.Busy) - ? Material( - color: Colors.grey.withOpacity(0.6), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20))), - child: Center( - child: Container( - child: GifLoaderContainer(), - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.height * 0.09)), - ), - ) - : SingleChildScrollView( - child: model.labOrdersResultsList.isNotEmpty - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - - Padding( - padding: const EdgeInsets.only( - top: 16.0, right: 16.0, bottom: 10, left: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(filterName??"", style: TextStyle( - fontSize: 21, - fontWeight: FontWeight.w700, - color: Colors.black, - letterSpacing: -0.64, - ),), - GestureDetector( - onTap: () => Navigator.pop(context), - child: Align( - alignment: Alignment.centerRight, - child: Icon( - Icons.close, - color: Colors.black, - size: 28, + onModelReady: (model) => + model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName, isVidaPlus: Utils.isVidaPlusProject(projectViewModel!, int.parse(patientLabOrder!.projectID!))), + builder: (context, model, w) { + return SizedBox( + height: MediaQuery.sizeOf(context).height * .75, + child: (model.state == ViewState.Busy) + ? Material( + color: Colors.grey.withOpacity(0.6), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), + child: Center( + child: Container(child: GifLoaderContainer(), margin: EdgeInsets.only(bottom: MediaQuery.of(context).size.height * 0.09)), + ), + ) + : SingleChildScrollView( + child: model.labOrdersResultsList.isNotEmpty + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.only(top: 16.0, right: 16.0, bottom: 10, left: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + filterName ?? "", + style: TextStyle( + fontSize: 21, + fontWeight: FontWeight.w700, + color: Colors.black, + letterSpacing: -0.64, + ), ), - ), + GestureDetector( + onTap: () => Navigator.pop(context), + child: Align( + alignment: Alignment.centerRight, + child: Icon( + Icons.close, + color: Colors.black, + size: 28, + ), + ), + ), + ], ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 17, top: 12, right: 13, bottom: 12), - margin: - EdgeInsets.only(left: 21, right: 21, top: 21), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - // child: LineChartCurved( - // title: filterName, - // labResult: model.labOrdersResultsList, - // ), - // child: ShowChart( - // title: filterName!, - // timeSeries: model.timeSeries, - // indexes: model.timeSeries.length ~/ 5.5 ?? 0, - // ), - child: Column( - children: [ - SizedBox( - height: MediaQuery.sizeOf(context).height / 4, - child: DynamicResultChart( - dataPoints: model.threePointGraphValue, - thresholds: model.threshold, - maxY: model.maxYForThreeDots, - width: MediaQuery.sizeOf(context).width - 77, - scrollDirection: Axis.horizontal, - height: MediaQuery.sizeOf(context).height / 4, + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12), + margin: EdgeInsets.only(left: 21, right: 21, top: 21), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - - InkWell( - onTap: () { - model.createFullGraphDatPoints(() { - Navigator.push(context, - MaterialPageRoute(builder: (_) { - return FullScreenGraph( - completeeGraphValues: model.completeeGraphValues, - threshold: model.threshold, - maxY : model.maxYForCompleteGraph - ); - })); - }); - }, - // child: Text(TranslationBase.of(context) - // .seeAllGraphValues), - child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false), - ) - ], + // child: LineChartCurved( + // title: filterName, + // labResult: model.labOrdersResultsList, + // ), + // child: ShowChart( + // title: filterName!, + // timeSeries: model.timeSeries, + // indexes: model.timeSeries.length ~/ 5.5 ?? 0, + // ), + child: Column( + children: [ + SizedBox( + height: MediaQuery.sizeOf(context).height / 4, + child: DynamicResultChart( + dataPoints: model.threePointGraphValue, + thresholds: model.threshold, + maxY: model.maxYForThreeDots, + width: MediaQuery.sizeOf(context).width - 77, + scrollDirection: Axis.horizontal, + height: MediaQuery.sizeOf(context).height / 4, + ), + ), + InkWell( + onTap: () { + model.createFullGraphDatPoints(() { + Navigator.push(context, MaterialPageRoute(builder: (_) { + return FullScreenGraph(completeeGraphValues: model.completeeGraphValues, threshold: model.threshold, maxY: model.maxYForCompleteGraph); + })); + }); + }, + // child: Text(TranslationBase.of(context) + // .seeAllGraphValues), + child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false), + ) + ], + ), + ), + LabResultChartAndDetails( + name: filterName!, + // labResult: model.labOrdersResultsList, + labResult: model.labOrdersResultsList.reversed.toList(), + ), + ], + ) + : Center( + child: Container( + padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.32), + child: Center( + child: getNoDataWidget(context), + ), ), ), - LabResultChartAndDetails( - name: filterName!, - // labResult: model.labOrdersResultsList, - labResult: model.labOrdersResultsList.reversed.toList(), - ), - ], - ) - : Center( - child: Container( - padding: EdgeInsets.only( - top: MediaQuery.of(context).size.height * 0.32), - child: Center( - child: getNoDataWidget(context), - ), - ), - ), - ), - );} - ); + ), + ); + }); } } diff --git a/lib/widgets/data_display/medical/LabResult/full_screen_lab_result_graph.dart b/lib/widgets/data_display/medical/LabResult/full_screen_lab_result_graph.dart index 58c72d3b..65412e14 100644 --- a/lib/widgets/data_display/medical/LabResult/full_screen_lab_result_graph.dart +++ b/lib/widgets/data_display/medical/LabResult/full_screen_lab_result_graph.dart @@ -17,7 +17,6 @@ class FullScreenGraph extends StatelessWidget { required this.completeeGraphValues, required this.threshold, required this.maxY}); - @override Widget build(BuildContext context) { return AppScaffold( @@ -25,7 +24,7 @@ class FullScreenGraph extends StatelessWidget { appBarTitle: TranslationBase.of(context).labResult, showNewAppBar: true, showNewAppBarTitle: true, - backgroundColor: Color(0xffF8F8F8), + showHomeAppBarIcon: false,backgroundColor: Color(0xffF8F8F8), body: RotatedBox( quarterTurns: 1, child: SizedBox( @@ -47,26 +46,27 @@ class FullScreenGraph extends StatelessWidget { : (completeeGraphValues.length/15)) ) )-100, maxX: completeeGraphValues.length+1, - // width: MediaQuery.sizeOf(context).height - 100, + // width: MediaQuery.sizeOf(context).height - 100, scrollDirection: Axis.horizontal, height: MediaQuery.sizeOf(context).width, showBottomTitleDates: true, isFullScreeGraph: true, - ), + // isFullScreenGraph: false, ), ), ), ), ), + ), ); } -// double getMax(List dataPoints) { -// double max = double.negativeInfinity; -// for (var point in dataPoints) { -// if (point.value > max) { -// max = point.y; -// } -// } -// return max; -// } + // double getMax(List dataPoints) { + // double max = double.negativeInfinity; + // for (var point in dataPoints) { + // if (point.value > max) { + // max = point.y; + // } + // } + // return max; + // } } diff --git a/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart b/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart index b2a676f7..1177c912 100644 --- a/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart +++ b/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart @@ -27,7 +27,6 @@ class DynamicResultChart extends StatelessWidget { else if((maxY??0)>5 &&(maxY??0)<=10) interval = 1; else if((maxY??0)>=0 &&(maxY??0)<=5) interval = .4; // else if((maxY??0)>=100) interval = 20; - print("the interval parameter is $interval"); // if (thresholds.isNotEmpty) { // print("the thresholds are $thresholds"); 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 6d37da53..fae3c671 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -62,6 +62,7 @@ class _LaboratoryResultWidgetState extends State { final shortestSide = size.shortestSide; return shortestSide >= 550; } + @override Widget build(BuildContext context) { isTabletScreen = isTablet(context); diff --git a/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart b/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart index ed4ed02e..822f83c5 100644 --- a/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart +++ b/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart @@ -141,8 +141,6 @@ class _LabItemState extends State { scrollControlDisabledMaxHeightRatio: .75, shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), builder: (context) { - print('builder: the bottom sheet is showing'); - return FlowChartPage( filterName: procedure, patientLabOrder: widget.patientLabOrders, diff --git a/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart b/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart index 4fbce744..36cd12ea 100644 --- a/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart +++ b/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart @@ -393,6 +393,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget { Text( "${TranslationBase.of(context).referenceRange} \n $referenceRange", style: TextStyle( + overflow: TextOverflow.clip, fontSize: 10, fontFamily: fontFamily, fontWeight: FontWeight.w600, diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index c61f1add..f10d08ed 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -262,6 +262,7 @@ class _AppScaffoldState extends State { showCenterLogo: widget.showCenteredLogo, isShowLanguageChanger: widget.isShowLanguageChanger, showSavedLoginBar: widget.showLastLoginScreenBar, + showHomeAppBarIcon: widget.showHomeAppBarIcon, onTap: () { widget.onTap; }, @@ -297,11 +298,7 @@ class _AppScaffoldState extends State { icon: widget.icon, ) : widget.baseViewModel != null - ? NetworkBaseView( - child: buildBodyWidget(context), - baseViewModel: widget.baseViewModel, - showLoader : widget.showLoader - ) + ? NetworkBaseView(child: buildBodyWidget(context), baseViewModel: widget.baseViewModel, showLoader: widget.showLoader) : buildBodyWidget(context), ), bottomNavigationBar: widget.isBottomBar @@ -369,6 +366,7 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget { final bool isShowLanguageChanger; final bool showCenterLogo; final bool showSavedLoginBar; + final bool? showHomeAppBarIcon; String currentLang = 'ar'; @@ -388,6 +386,7 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget { this.isShowLanguageChanger = false, this.showCenterLogo = false, this.showSavedLoginBar = false, + this.showHomeAppBarIcon = true, }) : super(key: key); @override @@ -586,17 +585,19 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget { if (appBarIcons != null) ...appBarIcons! else - IconButton( - onPressed: () { - AppSharedPreferences().remove(IS_LIVECARE_APPOINTMENT); - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route route) => false, - ); - }, - icon: Icon(Icons.home), - ), + showHomeAppBarIcon! + ? IconButton( + onPressed: () { + AppSharedPreferences().remove(IS_LIVECARE_APPOINTMENT); + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + (Route route) => false, + ); + }, + icon: Icon(Icons.home), + ) + : Container(), ], ); } @@ -623,7 +624,7 @@ class AppBarWidget extends StatefulWidget implements PreferredSizeWidget { AppBarWidget( {this.appBarTitle, - this.showHomeAppBarIcon, + this.showHomeAppBarIcon = true, this.appBarIcons, this.isPharmacy = true, this.isshowBackButton = true,