diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e034b05e..530bb2c6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1161,5 +1161,9 @@ const Map localizedValues = { "update-email": { "en": "Update Email", "ar": "تحديث البريد الالكتروني" - } + }, + "noDataAvailable": { + "en": "No data available", + "ar": " لا يوجد بيانات متاحة " + }, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index d58054c4..457d8aa7 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -90,7 +90,7 @@ class BaseAppClient { body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = SESSION_ID; //getSessionId(token); + body['SessionID'] = getSessionId(token); } } @@ -172,6 +172,6 @@ class BaseAppClient { String getSessionId(String id) { ///return id.replaceAll(RegExp('/[^\w\s]/'), ''); - // return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); + return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); } } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 8318025e..92914964 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -70,6 +70,7 @@ class LabsService extends BaseService { await baseAppClient.post(GET_Patient_LAB_RESULT, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); + labResultList.clear(); response['ListPLR'].forEach((lab) { labResultList.add(LabResult.fromJson(lab)); }); @@ -121,7 +122,7 @@ class LabsService extends BaseService { await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: 'A copy has been sent to the email'); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/medical/vital_sign_service.dart b/lib/core/service/medical/vital_sign_service.dart index 16909fd9..f8a6b356 100644 --- a/lib/core/service/medical/vital_sign_service.dart +++ b/lib/core/service/medical/vital_sign_service.dart @@ -5,14 +5,14 @@ import '../base_service.dart'; class VitalSignService extends BaseService { List vitalSignResModelList = List(); - Map body = Map(); + String weightKg = ""; String heightCm = ""; String bloadType = ""; Future getPatientRadOrders({int appointmentNo, int projectID}) async { hasError = false; - + Map body = Map(); if (appointmentNo != null && projectID != null) { body['TransNo'] = appointmentNo; body['ProjectID'] = projectID; diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 1f938fb0..06b7bd20 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -143,14 +144,11 @@ class LabsViewModel extends BaseViewModel { } } - sendLabReportEmail({PatientLabOrders patientLabOrder}) async { - setState(ViewState.Busy); + sendLabReportEmail({PatientLabOrders patientLabOrder,String mes}) async { await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); if (_labsService.hasError) { error = _labsService.error; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); - } + }else + AppToast.showSuccessToast(message: mes); } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 301ca97f..a86503a7 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -33,7 +34,9 @@ import 'package:provider/provider.dart'; class MyFamily extends StatefulWidget { final bool isAppbarVisible; + MyFamily({this.isAppbarVisible = true}); + @override _MyFamily createState() => _MyFamily(); } @@ -51,6 +54,8 @@ class _MyFamily extends State with TickerProviderStateMixin { locator(); ProjectViewModel projectViewModel; AuthenticatedUser user; + VitalSignService _vitalSignService = locator(); + @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); @@ -106,7 +111,8 @@ class _MyFamily extends State with TickerProviderStateMixin { child: Container( height: 60.0, margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.92, // 0.9, + width: MediaQuery.of(context).size.width * 0.92, + // 0.9, decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -660,8 +666,11 @@ class _MyFamily extends State with TickerProviderStateMixin { .familyFileProvider .silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser) - .then((value) => loginAfter(value, context)) - .catchError((err) { + .then((value) { + _vitalSignService.heightCm = ""; + _vitalSignService.weightKg = ""; + loginAfter(value, context); + }).catchError((err) { print(err); AppToast.showErrorToast(message: err); Navigator.of(context).pop(); diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 13d11a71..1b33225c 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -54,6 +54,7 @@ class _HomePageState extends State { return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( + isShowDecPage: false, body: Container( width: double.infinity, diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index dc3d10cc..a251a1ce 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -1,37 +1,50 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/laboratory_result_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class LaboratoryResultPage extends StatelessWidget { +class LaboratoryResultPage extends StatefulWidget { final PatientLabOrders patientLabOrders; LaboratoryResultPage({Key key, this.patientLabOrders}); + @override + _LaboratoryResultPageState createState() => _LaboratoryResultPageState(); +} + +class _LaboratoryResultPageState extends State { + + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getLaboratoryResult( - invoiceNo: patientLabOrders.invoiceNo, - clinicID: patientLabOrders.clinicID, - projectID: patientLabOrders.projectID, - orderNo: patientLabOrders.orderNo), - builder: (_, model, widget) => AppScaffold( + invoiceNo: widget.patientLabOrders.invoiceNo, + clinicID: widget.patientLabOrders.clinicID, + projectID: widget.patientLabOrders.projectID, + orderNo: widget.patientLabOrders.orderNo), + builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).labResults, baseViewModel: model, body: Scaffold( body: ListView.builder( itemBuilder: (context, index) => LaboratoryResultWidget( - onTap: () => model.sendLabReportEmail(patientLabOrder: patientLabOrders), - billNo: patientLabOrders.invoiceNo, + onTap: ()async { + GifLoaderDialogUtils.showMyDialog(context); + await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders,mes: TranslationBase.of(context).sendSuc); + GifLoaderDialogUtils.hideDialog(context); + }, + billNo: widget.patientLabOrders.invoiceNo, details: model.patientLabSpecialResult[index].resultDataHTML, - orderNo: patientLabOrders.orderNo, - patientLabOrder: patientLabOrders, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, ), itemCount: model.patientLabSpecialResult.length, ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index ce2738dd..c0ee178d 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -12,7 +12,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'confirm_send_email_dialog.dart'; +import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; diff --git a/lib/pages/medical/vital_sign/LineChartCurved.dart b/lib/pages/medical/vital_sign/LineChartCurved.dart new file mode 100644 index 00000000..f4c25a08 --- /dev/null +++ b/lib/pages/medical/vital_sign/LineChartCurved.dart @@ -0,0 +1,194 @@ +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartCurved extends StatelessWidget { + final String title; + final List timeSeries; + final int indexes; + + LineChartCurved({this.title, this.timeSeries, this.indexes}); + + List xAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Text( + title, + style: TextStyle( + color: Colors.black, + fontSize: 32, + fontWeight: FontWeight.bold, + letterSpacing: 2), + textAlign: TextAlign.center, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 18.0, left: 16.0), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries.length) { + xAxixs.add(mIndex); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + //rotateAngle:-65, + //rotateAngle:-65, + margin: 14, + getTitles: (value) { + if (timeSeries.length < 8) { + if (timeSeries.length > value.toInt()) { + return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == timeSeries.length - 1) + return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 11, + ), + getTitles: (value) { + return '${value.toInt()}'; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries.length - 1).toDouble(), + maxY: getMaxY(), + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble() + 10; + } + + double getMinY() { + double min = timeSeries[0].sales; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart index c4273a09..908fab8c 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -108,7 +108,7 @@ class VitalSignDetailsScreen extends StatelessWidget { des: TranslationBase.of(context).body, icon: DQIcons.bmi, lastVal: mode - .vitalSignResModelList[0].pulseBeatPerMinute + .vitalSignResModelList[ mode.vitalSignResModelList.length - 1].pulseBeatPerMinute .toString(), unit: TranslationBase.of(context).mass, ), @@ -130,7 +130,7 @@ class VitalSignDetailsScreen extends StatelessWidget { des: TranslationBase.of(context).temperature, icon: DQIcons.thermometer, lastVal: mode - .vitalSignResModelList[0].temperatureCelcius + .vitalSignResModelList[ mode.vitalSignResModelList.length - 1].temperatureCelcius .toString(), unit: TranslationBase.of(context).tempC, ), @@ -156,7 +156,7 @@ class VitalSignDetailsScreen extends StatelessWidget { icon: DQIcons.heart, lastVal: mode .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] + mode.vitalSignResModelList.length - 1] .pulseBeatPerMinute .toString(), unit: TranslationBase.of(context).bpm, @@ -179,7 +179,7 @@ class VitalSignDetailsScreen extends StatelessWidget { icon: DQIcons.outline, lastVal: mode .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] + mode.vitalSignResModelList.length - 1] .respirationBeatPerMinute .toString(), unit: TranslationBase.of(context).respirationSigns, @@ -206,7 +206,7 @@ class VitalSignDetailsScreen extends StatelessWidget { icon: DQIcons.blood_pressure, lastVal: mode .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] + mode.vitalSignResModelList.length - 1] .bloodPressure .toString(), unit: TranslationBase.of(context).sysDias, diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index a56ee0ba..a48970eb 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -6,6 +6,8 @@ import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; +import 'LineChartCurved.dart'; + class VitalSingChartAndDetials extends StatelessWidget { VitalSingChartAndDetials({ Key key, @@ -21,29 +23,16 @@ class VitalSingChartAndDetials extends StatelessWidget { final String viewKey; final String title1; final String title2; - List timeSeriesData = []; + List timeSeriesData = []; @override Widget build(BuildContext context) { + generateData(); return Column( children: [ AppExpandableNotifier( - headerWidget: AppTimeSeriesChart( - seriesList: generateData(), - chartName: name, - startDate: DateTime( - vitalList[vitalList.length - 1] - .vitalSignDate - .year, - vitalList[vitalList.length - 1] - .vitalSignDate - .month + - 3, - vitalList[vitalList.length - 1] - .vitalSignDate - .day), - endDate: vitalList[0].vitalSignDate, - ), + isExpand: true, + headerWidget: LineChartCurved(title: name,timeSeries:timeSeriesData,indexes: timeSeriesData.length~/3.5,), bodyWidget: VitalSignDetailsWidget( vitalList: vitalList, title1: title1, @@ -61,23 +50,14 @@ class VitalSingChartAndDetials extends StatelessWidget { (element) { if( element.toJson()[viewKey]?.toInt()!=0) timeSeriesData.add( - TimeSeriesSales( - new DateTime(element.vitalSignDate.year, - element.vitalSignDate.month, element.vitalSignDate.day), - element.toJson()[viewKey]?.toInt(), + TimeSeriesSales2( + new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), + element.toJson()[viewKey].toDouble(), ), ); }, ); } - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (TimeSeriesSales sales, _) => sales.time, - measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: timeSeriesData, - ) - ]; + return timeSeriesData.reversed.toList(); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index bc28227d..7b60d97e 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1017,6 +1017,7 @@ class TranslationBase { String get later => localizedValues['later'][locale.languageCode]; String get sendConfEmail => localizedValues['send-email'][locale.languageCode]; String get updateEmail => localizedValues['update-email'][locale.languageCode]; + String get noDataAvailable => localizedValues['noDataAvailable'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart index 0056e23e..ce811406 100644 --- a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart +++ b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart @@ -16,13 +16,26 @@ class LineChartCurved extends StatefulWidget { class LineChartCurvedState extends State { bool isShowingMainData; + List xAxixs = List(); + int indexes = 0; @override void initState() { super.initState(); + getXaxix(); isShowingMainData = true; } + getXaxix() { + indexes = widget.labResult.length ~/ 3.5; + for (int index = 0; index < widget.labResult.length; index++) { + int mIndex = indexes * index; + if (mIndex < widget.labResult.length) { + xAxixs.add(mIndex); + } + } + } + @override Widget build(BuildContext context) { return AspectRatio( @@ -40,7 +53,7 @@ class LineChartCurvedState extends State { const SizedBox( height: 4, ), - Text( + Text( widget.title, style: TextStyle( color: Colors.black, @@ -49,7 +62,6 @@ class LineChartCurvedState extends State { letterSpacing: 2), textAlign: TextAlign.center, ), - Expanded( child: Padding( padding: const EdgeInsets.only(right: 16.0, left: 6.0), @@ -79,7 +91,8 @@ class LineChartCurvedState extends State { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData(show: true, drawVerticalLine: true,drawHorizontalLine: true), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -90,20 +103,33 @@ class LineChartCurvedState extends State { margin: 10, getTitles: (value) { print(value); - if(widget.labResult.length>value.toInt()) - { DateTime date = DateUtil.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime); - return '${date.day}/ ${date.year}';} - return ''; - } + DateTime date = DateUtil.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime); + if (widget.labResult.length < 8) { + if (widget.labResult.length > value.toInt()) { + return '${date.day}/ ${date.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${date.day}/ ${date.year}'; + if (value.toInt() == widget.labResult.length - 1) + return '${date.day}/ ${date.year}'; + if (xAxixs.contains(value.toInt())) { + return '${date.day}/ ${date.year}'; + } + } + + - , + return ''; + }, ), leftTitles: SideTitles( showTitles: true, getTextStyles: (value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, - fontSize: 14, + fontSize: 10, ), getTitles: (value) { return '${value.toInt()}'; @@ -131,41 +157,38 @@ class LineChartCurvedState extends State { ), ), minX: 0, - maxX: (widget.labResult.length-1).toDouble(), + maxX: (widget.labResult.length - 1).toDouble(), maxY: getMaxY(), minY: getMinY(), lineBarsData: getData(), ); } - double getMaxY(){ - double max =0; + double getMaxY() { + double max = 0; widget.labResult.forEach((element) { - double resultValueDouble =double.parse(element.resultValue); - if(resultValueDouble>max) - max = resultValueDouble; + double resultValueDouble = double.parse(element.resultValue); + if (resultValueDouble > max) max = resultValueDouble; }); return max.roundToDouble(); } - double getMinY(){ - double min =double.parse(widget.labResult[0].resultValue); - + double getMinY() { + double min = double.parse(widget.labResult[0].resultValue); widget.labResult.forEach((element) { - double resultValueDouble =double.parse(element.resultValue); - if(resultValueDouble getData() { List spots = List(); - for (int index = 0; index < widget.labResult.length ; index++) { + for (int index = 0; index < widget.labResult.length; index++) { var resultValueDouble = double.parse(widget.labResult[index].resultValue); spots.add(FlSpot(index.toDouble(), resultValueDouble)); } @@ -181,7 +204,6 @@ class LineChartCurvedState extends State { ), belowBarData: BarAreaData( show: false, - ), ); @@ -190,5 +212,3 @@ class LineChartCurvedState extends State { ]; } } - - diff --git a/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart b/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart index bec6d63a..755e6a3a 100644 --- a/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart +++ b/lib/widgets/data_display/medical/LabResult/lab_result_chart_and_detials.dart @@ -34,6 +34,7 @@ class LabResultChartAndDetails extends StatelessWidget { bodyWidget: LabResultDetailsWidget( labResult: labResult, ), + isExpand: true, ), ], ); 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 79cf632b..aa6ae3d9 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dar import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/cupertino.dart'; @@ -36,8 +37,8 @@ class LaboratoryResultWidget extends StatefulWidget { } class _LaboratoryResultWidgetState extends State { - bool _isShowMore = false; - bool _isShowMoreGeneral = false; + bool _isShowMore = true; + bool _isShowMoreGeneral = true; ProjectViewModel projectViewModel; @override @@ -55,8 +56,10 @@ class _LaboratoryResultWidgetState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + + Container( - margin: EdgeInsets.all(15), + margin: EdgeInsets.all(8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -80,7 +83,9 @@ class _LaboratoryResultWidgetState extends State { ), ), InkWell( - onTap: widget.onTap, + onTap: (){ + showConfirmMessage(context,widget.onTap,projectViewModel.user.emailAddress); + }, child: Container( margin: EdgeInsets.only(left: 5, right: 5), decoration: BoxDecoration( @@ -110,6 +115,88 @@ class _LaboratoryResultWidgetState extends State { ], ), ), + SizedBox( + height: 12, + ), + if( model.labResultLists.isNotEmpty) + Container( + child: Column( + children: [ + InkWell( + onTap: () { + setState( + () { + _isShowMoreGeneral = !_isShowMoreGeneral; + }, + ); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + 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: [ + ...List.generate( + model.labResultLists.length, + (index) => LabResultWidget( + patientLabOrder: widget.patientLabOrder, + filterName: model + .labResultLists[index].filterName, + patientLabResultList: model + .labResultLists[index] + .patientLabResultList, + ), + ) + ], + ), + ), + ), + ], + ), + ), SizedBox( height: 10, ), @@ -163,90 +250,10 @@ class _LaboratoryResultWidgetState extends State { child: Container( width: double.infinity, child: Html( - data: widget.details ?? 'No Data', + data: widget.details ?? TranslationBase.of(context).noDataAvailable, )), ), - SizedBox( - height: 12, - ), - Container( - child: Column( - children: [ - InkWell( - onTap: () { - setState( - () { - _isShowMoreGeneral = !_isShowMoreGeneral; - }, - ); - }, - child: Container( - padding: EdgeInsets.all(10.0), - margin: EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(5.0), - )), - 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: [ - ...List.generate( - model.labResultLists.length, - (index) => LabResultWidget( - patientLabOrder: widget.patientLabOrder, - filterName: model - .labResultLists[index].filterName, - patientLabResultList: model - .labResultLists[index] - .patientLabResultList, - ), - ) - ], - ), - ), - ), - ], - ), - ) + ], ), ], @@ -255,4 +262,15 @@ class _LaboratoryResultWidgetState extends State { ), ); } + void showConfirmMessage(BuildContext context, GestureTapCallback onTap,String email) { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: email, + onTapSendEmail: () { + onTap(); + }, + ), + ); + } } diff --git a/lib/pages/medical/prescriptions/confirm_send_email_dialog.dart b/lib/widgets/dialogs/confirm_send_email_dialog.dart similarity index 99% rename from lib/pages/medical/prescriptions/confirm_send_email_dialog.dart rename to lib/widgets/dialogs/confirm_send_email_dialog.dart index 047b663d..694a1268 100644 --- a/lib/pages/medical/prescriptions/confirm_send_email_dialog.dart +++ b/lib/widgets/dialogs/confirm_send_email_dialog.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../routes.dart'; +import '../../routes.dart'; class ConfirmSendEmailDialog extends StatefulWidget { final String email; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index b30a3922..82de66ad 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -491,7 +491,10 @@ class _AppDrawerState extends State { .familyFileProvider .silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser) - .then((value) { + .then((value) async{ + await authenticatedUserObject.getUser(); + _vitalSignService.heightCm = ""; + _vitalSignService.weightKg = ""; GifLoaderDialogUtils.hideDialog(context); loginAfter(value, context); }).catchError((err) { diff --git a/lib/widgets/others/app_expandable_notifier.dart b/lib/widgets/others/app_expandable_notifier.dart index 23a3a59f..eb422a63 100644 --- a/lib/widgets/others/app_expandable_notifier.dart +++ b/lib/widgets/others/app_expandable_notifier.dart @@ -57,17 +57,19 @@ class _AppExpandableNotifier extends State { header: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: EdgeInsets.all(10), - child: Text( - widget.title ?? TranslationBase.of(context).details, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2, + Expanded( + child: Padding( + padding: EdgeInsets.all(10), + child: Text( + widget.title ?? TranslationBase.of(context).details, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2, + ), ), ), ), - new IconButton( + IconButton( icon: new Container( height: 28.0, width: 30.0,