diff --git a/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart b/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart index bb100219..2f4ec9f0 100644 --- a/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart +++ b/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart @@ -49,6 +49,7 @@ class UserDetailModel { this.isNotificationON}); UserDetailModel.fromJson(Map json) { + if(json==null) return; userID = json['UserID']; patientID = json['PatientID']; patientType = json['PatientType']; diff --git a/lib/core/service/medical/WeightPressureService.dart b/lib/core/service/medical/WeightPressureService.dart index b48c4795..6d150c28 100644 --- a/lib/core/service/medical/WeightPressureService.dart +++ b/lib/core/service/medical/WeightPressureService.dart @@ -7,12 +7,9 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; class WeightService extends BaseService { ///Average - List - monthWeightMeasurementResultAverage = List(); - List weekWeightMeasurementResultAverage = - List(); - List yearWeightMeasurementResultAverage = - List(); + List monthWeightMeasurementResultAverage = List(); + List weekWeightMeasurementResultAverage = List(); + List yearWeightMeasurementResultAverage = List(); ///Result List monthWeightMeasurementResult = List(); @@ -23,24 +20,20 @@ class WeightService extends BaseService { hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT_AVERAGE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT_AVERAGE, onSuccess: (dynamic response, int statusCode) { monthWeightMeasurementResultAverage.clear(); weekWeightMeasurementResultAverage.clear(); yearWeightMeasurementResultAverage.clear(); response['List_MonthWeightMeasurementResultAverage'].forEach((item) { - monthWeightMeasurementResultAverage - .add(MonthWeightMeasurementResultAverage.fromJson(item)); + monthWeightMeasurementResultAverage.add(MonthWeightMeasurementResultAverage.fromJson(item)); }); response['List_WeekWeightMeasurementResultAverage'].forEach((item) { - weekWeightMeasurementResultAverage - .add(WeekWeightMeasurementResultAverage.fromJson(item)); + weekWeightMeasurementResultAverage.add(WeekWeightMeasurementResultAverage.fromJson(item)); }); response['List_YearWeightMeasurementResultAverage'].forEach((item) { - yearWeightMeasurementResultAverage - .add(YearWeightMeasurementResultAverage.fromJson(item)); + yearWeightMeasurementResultAverage.add(YearWeightMeasurementResultAverage.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -50,8 +43,7 @@ class WeightService extends BaseService { Future getWeightMeasurementResult() async { hasError = false; - await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT, onSuccess: (dynamic response, int statusCode) { monthWeightMeasurementResult.clear(); weekWeightMeasurementResult.clear(); yearWeightMeasurementResult.clear(); @@ -61,8 +53,7 @@ class WeightService extends BaseService { }); response['List_MonthWeightMeasurementResult'].forEach((item) { - monthWeightMeasurementResult - .add(WeightMeasurementResult.fromJson(item)); + monthWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item)); }); response['List_YearWeightMeasurementResult'].forEach((item) { @@ -74,8 +65,7 @@ class WeightService extends BaseService { }, body: Map()); } - addWeightResult( - {String weightDate, String weightMeasured, int weightUnit}) async { + addWeightResult({String weightDate, String weightMeasured, int weightUnit}) async { hasError = false; super.error = ""; @@ -85,15 +75,14 @@ class WeightService extends BaseService { body['weightUnit'] = weightUnit; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(ADD_WEIGHT_PRESSURE_RESULT, - onSuccess: (response, statusCode) async {}, + await baseAppClient.post(ADD_WEIGHT_PRESSURE_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } - updateWeightResult({int lineItemNo, int weightUnit,String weightMeasured,String weightDate}) async { + updateWeightResult({int lineItemNo, int weightUnit, String weightMeasured, String weightDate}) async { hasError = false; super.error = ""; Map body = Map(); @@ -103,36 +92,36 @@ class WeightService extends BaseService { body['WeightDate'] = weightDate; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(UPDATE_WEIGHT_PRESSURE_RESULT, - onSuccess: (response, statusCode) async {}, + await baseAppClient.post(UPDATE_WEIGHT_PRESSURE_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + Future sendReportByEmail() async { hasError = false; super.error = ""; Map body = Map(); body['isDentalAllowedBackend'] = false; body['to'] = user.emailAddress; - await baseAppClient.post(SEND_AVERAGE_BLOOD_WEIGHT_REPORT, - onSuccess: (response, statusCode) async {}, + await baseAppClient.post(SEND_AVERAGE_BLOOD_WEIGHT_REPORT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + hasError = true; + super.error = error; + }, body: body); } - deleteWeightResult({int lineItemNo, }) async { + deleteWeightResult({ + int lineItemNo, + }) async { hasError = false; super.error = ""; Map body = Map(); body['LineItemNo'] = lineItemNo; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(DEACTIVATE_WEIGHT_PRESSURE_RESULT, - onSuccess: (response, statusCode) async {}, + await baseAppClient.post(DEACTIVATE_WEIGHT_PRESSURE_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/medical/weight_pressure_view_model.dart b/lib/core/viewModels/medical/weight_pressure_view_model.dart index 42db0a58..4a01bd3b 100644 --- a/lib/core/viewModels/medical/weight_pressure_view_model.dart +++ b/lib/core/viewModels/medical/weight_pressure_view_model.dart @@ -16,14 +16,11 @@ import '../../../core/viewModels/base_view_model.dart'; class WeightPressureViewModel extends BaseViewModel { WeightService weightService = locator(); - List get monthWeightMeasurementResult => - weightService.monthWeightMeasurementResult; + List get monthWeightMeasurementResult => weightService.monthWeightMeasurementResult; - List get weekWeightMeasurementResult => - weightService.weekWeightMeasurementResult; + List get weekWeightMeasurementResult => weightService.weekWeightMeasurementResult; - List get yearWeightMeasurementResult => - weightService.yearWeightMeasurementResult; + List get yearWeightMeasurementResult => weightService.yearWeightMeasurementResult; List weightWeekTimeSeriesData = []; List weighMonthTimeSeriesData = []; @@ -35,7 +32,7 @@ class WeightPressureViewModel extends BaseViewModel { await weightService.getWeightMeasurementResult(); if (weightService.hasError) { error = weightService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else { weightService.weekWeightMeasurementResultAverage.forEach((element) { weightWeekTimeSeriesData.add(TimeSeriesSales2( @@ -44,14 +41,10 @@ class WeightPressureViewModel extends BaseViewModel { )); }); - for (int index = 0; - index < weightService.monthWeightMeasurementResultAverage.length; - index++) { + for (int index = 0; index < weightService.monthWeightMeasurementResultAverage.length; index++) { weighMonthTimeSeriesData.add(TimeSeriesSales3( index, - weightService - .monthWeightMeasurementResultAverage[index].weekAverageResult - .toDouble(), + weightService.monthWeightMeasurementResultAverage[index].weekAverageResult.toDouble(), )); } @@ -66,8 +59,7 @@ class WeightPressureViewModel extends BaseViewModel { } } - addWeightResult( - {String weightDate, String weightMeasured, int weightUnit}) async { + addWeightResult({String weightDate, String weightMeasured, int weightUnit}) async { setState(ViewState.BusyLocal); await weightService.addWeightResult( weightDate: weightDate, @@ -82,6 +74,7 @@ class WeightPressureViewModel extends BaseViewModel { setState(ViewState.Idle); } } + Future sendReportByEmail() async { setState(ViewState.BusyLocal); @@ -94,14 +87,10 @@ class WeightPressureViewModel extends BaseViewModel { } } - updateWeightResult({int lineItemNo, int weightUnit, String weightMeasured,String weightDate}) async { + updateWeightResult({int lineItemNo, int weightUnit, String weightMeasured, String weightDate}) async { setState(ViewState.BusyLocal); await weightService.updateWeightResult( - lineItemNo: lineItemNo, - weightMeasured: weightMeasured, - weightUnit: weightUnit, - weightDate: weightDate - ); + lineItemNo: lineItemNo, weightMeasured: weightMeasured, weightUnit: weightUnit, weightDate: weightDate); if (weightService.hasError) { error = weightService.error; setState(ViewState.Error); @@ -111,7 +100,9 @@ class WeightPressureViewModel extends BaseViewModel { } } - deleteWeightResult({int lineItemNo, }) async { + deleteWeightResult({ + int lineItemNo, + }) async { setState(ViewState.BusyLocal); await weightService.deleteWeightResult( lineItemNo: lineItemNo, diff --git a/lib/core/viewModels/vaccine_view_model.dart b/lib/core/viewModels/vaccine_view_model.dart index 9f8dfecf..37b57da4 100644 --- a/lib/core/viewModels/vaccine_view_model.dart +++ b/lib/core/viewModels/vaccine_view_model.dart @@ -22,7 +22,7 @@ class VaccineViewModel extends BaseViewModel { await _vaccineService.getMyVaccine(); if (_vaccineService.hasError) { error = _vaccineService.error; - setState(ViewState.ErrorLocal); + setState(ViewState.Error); } else setState(ViewState.Idle); } diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 33383287..03d11f50 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -7,8 +8,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class TodayPage extends StatelessWidget { + Future readPrefs() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; + } + @override Widget build(BuildContext context) { return BaseView( @@ -34,55 +41,75 @@ class TodayPage extends StatelessWidget { : (model.userProgressData.percentageConsumed / 100) >= 1 ? 1 : (model.userProgressData.percentageConsumed / 100), - //, center: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - // SizedBox( - // height: 40, - // ), - Text( - TranslationBase.of(context).consumed, - style: TextStyle(fontSize: 16.0), - ), - SizedBox( - height: 4, - ), - Text( - model.userProgressData == null - ? "0.0" - : model.userProgressData.quantityConsumed.toString() + TranslationBase.of(context).ml, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")), - ), - SizedBox( - height: 4, - ), - SizedBox( - height: 5, - width: 50, - child: Container(), - ), - SizedBox( - height: 4, - ), - Text( - TranslationBase.of(context).remaining, - style: TextStyle(fontSize: 16.0), - ), - SizedBox( - height: 4, - ), - Text( - model.userProgressData == null - ? "0.0" - : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed) < 0 - ? "0 ${TranslationBase.of(context).ml}" - : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed).toString() + - ' ${TranslationBase.of(context).ml}', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0), - ), - ], + child: FutureBuilder( + future: readPrefs(), + builder: (context, data) { + var isUnitML = true; + String unit; + if (data.connectionState == ConnectionState.done) { + isUnitML = data.data; + } + if (isUnitML) { + unit = TranslationBase.of(context).ml; + } else { + unit = TranslationBase.of(context).l; + } + unit = unit.toLowerCase(); + var totalH2O = model?.userProgressData?.quantityLimit ?? 0.0; + var consumedH2O = model?.userProgressData?.quantityConsumed ?? 0.0; + if (!isUnitML) { + totalH2O = totalH2O / 1000; + consumedH2O = consumedH2O / 1000; + } + var remainingH2O = totalH2O - consumedH2O; + + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + // SizedBox( + // height: 40, + // ), + Text( + TranslationBase.of(context).consumed, + style: TextStyle(fontSize: 16.0), + ), + SizedBox( + height: 4, + ), + Text( + model.userProgressData == null ? "0.0" : "$consumedH2O $unit", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")), + ), + SizedBox( + height: 4, + ), + SizedBox( + height: 5, + width: 50, + child: Container(), + ), + SizedBox( + height: 4, + ), + Text( + TranslationBase.of(context).remaining, + style: TextStyle(fontSize: 16.0), + ), + SizedBox( + height: 4, + ), + Text( + model.userProgressData == null + ? "0.0" + : (remainingH2O) < 0 + ? "0 $unit" + : '$remainingH2O $unit', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0), + ), + ], + ); + }, ), ), circularStrokeCap: CircularStrokeCap.butt, diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index 34e365e6..6f4423b2 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +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/charts/app_bar_chart.dart'; @@ -8,10 +9,12 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class WeekPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getUserProgressForWeekData(), builder: (_, model, widget) => AppScaffold( @@ -46,7 +49,7 @@ class WeekPage extends StatelessWidget { ], ), // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForWeekDataSeries), + AppBarChart(seriesList: model.userProgressForWeekDataSeries,isArabic: projectViewModel.isArabic), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index dbd8939c..fab4eb6d 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -9,7 +9,6 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; - import 'health_calculator/bmi_calculator/bmi_calculator.dart'; import 'health_calculator/bmr_calculator/bmr_calculator.dart'; import 'health_calculator/calorie_calculator/calorie_calculator.dart'; @@ -21,8 +20,7 @@ class HealthCalculators extends StatefulWidget { _HealthCalculatorsState createState() => _HealthCalculatorsState(); } -class _HealthCalculatorsState extends State - with SingleTickerProviderStateMixin { +class _HealthCalculatorsState extends State with SingleTickerProviderStateMixin { TabController _tabController; void initState() { super.initState(); @@ -67,22 +65,19 @@ class _HealthCalculatorsState extends State indicatorWeight: 4.0, indicatorColor: Colors.red, labelColor: Theme.of(context).buttonColor, - labelPadding: - EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), + labelPadding: EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), unselectedLabelColor: Colors.grey, tabs: [ Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( - child: Texts( - TranslationBase.of(context).generalHealth), + child: Texts(TranslationBase.of(context).generalHealth), ), ), Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( - child: - Texts(TranslationBase.of(context).womanHealth), + child: Texts(TranslationBase.of(context).womanHealth), ), ), ], @@ -121,8 +116,7 @@ class _HealthCalculatorsState extends State child: MedicalProfileItem( title: TranslationBase.of(context).bmi, imagePath: 'bmi_health_calculator.png', - subTitle: - TranslationBase.of(context).calcHealth, + subTitle: TranslationBase.of(context).calcHealth, ), ), ), @@ -140,8 +134,7 @@ class _HealthCalculatorsState extends State child: MedicalProfileItem( title: TranslationBase.of(context).calories, imagePath: 'calories-calculator.png', - subTitle: - TranslationBase.of(context).calcHealth, + subTitle: TranslationBase.of(context).calcHealth, ), ), ), @@ -163,8 +156,7 @@ class _HealthCalculatorsState extends State child: MedicalProfileItem( title: TranslationBase.of(context).bmr, imagePath: 'BMR_calculator.png', - subTitle: - TranslationBase.of(context).calcHealth, + subTitle: TranslationBase.of(context).calcHealth, ), ), ), @@ -220,11 +212,9 @@ class _HealthCalculatorsState extends State ); }, child: MedicalProfileItem( - title: - TranslationBase.of(context).carbohydrate, + title: TranslationBase.of(context).carbohydrate, imagePath: 'carb_protein.png', - subTitle: - TranslationBase.of(context).proteinFat, + subTitle: TranslationBase.of(context).proteinFat, ), ), ), diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 266a0a70..298b121c 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -93,9 +93,16 @@ class _ToDoState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.appoList.length, itemBuilder: (context, index) { + print("ttt "+getNextActionImage(widget + .appoList[index] + .nextAction)); + print("ttt "+widget + .appoList[index] + .nextAction.toString()); return Container( margin: EdgeInsets.all(10.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: Card( @@ -367,44 +374,32 @@ class _ToDoState extends State { color: Color(0xff20bc44), ), height: 30.0, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB(160.0, 0.0, 30.0, 0.0) - : EdgeInsets.fromLTRB(20.0, 0.0, 160.0, 0.0), + padding: EdgeInsets.only(right:15), + margin: EdgeInsets.symmetric(horizontal:20), transform: Matrix4.translationValues(0.0, -8.0, 0.0), child: Row( + mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ widget.appoList[index].isLiveCareAppointment - ? Container( - margin: EdgeInsets.fromLTRB( - 5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/video.png"), - ) - : Container( - margin: EdgeInsets.fromLTRB( - 5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/walkin.png"), - ), + ? Image.asset( + "assets/images/new-design/video.png") + : Image.asset( + "assets/images/new-design/walkin.png"), widget.appoList[index].isLiveCareAppointment - ? Container( - child: Text( - TranslationBase.of(context).videoAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)), - ) - : Container( - child: Text( - TranslationBase.of(context) - .walkinAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)), - ) + ? Text( + TranslationBase.of(context).videoAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11.0)) + : Text( + TranslationBase.of(context) + .walkinAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11.0)) ], ), ), @@ -460,6 +455,10 @@ class _ToDoState extends State { return "assets/images/new-design/waiting_for_doctor.png"; break; + case 90: + return "assets/images/new-design/check-in.png"; + break; + default: return ""; } @@ -481,6 +480,9 @@ class _ToDoState extends State { break; case 60: break; + case 90: + getAppoQR(context, appo); + break; } } @@ -517,6 +519,10 @@ class _ToDoState extends State { return TranslationBase.of(context).waitingForDoctor; break; + case 90: + return TranslationBase.of(context).checkinOptions; + break; + default: return ""; } diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index e37f3138..5b297e89 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -93,16 +93,24 @@ class _StatusFeedbackPageState extends State { child: Center( child: Column( children: [ - SizedBox(height: MediaQuery.of(context).size.height*0.4,), - Image.asset('assets/images/comments.png',width: 80,height: 80,), - SizedBox(height: 15,), + SizedBox( + height: MediaQuery.of(context).size.height * 0.4, + ), + Image.asset( + 'assets/images/comments.png', + width: 80, + height: 80, + ), + SizedBox( + height: 15, + ), Texts(TranslationBase.of(context).noSearchResult), ], ), ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, + height: 80, width: double.infinity, padding: EdgeInsets.all(15.0), child: Center( @@ -112,8 +120,7 @@ class _StatusFeedbackPageState extends State { label: TranslationBase.of(context).search, textColor: Colors.white, disabled: true, - onTap: () { - }, + onTap: () {}, ), ), ), diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index c90b29a7..41592110 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -20,8 +20,7 @@ class WeightHomePage extends StatefulWidget { _WeightHomePageState createState() => _WeightHomePageState(); } -class _WeightHomePageState extends State - with SingleTickerProviderStateMixin { +class _WeightHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -42,33 +41,38 @@ class _WeightHomePageState extends State onModelReady: (model) => model.getWeight(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, + isShowDecPage: false, appBarTitle: TranslationBase.of(context).weight, - appBarIcons: [IconButton( - icon: Icon(Icons.email), - color: Colors.white, - onPressed: () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async{ - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if(model.state == ViewState.ErrorLocal){ + appBarIcons: [ + IconButton( + icon: Icon(Icons.email), + color: Colors.white, + onPressed: () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: model.error); - }else{ - AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); - } - }).catchError((e){ - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); - }, - ), - ); - }, - ),], + }); + }, + ), + ); + }, + ), + ], baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, @@ -89,7 +93,7 @@ class _WeightHomePageState extends State model: model, ), WeightYearPage( - model: model, + model: model, ) ], ), @@ -98,7 +102,12 @@ class _WeightHomePageState extends State ), floatingActionButton: InkWell( onTap: () { - Navigator.push(context, FadePage(page: AddWeightPage(model: model,))); + Navigator.push( + context, + FadePage( + page: AddWeightPage( + model: model, + ))); }, child: Container( width: 55, diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index 6f64bacb..e3aa9755 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -28,46 +28,61 @@ class WeightMonthlyPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: model.weighMonthTimeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):ListView( - children: [ - Container( - width: double.maxFinite, - color: Colors.white, - child: MonthLineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weighMonthTimeSeriesData, - indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, - )), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), + isShowDecPage: false, + body: model.weighMonthTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Container( + child: Center( + child: MonthLineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weighMonthTimeSeriesData, + indexes: model.weighMonthTimeSeriesData.length ~/ 5.5 ?? 0, + ), ), - children: fullData(context, projectViewModel, model), ), + ), + ) + : ListView( + children: [ + Container( + width: double.maxFinite, + color: Colors.white, + child: MonthLineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weighMonthTimeSeriesData, + indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, + )), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(context, projectViewModel, model), + ), + ], + ), + ) ], ), - ) - ], - ), ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( @@ -76,12 +91,8 @@ class WeightMonthlyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -109,12 +120,8 @@ class WeightMonthlyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index 866c2b5b..d0c92da1 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -1,5 +1,3 @@ -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; @@ -26,47 +24,62 @@ class WeightWeeklyPage extends StatelessWidget { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: model.weightWeekTimeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: LineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightWeekTimeSeriesData, - indexes: model.weightWeekTimeSeriesData.length ~/ 5.5, - ), - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), + isShowDecPage: false, + body: model.weightWeekTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Container( + child: Center( + child: LineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightWeekTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, + ), ), - children: fullData(context, projectViewModel, model), ), + ), + ) + : ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: LineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightWeekTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, + ), + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(context, projectViewModel, model), + ), + ], + ), + ) ], ), - ) - ], - ), ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( @@ -75,12 +88,8 @@ class WeightWeeklyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -120,12 +129,8 @@ class WeightWeeklyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( diff --git a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart index 7fa03819..f8fc4dc4 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart @@ -18,55 +18,70 @@ import 'package:provider/provider.dart'; class WeightYearPage extends StatelessWidget { final WeightPressureViewModel model; - - const WeightYearPage({Key key, this.model, }) - : super(key: key); + const WeightYearPage({ + Key key, + this.model, + }) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: model.weightYearTimeSeriesData.isEmpty ? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),) : ListView( - children: [ - Container( - width: double.maxFinite, - color: Colors.white, - child: LineChartCurved( - horizontalInterval: 2.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightYearTimeSeriesData, - indexes: model.weightYearTimeSeriesData.length ~/ 5.5, - ) - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), + isShowDecPage: false, + body: model.weightYearTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Container( + child: Center( + child: LineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightYearTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, + ), ), - children: fullData(context, projectViewModel, model), ), + ), + ) + : ListView( + children: [ + Container( + width: double.maxFinite, + color: Colors.white, + child: LineChartCurved( + horizontalInterval: 2.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightYearTimeSeriesData, + indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", + )), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(context, projectViewModel, model), + ), + ], + ), + ) ], ), - ) - ], - ), ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( @@ -75,12 +90,8 @@ class WeightYearPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -108,12 +119,8 @@ class WeightYearPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( @@ -128,7 +135,7 @@ class WeightYearPage extends StatelessWidget { ), ); model.yearWeightMeasurementResult.forEach( - (diabtec) { + (diabtec) { tableRow.add( TableRow( children: [ diff --git a/lib/splashPage.dart b/lib/splashPage.dart index df474862..5f4c667c 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -3,10 +3,12 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:firebase_analytics/observer.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; - +import 'package:flutter/services.dart'; +import 'analytics/google-analytics.dart'; import 'config/shared_pref_kay.dart'; import 'config/size_config.dart'; import 'core/service/AuthenticatedUserObject.dart'; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 2602b92f..81f8ed35 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -478,11 +478,12 @@ class TranslationBase { String get medicalProfile => localizedValues['medicalProfile'][locale.languageCode]; String get parking => localizedValues['parking'][locale.languageCode]; - - String get alhabiServices => localizedValues['alhabiServices'][locale.languageCode]; - - String get parkingTitle => localizedValues['parkingTitle'][locale.languageCode]; - + String get parkingDescription => localizedValues['parkingDescription'][locale.languageCode]; + String get checkinOptions => localizedValues['checkinOption'][locale.languageCode]; + String get alhabiServices => + localizedValues['alhabiServices'][locale.languageCode]; + String get parkingTitle => + localizedValues['parkingTitle'][locale.languageCode]; String get readBarcode => localizedValues['readBarcode'][locale.languageCode]; String get showMyPark => localizedValues['showMyPark'][locale.languageCode]; @@ -817,8 +818,10 @@ class TranslationBase { String get reviewComment => localizedValues['reviewComment'][locale.languageCode]; String get shippedMethod => localizedValues['shippedMethod'][locale.languageCode]; String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; - String get deliveryDriverTrack => localizedValues['DeliveryDriverTrack'][locale.languageCode]; - String get deliveryLocation => localizedValues['DeliveryLocation'][locale.languageCode]; + String get deliveryDriverTrack => + localizedValues['DeliveryDriverTrack'][locale.languageCode]; + String get deliveryLocation => + localizedValues['DeliveryLocation'][locale.languageCode]; String get driver => localizedValues['Driver'][locale.languageCode]; String get subtotal => localizedValues['subtotal'][locale.languageCode]; String get shipping => localizedValues['shipping'][locale.languageCode]; @@ -1143,22 +1146,25 @@ class TranslationBase { String get searchItemError => localizedValues['searchItemError'][locale.languageCode]; String get youCanFind => localizedValues['YouCanFind'][locale.languageCode]; - - String get itemInSearch => localizedValues['ItemInSearch'][locale.languageCode]; - - String get bloodDonation => localizedValues['blood-donation'][locale.languageCode]; - - String get bloodInstruction => localizedValues['blood-instruction'][locale.languageCode]; - - String get bloodTermsNcondition => localizedValues['view-terms'][locale.languageCode]; - - String get wantToConnectWithHmgNetwork => localizedValues['wantConnectHmgNetwork'][locale.languageCode]; - - String get failedToAccessHmgServices => localizedValues['failedToAccessHmgServices'][locale.languageCode]; - - String get enablingWifi => localizedValues['enablingWifi'][locale.languageCode]; - - String get offerAndPackages => localizedValues['offerAndPackages'][locale.languageCode]; + String get itemInSearch => + localizedValues['ItemInSearch'][locale.languageCode]; + String get bloodDonation => + localizedValues['blood-donation'][locale.languageCode]; + String get bloodDonationInfo => + localizedValues['blood-donation-info'][locale.languageCode]; + + String get bloodInstruction => + localizedValues['blood-instruction'][locale.languageCode]; + String get bloodTermsNcondition => + localizedValues['view-terms'][locale.languageCode]; + String get wantToConnectWithHmgNetwork => + localizedValues['wantConnectHmgNetwork'][locale.languageCode]; + String get failedToAccessHmgServices => + localizedValues['failedToAccessHmgServices'][locale.languageCode]; + String get enablingWifi => + localizedValues['enablingWifi'][locale.languageCode]; + String get offerAndPackages => + localizedValues['offerAndPackages'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; @@ -1249,15 +1255,16 @@ class TranslationBase { String get erContant => localizedValues['er-contant'][locale.languageCode]; String get er => localizedValues['er'][locale.languageCode]; - - String get transportationService => localizedValues['transportation-Service'][locale.languageCode]; - - String get infoAmbulance => localizedValues['info-ambulance'][locale.languageCode]; - - String get transportHeading => localizedValues['RRT-transport-heading'][locale.languageCode]; - - String get directionHeading => localizedValues['RRT-direction-heading'][locale.languageCode]; - + String get transportationService => + localizedValues['transportation-Service'][locale.languageCode]; + String get infoAmbulance => + localizedValues['info-ambulance'][locale.languageCode]; + String get transportHeading => + localizedValues['RRT-transport-heading'][locale.languageCode]; + String get directionHeading => + localizedValues['RRT-direction-heading'][locale.languageCode]; + String get wayHeading => + localizedValues['RRT-way-heading'][locale.languageCode]; String get toHospital => localizedValues['to-hospital'][locale.languageCode]; String get fromHospital => localizedValues['from-hospital'][locale.languageCode]; @@ -1299,7 +1306,15 @@ class TranslationBase { String get none => localizedValues['none'][locale.languageCode]; String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode]; - + String get RapidResponseTeam => localizedValues['Rapid-Response-Team'][locale.languageCode]; + String get RRTDDetails => localizedValues['RRTDDetails'][locale.languageCode]; + String get ApproximateServiceFee => localizedValues['ApproximateServiceFee'][locale.languageCode]; + String get AmountBeforeTax => localizedValues['AmountBeforeTax'][locale.languageCode]; + String get TaxAmount => localizedValues['TaxAmount'][locale.languageCode]; + String get TotalAmountPayable => localizedValues['TotalAmountPayable'][locale.languageCode]; + String get iAcceptTermsConditions => localizedValues['iAcceptTermsConditions'][locale.languageCode]; + String get YouCanPayByTheFollowingOptions => localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode]; + String get rrtService => localizedValues['rrtService'][locale.languageCode]; String get billAmount => localizedValues['bill-amount'][locale.languageCode]; String get transportMethod => localizedValues['transport-method'][locale.languageCode]; @@ -1828,31 +1843,34 @@ class TranslationBase { String get areyousure => localizedValues["areyousure"][locale.languageCode]; + // Offer And Packahes String get subT => localizedValues['OffersAndPackages'][locale.languageCode]; - - String get totalWithColonRight => localizedValues['totalWithColonRight'][locale.languageCode]; + String get totalWithColonRight => + localizedValues['totalWithColonRight'][locale.languageCode]; String get preferredunit => localizedValues["preferredunit"][locale.languageCode]; String get trySaying => localizedValues["try-saying"][locale.languageCode]; - - String get enterIdentificationNumber => localizedValues["enterIdentificationNumber"][locale.languageCode]; - - String get accountActivationDesc => localizedValues["accountActivationDesc"][locale.languageCode]; - - String get pointsToTransfer => localizedValues["pointsToTransfer"][locale.languageCode]; - - String get enterBeneficiaryAccountNo => localizedValues["enterBeneficiaryAccountNo"][locale.languageCode]; - - String get confirmPrescription => localizedValues["confirm-prescription"][locale.languageCode]; - - String get youAlreadyHaveOrder => localizedValues["you-already-have-order"][locale.languageCode]; - - String get orderOverview => localizedValues["order-overview"][locale.languageCode]; - - String get shippingAddresss => localizedValues["shipping-address"][locale.languageCode]; - + String get somethingWentWrong => + localizedValues["somethingWentWrong"][locale.languageCode]; + + String get enterIdentificationNumber => + localizedValues["enterIdentificationNumber"][locale.languageCode]; + String get accountActivationDesc => + localizedValues["accountActivationDesc"][locale.languageCode]; + String get pointsToTransfer => + localizedValues["pointsToTransfer"][locale.languageCode]; + String get enterBeneficiaryAccountNo => + localizedValues["enterBeneficiaryAccountNo"][locale.languageCode]; + String get confirmPrescription => + localizedValues["confirm-prescription"][locale.languageCode]; + String get youAlreadyHaveOrder => + localizedValues["you-already-have-order"][locale.languageCode]; + String get orderOverview => + localizedValues["order-overview"][locale.languageCode]; + String get shippingAddresss => + localizedValues["shipping-address"][locale.languageCode]; String get covidAlert => localizedValues["covid-alert"][locale.languageCode]; String get pharmacyRelogin => localizedValues["pharmacy-relogin"][locale.languageCode]; @@ -1878,16 +1896,36 @@ class TranslationBase { String get insuranceID => localizedValues["insurance-id"][locale.languageCode]; String get enterFile => localizedValues["enter-file"][locale.languageCode]; - - String get enterReferralRequesterName => localizedValues["enterReferralRequesterName"][locale.languageCode]; - - String get selectRelationship => localizedValues["selectRelationship"][locale.languageCode]; - - String get requesterRelationship => localizedValues["requesterRelationship"][locale.languageCode]; - + String get feedbackType => localizedValues["feedback-type"][locale.languageCode]; + + String get allow => localizedValues["allow"][locale.languageCode]; + String get reject => localizedValues["reject"][locale.languageCode]; + String get enterReferralRequesterName => + localizedValues["enterReferralRequesterName"][locale.languageCode]; + String get selectRelationship => + localizedValues["selectRelationship"][locale.languageCode]; + String get requesterRelationship => + localizedValues["requesterRelationship"][locale.languageCode]; String get newReferral => localizedValues["newReferral"][locale.languageCode]; + String get searchForReferrals => + localizedValues["searchForReferrals"][locale.languageCode]; + String get covidSelectProcedure => + localizedValues["covid-select-procedure"][locale.languageCode]; + String get onlineConsultation => + localizedValues["online-consultation"][locale.languageCode]; + String get expectedWaiting => + localizedValues["expected-weiting"][locale.languageCode]; + String get erConsultFee => + localizedValues["er-consult-fee"][locale.languageCode]; + String get insuredPatient => + localizedValues["insured-patient"][locale.languageCode]; + String get iAcceptTerms => + localizedValues["i-accept-terms"][locale.languageCode]; + String get upComingPayOption => + localizedValues["upcoming-pay-options"][locale.languageCode]; + String get pleaseAcceptTerms => + localizedValues["please-accept-terms"][locale.languageCode]; - String get searchForReferrals => localizedValues["searchForReferrals"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 17b92bbb..955552db 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -141,7 +141,7 @@ class Utils { } String loginIDPattern(loginType) { - var length = loginType == 1 ? 10 : 7; + var length = loginType == 1 ? 10 : 6; return "([0-9]{" + length.toString() + "})"; } @@ -592,7 +592,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, + onTap: () => + projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myMedical, imagePath: 'active_medications.png', @@ -602,7 +603,24 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, + onTap: () => projectViewModel.havePrivilege(6) + ? Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'doctor_icon.png', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + isEnable: projectViewModel.havePrivilege(6)), + )); + + medical.add(InkWell( + onTap: () => + projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).eye, imagePath: 'eye_measurement_icon.png', @@ -633,7 +651,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, + onTap: () => + projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).insuranceApproval, imagePath: 'insurance_approvals_icon.png', @@ -663,7 +682,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, + onTap: () => + projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).medical, imagePath: 'medical_reports_icon.png', @@ -673,7 +693,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, + onTap: () => + projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).monthly, imagePath: 'monthly_reports_icon.png', @@ -683,7 +704,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, + onTap: () => + projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).sick, imagePath: 'sick_leaves_icons.png', @@ -702,6 +724,7 @@ class Utils { ), )); + // TODO mosa check it medical.add(MedicalProfileItem( title: TranslationBase.of(context).patientCall, imagePath: 'medical_history_icon.png', @@ -807,6 +830,7 @@ Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, doubl ); } + Future userData() async { var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER)); return userData; @@ -830,6 +854,25 @@ openAppStore({String androidPackageName, String iOSAppID}) async { launch("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"); } } + +String labelFrom({@required String className}){ + RegExp exp = RegExp(r'(?<=[a-z])[A-Z]'); + + String result = className.replaceAllMapped(exp, (m) { + var str = m.group(0); + if(str != null){ + return ('_' + str); + } + return ""; + }); + + if(result.isEmpty) + return className; + + result = result.replaceAll("_", " "); + return result; +} + /* userBoard.asMap().map((i, element) => MapEntry(i, Stack( GestureDetector(onTap: () { diff --git a/lib/widgets/typewriter/typewiter.dart b/lib/widgets/typewriter/typewiter.dart index a86cc9f0..5354df38 100644 --- a/lib/widgets/typewriter/typewiter.dart +++ b/lib/widgets/typewriter/typewiter.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -14,6 +16,7 @@ class _TyperState extends State Animation _characterCount; AnimationController _controller; int _stringIndex; + var event = RobotProvider(); @override void initState() { _controller = new AnimationController( diff --git a/speech_to_text_/example/test/widget_test.dart b/speech_to_text_/example/test/widget_test.dart new file mode 100644 index 00000000..639a52fb --- /dev/null +++ b/speech_to_text_/example/test/widget_test.dart @@ -0,0 +1,27 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../lib/main.dart'; + +void main() { + testWidgets('Verify Platform version', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(MyApp()); + + // Verify that platform version is retrieved. + expect( + find.byWidgetPredicate( + (Widget widget) => + widget is Text && widget.data.startsWith('Running on:'), + ), + findsOneWidget, + ); + }); +} diff --git a/speech_to_text_/test/test_speech_channel_handler.dart b/speech_to_text_/test/test_speech_channel_handler.dart new file mode 100644 index 00000000..a55f0670 --- /dev/null +++ b/speech_to_text_/test/test_speech_channel_handler.dart @@ -0,0 +1,134 @@ +import 'package:flutter/services.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_recognition_result.dart'; +import 'package:speech_to_text/speech_to_text.dart'; + +/// Holds a set of responses and acts as a mock for the platform specific +/// implementations allowing test cases to determine what the result of +/// a call should be. +class TestSpeechChannelHandler { + final SpeechToText _speech; + + bool listenException = false; + + static const String listenExceptionCode = "listenFailedError"; + static const String listenExceptionMessage = "Failed"; + static const String listenExceptionDetails = "Device Listen Failure"; + + TestSpeechChannelHandler(this._speech); + + bool initResult = true; + bool initInvoked = false; + bool listenInvoked = false; + bool cancelInvoked = false; + bool stopInvoked = false; + bool localesInvoked = false; + bool hasPermissionResult = true; + String listeningStatusResponse = SpeechToText.listeningStatus; + String listenLocale; + List locales = []; + static const String localeId1 = "en_US"; + static const String localeId2 = "fr_CA"; + static const String name1 = "English US"; + static const String name2 = "French Canada"; + static const String locale1 = "$localeId1:$name1"; + static const String locale2 = "$localeId2:$name2"; + static const String firstRecognizedWords = 'hello'; + static const String secondRecognizedWords = 'hello there'; + static const double firstConfidence = 0.85; + static const double secondConfidence = 0.62; + static const String firstRecognizedJson = + '{"alternates":[{"recognizedWords":"$firstRecognizedWords","confidence":$firstConfidence}],"finalResult":false}'; + static const String secondRecognizedJson = + '{"alternates":[{"recognizedWords":"$secondRecognizedWords","confidence":$secondConfidence}],"finalResult":false}'; + static const String finalRecognizedJson = + '{"alternates":[{"recognizedWords":"$secondRecognizedWords","confidence":$secondConfidence}],"finalResult":true}'; + static const SpeechRecognitionWords firstWords = + SpeechRecognitionWords(firstRecognizedWords, firstConfidence); + static const SpeechRecognitionWords secondWords = + SpeechRecognitionWords(secondRecognizedWords, secondConfidence); + static final SpeechRecognitionResult firstRecognizedResult = + SpeechRecognitionResult([firstWords], false); + static final SpeechRecognitionResult secondRecognizedResult = + SpeechRecognitionResult([secondWords], false); + static final SpeechRecognitionResult finalRecognizedResult = + SpeechRecognitionResult([secondWords], true); + static const String transientErrorJson = + '{"errorMsg":"network","permanent":false}'; + static const String permanentErrorJson = + '{"errorMsg":"network","permanent":true}'; + static final SpeechRecognitionError firstError = + SpeechRecognitionError("network", true); + static const double level1 = 0.5; + static const double level2 = 10; + + Future methodCallHandler(MethodCall methodCall) async { + switch (methodCall.method) { + case "has_permission": + return hasPermissionResult; + break; + case "initialize": + initInvoked = true; + return initResult; + break; + case "cancel": + cancelInvoked = true; + return true; + break; + case "stop": + stopInvoked = true; + return true; + break; + case SpeechToText.listenMethod: + listenInvoked = true; + if (listenException) { + throw PlatformException( + code: listenExceptionCode, + message: listenExceptionMessage, + details: listenExceptionDetails); + } + listenLocale = methodCall.arguments["localeId"]; + await _speech.processMethodCall(MethodCall( + SpeechToText.notifyStatusMethod, listeningStatusResponse)); + return initResult; + break; + case "locales": + localesInvoked = true; + return locales; + break; + default: + } + return initResult; + } + + void notifyFinalWords() { + _speech.processMethodCall( + MethodCall(SpeechToText.textRecognitionMethod, finalRecognizedJson)); + } + + void notifyPartialWords() { + _speech.processMethodCall( + MethodCall(SpeechToText.textRecognitionMethod, firstRecognizedJson)); + } + + void notifyPermanentError() { + _speech.processMethodCall( + MethodCall(SpeechToText.notifyErrorMethod, permanentErrorJson)); + } + + void notifyTransientError() { + _speech.processMethodCall( + MethodCall(SpeechToText.notifyErrorMethod, transientErrorJson)); + } + + void notifySoundLevel() { + _speech.processMethodCall( + MethodCall(SpeechToText.soundLevelChangeMethod, level2)); + } + + void setupLocales() { + locales.clear(); + locales.add(locale1); + locales.add(locale2); + } +} diff --git a/speech_to_text_/test/test_speech_listener.dart b/speech_to_text_/test/test_speech_listener.dart new file mode 100644 index 00000000..1efcd81c --- /dev/null +++ b/speech_to_text_/test/test_speech_listener.dart @@ -0,0 +1,36 @@ +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_recognition_result.dart'; +import 'package:speech_to_text/speech_to_text_provider.dart'; + +/// Holds the results of notification by the [SpeechToTextProvider] +class TestSpeechListener { + final SpeechToTextProvider _speechProvider; + + bool isListening = false; + bool isFinal = false; + bool isAvailable = false; + bool notified = false; + bool hasError = false; + SpeechRecognitionResult recognitionResult; + SpeechRecognitionError lastError; + double soundLevel; + + TestSpeechListener(this._speechProvider); + + void reset() { + isListening = false; + isFinal = false; + isAvailable = false; + notified = false; + } + + void onNotify() { + notified = true; + isAvailable = _speechProvider.isAvailable; + isListening = _speechProvider.isListening; + recognitionResult = _speechProvider.lastResult; + hasError = _speechProvider.hasError; + lastError = _speechProvider.lastError; + soundLevel = _speechProvider.lastLevel; + } +}