diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt index 35ce314d..b8a87c8c 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -1,36 +1,11 @@ package com.cloud.diplomaticquarterapp -import android.content.ContentResolver -import android.content.Context -import android.media.RingtoneManager -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugins.GeneratedPluginRegistrant +import androidx.annotation.NonNull; + import io.flutter.embedding.android.FlutterFragmentActivity + import io.flutter.embedding.engine.FlutterEngine + import io.flutter.plugins.GeneratedPluginRegistrant -class MainActivity : FlutterActivity() { - override fun configureFlutterEngine(flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine) - MethodChannel(flutterEngine.dartExecutor, "crossingthestreams.io/resourceResolver").setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> - if ("drawableToUri" == call.method) { - val resourceId = this@MainActivity.resources.getIdentifier(call.arguments as String, "drawable", this@MainActivity.packageName) - result.success(resourceToUriString(this@MainActivity.applicationContext, resourceId)) - } - if ("getAlarmUri" == call.method) { - result.success(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM).toString()) - } - } - } - - companion object { - private fun resourceToUriString(context: Context, resId: Int): String { - return (ContentResolver.SCHEME_ANDROID_RESOURCE - + "://" - + context.resources.getResourcePackageName(resId) - + "/" - + context.resources.getResourceTypeName(resId) - + "/" - + context.resources.getResourceEntryName(resId)) - } - } +class MainActivity: FlutterFragmentActivity() { + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } } \ No newline at end of file diff --git a/assets/images/SmartWatches/Apple-Watch-6.png b/assets/images/SmartWatches/Apple-Watch-6.png new file mode 100644 index 00000000..1e670506 Binary files /dev/null and b/assets/images/SmartWatches/Apple-Watch-6.png differ diff --git a/assets/images/SmartWatches/apple-watch-1.jpeg b/assets/images/SmartWatches/apple-watch-1.jpeg new file mode 100644 index 00000000..7262e7eb Binary files /dev/null and b/assets/images/SmartWatches/apple-watch-1.jpeg differ diff --git a/assets/images/SmartWatches/apple-watch-2.jpg b/assets/images/SmartWatches/apple-watch-2.jpg new file mode 100644 index 00000000..f688f740 Binary files /dev/null and b/assets/images/SmartWatches/apple-watch-2.jpg differ diff --git a/assets/images/SmartWatches/apple-watch-3.jpg b/assets/images/SmartWatches/apple-watch-3.jpg new file mode 100644 index 00000000..b68c1ced Binary files /dev/null and b/assets/images/SmartWatches/apple-watch-3.jpg differ diff --git a/assets/images/SmartWatches/apple-watch-4.jpg b/assets/images/SmartWatches/apple-watch-4.jpg new file mode 100644 index 00000000..2fc19b67 Binary files /dev/null and b/assets/images/SmartWatches/apple-watch-4.jpg differ diff --git a/assets/images/SmartWatches/apple-watch-5.jpg b/assets/images/SmartWatches/apple-watch-5.jpg new file mode 100644 index 00000000..4c497eac Binary files /dev/null and b/assets/images/SmartWatches/apple-watch-5.jpg differ diff --git a/assets/images/SmartWatches/fossil-sport.png b/assets/images/SmartWatches/fossil-sport.png new file mode 100644 index 00000000..207bbbe3 Binary files /dev/null and b/assets/images/SmartWatches/fossil-sport.png differ diff --git a/assets/images/SmartWatches/heartrate_icon.png b/assets/images/SmartWatches/heartrate_icon.png new file mode 100644 index 00000000..e228bea4 Binary files /dev/null and b/assets/images/SmartWatches/heartrate_icon.png differ diff --git a/assets/images/SmartWatches/huawei-watch-2-classic.png b/assets/images/SmartWatches/huawei-watch-2-classic.png new file mode 100644 index 00000000..0dc44cb6 Binary files /dev/null and b/assets/images/SmartWatches/huawei-watch-2-classic.png differ diff --git a/assets/images/SmartWatches/huawei-watch-2.png b/assets/images/SmartWatches/huawei-watch-2.png new file mode 100644 index 00000000..61530239 Binary files /dev/null and b/assets/images/SmartWatches/huawei-watch-2.png differ diff --git a/assets/images/SmartWatches/lg-watch-sport.jpg b/assets/images/SmartWatches/lg-watch-sport.jpg new file mode 100644 index 00000000..bd2f25ed Binary files /dev/null and b/assets/images/SmartWatches/lg-watch-sport.jpg differ diff --git a/assets/images/SmartWatches/miBand3.jpg b/assets/images/SmartWatches/miBand3.jpg new file mode 100644 index 00000000..c58f85e5 Binary files /dev/null and b/assets/images/SmartWatches/miBand3.jpg differ diff --git a/assets/images/SmartWatches/miBand4.jpg b/assets/images/SmartWatches/miBand4.jpg new file mode 100644 index 00000000..519ef5fb Binary files /dev/null and b/assets/images/SmartWatches/miBand4.jpg differ diff --git a/assets/images/SmartWatches/misfit-vapor-2.jpg b/assets/images/SmartWatches/misfit-vapor-2.jpg new file mode 100644 index 00000000..fe487591 Binary files /dev/null and b/assets/images/SmartWatches/misfit-vapor-2.jpg differ diff --git a/assets/images/SmartWatches/sleep_data.png b/assets/images/SmartWatches/sleep_data.png new file mode 100644 index 00000000..dc6661d6 Binary files /dev/null and b/assets/images/SmartWatches/sleep_data.png differ diff --git a/assets/images/SmartWatches/ticwatche2.png b/assets/images/SmartWatches/ticwatche2.png new file mode 100644 index 00000000..5ad3d308 Binary files /dev/null and b/assets/images/SmartWatches/ticwatche2.png differ diff --git a/heartrate_icon.png b/heartrate_icon.png new file mode 100644 index 00000000..e228bea4 Binary files /dev/null and b/heartrate_icon.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index f53d5a75..c67e2990 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -272,6 +272,10 @@ const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetP const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; +///Smartwatch Integration Services +const GET_PATIENT_LAST_RECORD = + 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; + ///My Trackers const GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart index 5787af66..fb2b94c6 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -1,5 +1,3 @@ - - import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart'; import 'package:flutter/material.dart'; @@ -8,7 +6,6 @@ import 'new_e_referral_step_three_page.dart'; import 'new_e_referral_step_two_page.dart'; class StartIndexForNewEReferral extends StatefulWidget { - StartIndexForNewEReferral(); @override @@ -22,8 +19,8 @@ class _StartIndexForNewEReferralState extends State int _currentIndex = 1; int pageSelected = 2; - - CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel(); + CreateEReferralRequestModel createEReferralRequestModel = + new CreateEReferralRequestModel(); @override void initState() { @@ -46,7 +43,7 @@ class _StartIndexForNewEReferralState extends State body: SafeArea( child: SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height, + height: MediaQuery.of(context).size.height * 0.9, child: PageView( physics: NeverScrollableScrollPhysics(), controller: _controller, @@ -64,12 +61,10 @@ class _StartIndexForNewEReferralState extends State NewEReferralStepTowPage( changePageViewIndex: changePageViewIndex, createEReferralRequestModel: createEReferralRequestModel, - ), NewEReferralStepThreePage( changePageViewIndex: changePageViewIndex, createEReferralRequestModel: createEReferralRequestModel, - ), ], ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 6460de03..62799c6d 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -95,7 +95,7 @@ class _NewEReferralStepOnePageState extends State { margin: EdgeInsets.all(12), child: Center( child: FractionallySizedBox( - widthFactor: 0.94, + widthFactor: 0.9, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index f717ba8e..9d8466bb 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -1,35 +1,31 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_index_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; -import 'package:diplomaticquarterapp/pages/Blood/advance_payment_page.dart'; import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; - import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; - import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/services)contaniner.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/services)contaniner.dart'; -import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:webview_flutter/webview_flutter.dart'; - -import 'h2o/h2o_page.dart'; class AllHabibMedicalService extends StatefulWidget { @override @@ -37,6 +33,17 @@ class AllHabibMedicalService extends StatefulWidget { } class _AllHabibMedicalServiceState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser = new AuthenticatedUser(); + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + getAuthUser(); + }); + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -177,7 +184,10 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page: EReferralIndexPage()), + FadePage( + page: authUser.patientID == null + ? EReferralIndexPage() + : EReferralPage()), ), imageLocation: 'assets/images/ereferral_service_icon.png', title: 'E-Referral', @@ -315,4 +325,15 @@ class _AllHabibMedicalServiceState extends State { ), ); } + + getAuthUser() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + print(authUser.patientID); + } + } } diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 74cba568..aca0884f 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -235,7 +235,7 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events,holidays) { + onDaySelected: (date, events) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, @@ -385,8 +385,8 @@ class _DocAvailableAppointmentsState extends State color: _calendarController.isSelected(date) ? Colors.green[400] : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], + ? Colors.brown[300] + : Colors.blue[400], ), width: 40.0, height: 40.0, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 264f828a..060a8132 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, events,holidays) { + onDaySelected: (date, events) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index e3538277..db2b0643 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -172,7 +172,7 @@ class _AppointmentDetailsState extends State physics: NeverScrollableScrollPhysics(), children: [ AppointmentActions(appo: widget.appo, tabController: _tabController, enableFooterButton: enableFooterButton), - DocAvailableAppointments(doctor: getDoctorObject()) + DocAvailableAppointments(doctor: getDoctorObject(), isLiveCareAppointment: widget.appo.isLiveCareAppointment) ], controller: _tabController, ), diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 7c20b53d..9ba57084 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -139,7 +139,7 @@ class _ToDoState extends State { flex: 3, child: Container( margin: EdgeInsets.only( - top: 20.0, left: 20.0, right: 20.0), + top: 10.0, left: 20.0, right: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index a44d8b3d..a6936083 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -69,7 +68,7 @@ class _PaymentMethodState extends State { child: Container( child: InkWell( onTap: () { - updateSelectedPaymentMethod("SADAD"); + updateSelectedPaymentMethod("VISA"); }, child: Card( elevation: 3.0, @@ -77,7 +76,7 @@ class _PaymentMethodState extends State { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "SADAD" + side: selectedPaymentMethod == "VISA" ? BorderSide( color: Colors.green, width: 5.0) : BorderSide( @@ -88,12 +87,41 @@ class _PaymentMethodState extends State { padding: EdgeInsets.all(7.0), width: MediaQuery.of(context).size.width * 0.45, child: Image.asset( - "assets/images/new-design/sadad.png"), + "assets/images/new-design/visa.png"), ), ), ), ), ), +// Expanded( +// child: Container( +// child: InkWell( +// onTap: () { +// updateSelectedPaymentMethod("SADAD"); +// }, +// child: Card( +// elevation: 3.0, +// margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), +// color: Colors.white, +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(10), +// side: selectedPaymentMethod == "SADAD" +// ? BorderSide( +// color: Colors.green, width: 5.0) +// : BorderSide( +// color: Colors.transparent, width: 0.0), +// ), +// child: Container( +// height: 120.0, +// padding: EdgeInsets.all(7.0), +// width: MediaQuery.of(context).size.width * 0.45, +// child: Image.asset( +// "assets/images/new-design/sadad.png"), +// ), +// ), +// ), +// ), +// ), ], ), ), @@ -102,35 +130,6 @@ class _PaymentMethodState extends State { child: Flex( direction: Axis.horizontal, children: [ - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("VISA"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "VISA" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), - ), - child: Container( - height: 120.0, - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset( - "assets/images/new-design/visa.png"), - ), - ), - ), - ), - ), Expanded( child: Container( child: InkWell( @@ -160,14 +159,6 @@ class _PaymentMethodState extends State { ), ), ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 25.0), - child: Flex( - direction: Axis.horizontal, - children: [ Expanded( child: Container( child: InkWell( @@ -200,6 +191,13 @@ class _PaymentMethodState extends State { ], ), ), + Container( + margin: EdgeInsets.only(top: 25.0), + child: Flex( + direction: Axis.horizontal, + children: [], + ), + ), ], ), ), diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index d79a1ead..2fbcbcc1 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -24,7 +24,7 @@ class _PaymentDialogState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.67, + height: 510.0, width: 450.0, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 06ac1577..2744d3a6 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -98,10 +98,10 @@ class _HomePageState extends State { Container( margin: EdgeInsets.only( top: 15.0, left: 3.5, right: 3.5), - // child: SvgPicture.asset( - // 'assets/images/new-design/covid-19-car.svg', - // width: 45.0, - // height: 45.0), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 45.0, + height: 45.0), ), Container( margin: EdgeInsets.only( @@ -175,11 +175,11 @@ class _HomePageState extends State { .withOpacity(0.3), borderRadius: BorderRadius.all( Radius.circular(5))), - // child: SvgPicture.asset( - // projectViewModel.isArabic - // ? 'assets/images/new-design/livecare_arabic_logo.svg' - // : 'assets/images/new-design/liveCare_white_logo.svg', - // ), + child: SvgPicture.asset( + projectViewModel.isArabic + ? 'assets/images/new-design/livecare_arabic_logo.svg' + : 'assets/images/new-design/liveCare_white_logo.svg', + ), ), ), ), diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 99c4b271..56613034 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -36,13 +36,13 @@ class _State extends State { return Row( children: [ Card( - margin: EdgeInsets.fromLTRB(13.0, 10.0, 8.0, 8.0), + margin: EdgeInsets.fromLTRB(15.0, 10.0, 8.0, 8.0), color: widget.isSelected ? Colors.blue : Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), child: Container( - width: MediaQuery.of(context).size.width * 0.8, + width: MediaQuery.of(context).size.width * 0.75, padding: EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index c1f5eb75..083af9f7 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -17,8 +17,11 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -81,7 +84,13 @@ class _clinic_listState extends State { service .getERAppointmentFees(selectedClinicID, context) .then((res) { - erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res); + if (res['HasAppointment'] == true) { + isError = true; + showLiveCareCancelDialog(res['ErrorEndUserMessage'], res); + } else { + erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res); + isError = false; + } }) .catchError((err) { print(err); @@ -97,10 +106,57 @@ class _clinic_listState extends State { }); } + showLiveCareCancelDialog(String msg, res) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: msg, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => + {cancelAppointment(res)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + + cancelAppointment(res) { + AppoitmentAllHistoryResultList appo = AppoitmentAllHistoryResultList(); + appo.clinicID = res['ClinicID']; + appo.doctorID = res['DoctorID']; + appo.endTime = res['EndTime']; + appo.projectID = res['ProjectID']; + appo.startTime = res['StrAppointmentDate']; + appo.appointmentNo = res['AppointmentID']; + appo.isLiveCareAppointment = true; + appo.originalClinicID = 0; + appo.originalProjectID = res['ProjectID']; + appo.appointmentDate = res['AppointmentDate']; + + ConfirmDialog.closeAlertDialog(context); + DoctorsListService service = new DoctorsListService(); + service + .cancelAppointment(appo, context) + .then((res) { + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + startLiveCare(); + }); + } + getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) { LiveCareService service = new LiveCareService(); service.getERAppointmentTime(selectedClinicID, context).then((res) { - print(res['WatingtimeInteger']); + print(res); showLiveCarePaymentDialog( getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index cc5df0a6..8847aaa1 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -247,8 +247,8 @@ class ConfirmPaymentPage extends StatelessWidget { DoctorsListService service = new DoctorsListService(); service .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), + Utils.getAdvancePaymentTransID( + appo.projectID, authenticatedUser.patientID), AppGlobal.context) .then((res) { print("Printing Payment Status Reponse!!!!"); @@ -302,5 +302,4 @@ class ConfirmPaymentPage extends StatelessWidget { Future navigateToHome(context) async { Navigator.of(context).pushNamed(HOME); } - } diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index e7d75e7f..61f22aca 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; @@ -407,10 +408,10 @@ class _MedicalProfilePageState extends State { flex: 1, child: InkWell( //TODO -// onTap: () { -// Navigator.push( -// context, FadePage(page: DoctorHomePage())); -// }, + onTap: () { + Navigator.push( + context, FadePage(page: SmartWatchInstructions())); + }, child: MedicalProfileItem( title: TranslationBase.of(context) .smartWatches, diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart new file mode 100644 index 00000000..2f9a3e60 --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class HealthDataList extends StatefulWidget { + @override + _HealthDataListState createState() => _HealthDataListState(); +} + +class _HealthDataListState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "Smartwatches", + isShowAppBar: true, + body: Container( + height: MediaQuery.of(context).size.height, + margin: EdgeInsets.all(20.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + child: Image.asset( + "assets/images/SmartWatches/heartrate_icon.png", + width: 60.0, + height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: Text("Heart Rate", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + Divider( + color: Colors.grey[500], + ), + Row( + children: [ + Container( + child: Image.asset( + "assets/images/SmartWatches/sleep_data.png", + width: 60.0, + height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: Text("Sleep Data", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + Divider( + color: Colors.grey[500], + ), + Row( + children: [ + Container( + child: Image.asset( + "assets/images/SmartWatches/heartrate_icon.png", + width: 60.0, + height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: Text("Steps", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + Divider( + color: Colors.grey[500], + ), + Row( + children: [ + Container( + child: Image.asset( + "assets/images/SmartWatches/heartrate_icon.png", + width: 60.0, + height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: Text("Distance", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + Divider( + color: Colors.grey[500], + ), + Row( + children: [ + Container( + child: Image.asset( + "assets/images/SmartWatches/heartrate_icon.png", + width: 60.0, + height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: Text("Energy", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + Divider( + color: Colors.grey[500], + ), + ], + ), + ), + ), + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.1, + color: Colors.grey[100], + child: Column( + children: [ + Divider( + color: Colors.transparent, + ), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + onTap: () { +// launch(model.radImageURL); + }, + label: 'Sync Health Data', + backgroundColor: Colors.grey[800], + ), + ), + ], + ), + )); + } +} diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart new file mode 100644 index 00000000..eb0c1675 --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -0,0 +1,819 @@ +import 'dart:io'; + +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/health_data_list.dart'; +import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class SmartWatchInstructions extends StatefulWidget { + @override + _SmartWatchInstructionsState createState() => _SmartWatchInstructionsState(); +} + +class _SmartWatchInstructionsState extends State { + CarouselController buttonCarouselController = CarouselController(); + + bool hasAlreadySynced = false; + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + getLastPatientRecord(context); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "Sync Health Data", + isShowAppBar: true, + body: Container( + child: Platform.isIOS + ? _getAppleWatchInstructions() + : _getGoogleWatchInstructions(), + )); + } + + _getAppleWatchInstructions() { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: CarouselSlider( + carouselController: buttonCarouselController, + options: CarouselOptions( + enableInfiniteScroll: false, + viewportFraction: 0.95, + height: MediaQuery.of(context).size.height * 0.9), + items: [1, 2].map((i) { + return Builder( + builder: (BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.symmetric(horizontal: 5.0), + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white.withOpacity(1.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: i == 1 + ? Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("Supported Smartwatches", + style: TextStyle( + fontSize: 22.0, + fontWeight: FontWeight.bold, + fontFamily: "WorkSans")), + ), + Container( + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/apple-watch-1.jpeg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Apple Watch Series 1", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/apple-watch-2.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Apple Watch Series 2", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/apple-watch-3.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Apple Watch Series 3", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/apple-watch-4.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Apple Watch Series 4", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/apple-watch-5.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Apple Watch Series 5", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/Apple-Watch-6.png", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Apple Watch Series 6", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/miBand3.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text("Mi Band 3", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/miBand4.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text("Mi Band 4", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 10.0, 30.0, 10.0, 10.0), + child: Text( + "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "Before syncing data, please make sure that you have followed the instructions properly", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(15.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10.0), + ), + minWidth: + MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + buttonCarouselController.nextPage(); + }, + child: Text("CONTINUE", + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("Watch Instructions:", + style: TextStyle( + fontSize: 22.0, + fontWeight: FontWeight.bold, + fontFamily: "WorkSans")), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.fromLTRB( + 10.0, 20.0, 10.0, 10.0), + child: Text( + "Before syncing data, please make sure that following instructions are met: ", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.fromLTRB( + 10.0, 20.0, 10.0, 10.0), + child: Text( + "1. Make sure that you have installed 'Health' App & 'Watch' App from Apple Store.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "2. Make sure that your Apple Watch is connected with the Watch & Health Apps.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "3. Make sure that data like heart rate, steps, distance etc. are being shown on your health app.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.fromLTRB( + 15.0, 110.0, 15.0, 15.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10.0), + ), + minWidth: + MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + buttonCarouselController.nextPage(); + }, + child: Text("SYNC HEALTH DATA", + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + hasAlreadySynced ? Container( + margin: EdgeInsets.fromLTRB( + 15.0, 0.0, 15.0, 15.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10.0), + ), + minWidth: + MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + _openHealthDataList(); + }, + child: Text("ALREADY SYNCED", + style: TextStyle(fontSize: 18.0)), + ), + ), + ): Container(), + ], + ), + )); + }, + ); + }).toList(), + ), + ) + ], + ), + ); + } + + _getGoogleWatchInstructions() { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: CarouselSlider( + carouselController: buttonCarouselController, + options: CarouselOptions( + enableInfiniteScroll: false, + viewportFraction: 0.95, + height: MediaQuery.of(context).size.height * 0.9), + items: [1, 2].map((i) { + return Builder( + builder: (BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.symmetric(horizontal: 5.0), + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white.withOpacity(1.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: i == 1 + ? Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("Supported Smartwatches", + style: TextStyle( + fontSize: 22.0, + fontWeight: FontWeight.bold, + fontFamily: "WorkSans")), + ), + Container( + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/huawei-watch-2.png", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Huawei Watch 2", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/ticwatche2.png", + width: 70.0, + height: 70.0), + Container( + child: Text( + "Mobovi TicWatch E2", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/huawei-watch-2-classic.png", + width: 70.0, + height: 70.0), + Container( + child: Text("Huawei Watch", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/ticwatche2.png", + width: 70.0, + height: 70.0), + Container( + child: Text("Fossil Sport", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/misfit-vapor-2.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "MisFit Vapor 2", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/lg-watch-sport.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text( + "LG Watch Sport", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/miBand3.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text("Mi Band 3", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset( + "assets/images/SmartWatches/miBand4.jpg", + width: 70.0, + height: 70.0), + Container( + child: Text("Mi Band 4", + style: TextStyle( + fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + InkWell( + onTap: () { + launch( + "https://wearos.google.com/#find-your-watch"); + }, + child: Container( + margin: EdgeInsets.only(top: 20.0), + child: Text( + "More Supported Smartwatches...", + style: TextStyle( + fontSize: 17.0, + color: Colors.blue, + decoration: + TextDecoration.underline)), + ), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "Before syncing data, please make sure that you have followed the instructions properly", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(15.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10.0), + ), + minWidth: + MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + buttonCarouselController.nextPage(); + }, + child: Text("CONTINUE", + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("Watch Instructions:", + style: TextStyle( + fontSize: 22.0, + fontWeight: FontWeight.bold, + fontFamily: "WorkSans")), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "Before syncing data, please make sure that following instructions are met: ", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "1. Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "2. Make sure that you have installed your watch related apps from Google PlayStore.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "3. Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "4. Make sure that your smart watch apps are linked/associated with Google Fit App.", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 17.0)), + ), + Container( + margin: EdgeInsets.fromLTRB( + 15.0, 95.0, 15.0, 15.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10.0), + ), + minWidth: + MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + buttonCarouselController.nextPage(); + }, + child: Text("SYNC HEALTH DATA", + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + hasAlreadySynced ? Container( + margin: EdgeInsets.fromLTRB( + 15.0, 0.0, 15.0, 15.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10.0), + ), + minWidth: + MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + _openHealthDataList(); + }, + child: Text("ALREADY SYNCED", + style: TextStyle(fontSize: 18.0)), + ), + ), + ) : Container(), + ], + ), + )); + }, + ); + }).toList(), + ), + ) + ], + ), + ); + } + + getLastPatientRecord(BuildContext context) { + SmartWatchIntegrationService service = new SmartWatchIntegrationService(); + service.getLastPatientRecord(context).then((res) { + if (res['MessageStatus'] == 1) { + print(res['Med_GetPatientLastRecordList']); + setState(() { + if (res['Med_GetPatientLastRecordList'] != null) + hasAlreadySynced = true; + else + hasAlreadySynced = false; + }); + } else {} + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + _openHealthDataList() { + Navigator.push( + context, MaterialPageRoute(builder: (context) => HealthDataList())); + } +} diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart new file mode 100644 index 00000000..315249c8 --- /dev/null +++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart @@ -0,0 +1,54 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + +class SmartWatchIntegrationService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getLastPatientRecord(BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": authUser.outSA, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "License": true + }; + + dynamic localRes; + + await baseAppClient.post(GET_PATIENT_LAST_RECORD, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + + } +} diff --git a/pubspec.yaml b/pubspec.yaml index a383192d..05ff2801 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: giffy_dialog: ^1.8.0 # Flutter Html View - flutter_html: 1.0.2 + flutter_html: 1.0.0 # Native flutter_device_type: ^0.2.0 @@ -87,7 +87,7 @@ dependencies: table_calendar: ^2.2.3 # SVG Images - flutter_svg: ^0.18.0 + flutter_svg: ^0.17.0 # Location Helper map_launcher: ^0.8.1 diff --git a/sleep_data.png b/sleep_data.png new file mode 100644 index 00000000..dc6661d6 Binary files /dev/null and b/sleep_data.png differ