diff --git a/android/app/src/main/kotlin/com/ejada/hmg/PermissionManager/AppPreferences.java b/android/app/src/main/kotlin/com/ejada/hmg/PermissionManager/AppPreferences.java index 7dc193c2..d0127998 100644 --- a/android/app/src/main/kotlin/com/ejada/hmg/PermissionManager/AppPreferences.java +++ b/android/app/src/main/kotlin/com/ejada/hmg/PermissionManager/AppPreferences.java @@ -1,4 +1,4 @@ -package com.cloudsolutions.hmg.PermissionManager; +package com.ejada.hmg.PermissionManager; import android.content.Context; import android.content.SharedPreferences; diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index c025a030..a4317bc2 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1533,6 +1533,7 @@ "vatPercent": "ضريبة القيمة المضافة (15%)", "proceedToPayment": "المتابعة للدفع", "supportedSmartWatches": "كيف تعمل؟", + "smartwatchHowItWorks": "كيف تعمل الساعة الذكية", "pleaseMakeSureSamsungWatchConnected": "يرجى التأكد من أن ساعة Samsung الخاصة بك متصلة بهاتفك، ومتزامنة ومحدثة بشكل نشط.", "beforeSyncingDataFollowInstructions": "قبل مزامنة البيانات، يرجى التأكد من اتباع التعليمات بشكل صحيح.", "viewWatchInstructions": "عرض تعليمات الساعة", @@ -1544,6 +1545,18 @@ "seconds": "ثواني", "secs": "ثواني", "noAllergiesDataFound": "لم يتم العثور على بيانات الحساسية...", + "allHealthData": "جميع البيانات الصحية", + "activityCalories": "سعرات النشاط", + "activityCaloriesDescription": "توفر حلقات النشاط مرجعًا بصريًا سريعًا لمدى نشاطك خلال كل يوم.", + "steps": "الخطوات", + "distanceCovered": "المسافة المقطوعة", + "distanceCoveredDescription": "المسافة المقطوعة على مدار اليوم", + "sleepScore": "مؤشر النوم", + "sleepScoreDescription": "يتتبع هذا عدد ساعات نومك خلال اليوم", + "bloodOxygen": "أكسجين الدم", + "bloodOxygenTrackingDescription": "يتتبع هذا مستوى أكسجين الدم لمراقبة السجل الصحي وتحديثه", + "bodyTemperature": "درجة حرارة الجسم", + "bodyTemperatureTrackingDescription": "يتتبع هذا درجة حرارة الجسم لمراقبة السجل الصحي وتحديثه", "heartRateDescription": "معدل ضربات قلبك يشير إلى عدد المرات التي ينبض فيها قلبك في الدقيقة", "bloodOxygenDescription": "مستوى الأكسجين في الدم يشير إلى كمية الأكسجين التي تحملها خلايا الدم الحمراء", "stepsDescription": "عدد الخطوات المتخذة على مدار اليوم", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 69e0d66d..944aa5b3 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1526,6 +1526,7 @@ "vatPercent": "VAT (15%)", "proceedToPayment": "Proceed to Payment", "supportedSmartWatches": "Supported Smart Watches", + "smartwatchHowItWorks": "How does it work", "pleaseMakeSureSamsungWatchConnected": "Please make sure that your Samsung Watch is connected to your Phone, is actively synced & updated.", "beforeSyncingDataFollowInstructions": "Before syncing data, please make sure that you have followed the instructions properly.", "viewWatchInstructions": "View watch instructions", @@ -1537,6 +1538,18 @@ "seconds": "Seconds", "secs": "Secs", "noAllergiesDataFound": "No allergies data found...", + "allHealthData": "All Health Data", + "activityCalories": "Activity Calories", + "activityCaloriesDescription": "Activity rings give you a quick visual reference of how active you are each day.", + "steps": "Steps", + "distanceCovered": "Distance Covered", + "distanceCoveredDescription": "Distance covered throughout the day", + "sleepScore": "Sleep Score", + "sleepScoreDescription": "This keeps track of how many hours you sleep in a day", + "bloodOxygen": "Blood Oxygen", + "bloodOxygenTrackingDescription": "This tracks your blood oxygen to monitor and update your health history", + "bodyTemperature": "Body Temperature", + "bodyTemperatureTrackingDescription": "This tracks your body temperature to monitor and update your health history", "heartRateDescription": "Your heart rate indicates how many times your heart beats per minute", "bloodOxygenDescription": "Blood oxygen level indicates how much oxygen your red blood cells are carrying", "stepsDescription": "Number of steps taken throughout the day", diff --git a/lib/features/smartwatch_health_data/health_provider.dart b/lib/features/smartwatch_health_data/health_provider.dart index 1d920e89..ac5e2e49 100644 --- a/lib/features/smartwatch_health_data/health_provider.dart +++ b/lib/features/smartwatch_health_data/health_provider.dart @@ -122,15 +122,15 @@ class HealthProvider with ChangeNotifier { notifyListeners(); final result = await _healthService.initDevice(); isLoading = false; - LoaderBottomSheet.hideLoader(); + // LoaderBottomSheet.hideLoader(); if (result.isError) { - print("the result is error ${(result.asError?.error as PlatformException)?.message}"); - error = 'Error initializing device: ${result.asError}'; + if(result.asError?.error is PlatformException) { + error = 'Error initializing device: ${(result.asError?.error as PlatformException)?.message}'; + } } else { - print("the result is not error"); - LoaderBottomSheet.showLoader(); + // LoaderBottomSheet.showLoader(); await getVitals(); - // LoaderBottomSheet.hideLoader(); + LoaderBottomSheet.hideLoader(); // await Future.delayed(Duration(seconds: 5)); getIt.get().pushPage(page: SmartWatchesHealthDataScreen()); } @@ -289,4 +289,8 @@ class HealthProvider with ChangeNotifier { } return formattedString; } + + void clearError(){ + error = null; + } } diff --git a/lib/features/smartwatch_health_data/model/vitals_data_model.dart b/lib/features/smartwatch_health_data/model/vitals_data_model.dart index 83cd4ea6..819e3773 100644 --- a/lib/features/smartwatch_health_data/model/vitals_data_model.dart +++ b/lib/features/smartwatch_health_data/model/vitals_data_model.dart @@ -22,6 +22,7 @@ class Vitals { if (timestamp.isEmpty) { timestamp = DateTime.now().toIso8601String(); } + timestamp = DateTime.parse(timestamp).toLocal().toIso8601String(); return Vitals( value: map['value'] ?? "", timestamp: timestamp, diff --git a/lib/features/smartwatch_health_data/watch_connectors/IllegalWatchTypeException.dart b/lib/features/smartwatch_health_data/watch_connectors/IllegalWatchTypeException.dart new file mode 100644 index 00000000..c3bfe4fc --- /dev/null +++ b/lib/features/smartwatch_health_data/watch_connectors/IllegalWatchTypeException.dart @@ -0,0 +1 @@ +class IllegalWatchTypeException implements Exception {} \ No newline at end of file diff --git a/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart b/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart index 8abb2136..2a4711b0 100644 --- a/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart +++ b/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart @@ -6,6 +6,8 @@ import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connec import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/samsung_health.dart'; import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart'; +import 'IllegalWatchTypeException.dart'; + class CreateWatchHelper { static WatchHelper getWatchName(SmartWatchTypes watchType) { /// if running device is ios @@ -16,7 +18,7 @@ class CreateWatchHelper { case SmartWatchTypes.huawei: return HuaweiHealthDataConnector(); default: - return SamsungHealth(); + throw IllegalWatchTypeException(); } } } \ No newline at end of file diff --git a/lib/presentation/smartwatches/activity_detail.dart b/lib/presentation/smartwatches/activity_detail.dart index 7437b79d..0c17a9c0 100644 --- a/lib/presentation/smartwatches/activity_detail.dart +++ b/lib/presentation/smartwatches/activity_detail.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:easy_localization/easy_localization.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; @@ -43,7 +44,7 @@ class _ActivityDetailsState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "All Health Data".needTranslation, + title: "allHealthData".tr(), child: Column( spacing: 16.h, children: [ @@ -113,8 +114,8 @@ class _ActivityDetailsState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.sectionName.capitalizeFirstofEach.toText32(isBold: true, color: AppColors.textColor), - "Average".toText12(isBold: true, color: AppColors.greyTextColor) + widget.sectionName.capitalizeFirstofEach.tr().toText32(isBold: true, color: AppColors.textColor), + "average".tr().needTranslation.toText12(isBold: true, color: AppColors.greyTextColor) ], ), Selector>( diff --git a/lib/presentation/smartwatches/smart_watches_health_data_screen.dart b/lib/presentation/smartwatches/smart_watches_health_data_screen.dart index baa65b49..78e888ad 100644 --- a/lib/presentation/smartwatches/smart_watches_health_data_screen.dart +++ b/lib/presentation/smartwatches/smart_watches_health_data_screen.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; @@ -20,14 +21,14 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "All Health Data".needTranslation, + title: "allHealthData".tr(context: context), child: Column( spacing: 16.h, children: [ resultItem( leadingIcon: AppAssets.watchActivity, - title: "Activity Calories".needTranslation, - description: "Activity rings give you a quick visual reference of how active you are each day. ".needTranslation, + title: "activityCalories".tr(context: context), + description: "activityCaloriesDescription".tr(context: context), trailingIcon: AppAssets.watchActivityTrailing, result: context.read().sumOfNonEmptyData(context.read().vitals?.activity ?? []), unitsOfMeasure: "Kcal") @@ -36,12 +37,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { context.read().deleteDataIfSectionIsDifferent("activity"); context.read().saveSelectedSection("activity"); context.read().fetchData(); - context.read().navigateToDetails("activity", sectionName: "Activity Calories", uom: "Kcal"); + context.read().navigateToDetails("activity", sectionName: "activityCalories".tr(), uom: "Kcal"); }), resultItem( leadingIcon: AppAssets.watchSteps, - title: "Steps".needTranslation, - description: "Step count is the number of steps you take throughout the day.".needTranslation, + title: "steps".tr(context: context), + description: "stepsDescription".tr(context: context), trailingIcon: AppAssets.watchStepsTrailing, result: context.read().sumOfNonEmptyData(context.read().vitals?.step ?? []), unitsOfMeasure: "Steps") @@ -60,12 +61,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { context.read().deleteDataIfSectionIsDifferent("steps"); context.read().saveSelectedSection("steps"); context.read().fetchData(); - context.read().navigateToDetails("steps", sectionName: "Steps", uom: "Steps"); + context.read().navigateToDetails("steps", sectionName: "steps".tr(), uom: "Steps"); }), resultItem( leadingIcon: AppAssets.watchSteps, - title: "Distance Covered".needTranslation, - description: "Step count is the distance you take throughout the day.".needTranslation, + title: "distanceCovered".tr(context: context), + description: "distanceCoveredDescription".tr(context: context), trailingIcon: AppAssets.watchStepsTrailing, result: context.read().sumOfNonEmptyData(context.read().vitals?.distance ?? []), unitsOfMeasure: "Km") @@ -74,12 +75,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { context.read().deleteDataIfSectionIsDifferent("distance"); context.read().saveSelectedSection("distance"); context.read().fetchData(); - context.read().navigateToDetails("distance", sectionName: "Distance Covered", uom: "km"); + context.read().navigateToDetails("distance", sectionName: "distanceCovered".tr(), uom: "km"); }), resultItem( leadingIcon: AppAssets.watchSleep, - title: "Sleep Score".needTranslation, - description: "This will keep track of how much hours you sleep in a day".needTranslation, + title: "sleepScore".tr(context: context), + description: "sleepScoreDescription".tr(context: context), trailingIcon: AppAssets.watchSleepTrailing, result: DateUtil.millisToHourMin( int.parse(context.read().firstNonEmptyValue(context.read().vitals?.sleep ?? []))) @@ -94,12 +95,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { context.read().deleteDataIfSectionIsDifferent("sleep"); context.read().saveSelectedSection("sleep"); context.read().fetchData(); - context.read().navigateToDetails("sleep", sectionName: "Sleep Score", uom: ""); + context.read().navigateToDetails("sleep", sectionName: "sleepScore".tr(), uom: ""); }), resultItem( leadingIcon: AppAssets.watchWeight, - title: "Blood Oxygen".needTranslation, - description: "This will calculate your Blood Oxygen to keep track and update history".needTranslation, + title: "bloodOxygen".tr(context: context), + description: "bloodOxygenTrackingDescription".tr(context: context), trailingIcon: AppAssets.watchWeightTrailing, result: context.read().firstNonEmptyValue( context.read().vitals?.bodyOxygen ?? [], @@ -110,12 +111,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { context.read().deleteDataIfSectionIsDifferent("bodyOxygen"); context.read().saveSelectedSection("bodyOxygen"); context.read().fetchData(); - context.read().navigateToDetails("bodyOxygen", uom: "%", sectionName: "Blood Oxygen"); + context.read().navigateToDetails("bodyOxygen", uom: "%", sectionName: "bloodOxygen".tr()); }), resultItem( leadingIcon: AppAssets.watchWeight, - title: "Body temperature".needTranslation, - description: "This will calculate your Body temprerature to keep track and update history".needTranslation, + title: "bodyTemperature".tr(context: context), + description: "bodyTemperatureTrackingDescription".tr(context: context), trailingIcon: AppAssets.watchWeightTrailing, result: context.read().firstNonEmptyValue(context.read().vitals?.bodyTemperature ?? []), unitsOfMeasure: "C") @@ -124,7 +125,7 @@ class SmartWatchesHealthDataScreen extends StatelessWidget { context.read().deleteDataIfSectionIsDifferent("bodyTemperature"); context.read().saveSelectedSection("bodyTemperature"); context.read().fetchData(); - context.read().navigateToDetails("bodyTemperature", sectionName: "Body temperature".capitalizeFirstofEach, uom: "C"); + context.read().navigateToDetails("bodyTemperature", sectionName: "bodyTemperature".tr().capitalizeFirstofEach, uom: "C"); }), ], ).paddingSymmetrical(24.w, 24.h), diff --git a/lib/presentation/smartwatches/smartwatch_home_page.dart b/lib/presentation/smartwatches/smartwatch_home_page.dart index d3c0ad36..d1ca0c77 100644 --- a/lib/presentation/smartwatches/smartwatch_home_page.dart +++ b/lib/presentation/smartwatches/smartwatch_home_page.dart @@ -25,203 +25,273 @@ class SmartwatchHomePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColors.bgScaffoldColor, - body: CollapsingListView( - title: LocaleKeys.smartWatches.tr(), - bottomChild: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, + return Consumer(builder: (context, healthProvider, child) { + if (healthProvider.error != null && + healthProvider.error?.isNotEmpty == true) { + Utils.showToast(healthProvider.error!); + healthProvider.clearError(); + } + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: LocaleKeys.smartWatches.tr(), + bottomChild: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + ), + child: CustomButton( + text: LocaleKeys.supportedSmartWatches.tr(context: context), + onPressed: () { + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.supportedSmartWatches.tr(context: context), + context, + child: SupportedWatchesList(), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }, + backgroundColor: AppColors.infoColor.withAlpha(40), + borderColor: AppColors.infoColor.withAlpha(0), + textColor: AppColors.infoColor, + fontSize: 16.f, + isBold: true, + borderRadius: 12.r, + height: 50.h, + icon: AppAssets.ask_doctor_icon, + iconColor: AppColors.infoColor, + iconSize: 18.h, + ).paddingSymmetrical(24.w, 30.h), ), - child: CustomButton( - text: LocaleKeys.supportedSmartWatches.tr(context: context), - onPressed: () { - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.supportedSmartWatches.tr(context: context), - context, - child: SupportedWatchesList(), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }, - backgroundColor: AppColors.infoColor.withAlpha(40), - borderColor: AppColors.infoColor.withAlpha(0), - textColor: AppColors.infoColor, - fontSize: 16.f, - isBold: true, - borderRadius: 12.r, - height: 50.h, - icon: AppAssets.ask_doctor_icon, - iconColor: AppColors.infoColor, - iconSize: 18.h, - ).paddingSymmetrical(24.w, 30.h), - ), - child: SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), - child: GridView( - padding: EdgeInsets.zero, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 16.h, - mainAxisSpacing: 16.w, - childAspectRatio: isFoldable ? 1.1 : (isTablet ? 1.3 : 0.7), - ), - children: [ - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, - ), - child: Column( - children: [ - Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/apple-watch-5.jpg", width: 136.h, height: 136.h).paddingSymmetrical(24.w, 8.h), - "Apple Watch".needTranslation.toText16(isBold: true), - CustomButton( - text: LocaleKeys.selectSmartWatch.tr(context: context), - onPressed: () { - context - .read() - .setSelectedWatchType(SmartWatchTypes.apple, "assets/images/png/smartwatches/apple-watch-5.jpg"); - getIt.get().pushPage( - page: SmartwatchInstructionsPage( - smartwatchDetails: SmartwatchDetails( - SmartWatchTypes.apple, + child: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: + EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), + child: GridView( + padding: EdgeInsets.zero, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 16.h, + mainAxisSpacing: 16.w, + childAspectRatio: + isFoldable ? 1.1 : (isTablet ? 1.3 : 0.7), + ), + children: [ + Container( + decoration: + RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + ), + child: Column( + children: [ + Utils.buildImgWithAssets( + icon: "assets/images/png/smartwatches/apple-watch-5.jpg", - AppAssets.bluetooth, - LocaleKeys.applehealthapplicationshouldbeinstalledinyourphone.tr(context: context), - LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), - LocaleKeys.applewatchshouldbeconnected.tr(context: context)), - )); - }, - backgroundColor: AppColors.primaryRedColor.withAlpha(40), - borderColor: AppColors.primaryRedColor.withAlpha(0), - textColor: AppColors.primaryRedColor, - fontSize: 14.f, - isBold: true, - borderRadius: 12.r, - height: 40.h, - ).paddingSymmetrical(16.w, 12.h), - ], + width: 136.h, + height: 136.h) + .paddingSymmetrical(24.w, 8.h), + "applewatch" + .tr() + .needTranslation + .toText16(isBold: true), + CustomButton( + text: LocaleKeys.selectSmartWatch + .tr(context: context), + onPressed: () { + context.read().setSelectedWatchType( + SmartWatchTypes.apple, + "assets/images/png/smartwatches/apple-watch-5.jpg"); + getIt.get().pushPage( + page: SmartwatchInstructionsPage( + smartwatchDetails: SmartwatchDetails( + SmartWatchTypes.apple, + "assets/images/png/smartwatches/apple-watch-5.jpg", + AppAssets.bluetooth, + LocaleKeys + .applehealthapplicationshouldbeinstalledinyourphone + .tr(context: context), + LocaleKeys + .unabletodetectapplicationinstalledpleasecomebackonceinstalled + .tr(context: context), + LocaleKeys.applewatchshouldbeconnected + .tr(context: context)), + )); + }, + backgroundColor: + AppColors.primaryRedColor.withAlpha(40), + borderColor: + AppColors.primaryRedColor.withAlpha(0), + textColor: AppColors.primaryRedColor, + fontSize: 14.f, + isBold: true, + borderRadius: 12.r, + height: 40.h, + ).paddingSymmetrical(16.w, 12.h), + ], + ), ), - ), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), - child: Column( - children: [ - Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", fit: BoxFit.contain, width: 136.w, height: 136.h) - .paddingSymmetrical(24.w, 8.h), - "Samsung Watch".needTranslation.toText16(isBold: true), - CustomButton( - text: LocaleKeys.selectSmartWatch.tr(context: context), - onPressed: () { - context - .read() - .setSelectedWatchType(SmartWatchTypes.samsung, "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg"); - getIt.get().pushPage( - page: SmartwatchInstructionsPage( - smartwatchDetails: SmartwatchDetails( - SmartWatchTypes.samsung, + Container( + decoration: RoundedRectangleBorder() + .toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r), + child: Column( + children: [ + Utils.buildImgWithAssets( + icon: "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", - AppAssets.bluetooth, - LocaleKeys.samsunghealthapplicationshouldbeinstalledinyourphone.tr(context: context), - LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), - LocaleKeys.samsungwatchshouldbeconnected.tr(context: context)), - )); - }, - backgroundColor: AppColors.primaryRedColor.withAlpha(40), - borderColor: AppColors.primaryRedColor.withAlpha(0), - textColor: AppColors.primaryRedColor, - fontSize: 14.f, - isBold: true, - borderRadius: 12.r, - height: 40.h, - ).paddingSymmetrical(16.w, 12.h), - ], - ), - ), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, - ), - child: Column( - children: [ - Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/Huawei_Watch.png", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), - "Huawei Watch".needTranslation.toText16(isBold: true), - CustomButton( - text: LocaleKeys.selectSmartWatch.tr(context: context), - onPressed: () { - context.read().setSelectedWatchType(SmartWatchTypes.huawei, "assets/images/png/smartwatches/Huawei_Watch.png"); - getIt.get().pushPage(page: SmartwatchInstructionsPage( - smartwatchDetails: SmartwatchDetails(SmartWatchTypes.huawei, - "assets/images/png/smartwatches/Huawei_Watch.png", - AppAssets.bluetooth, - LocaleKeys.huaweihealthapplicationshouldbeinstalledinyourphone.tr(context: context), - LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), - LocaleKeys.huaweiwatchshouldbeconnected.tr(context: context)), - )); - // showUnavailableDialog(context); - }, - backgroundColor: AppColors.primaryRedColor.withAlpha(40), - borderColor: AppColors.primaryRedColor.withAlpha(0), - textColor: AppColors.primaryRedColor, - fontSize: 14.f, - isBold: true, - borderRadius: 12.r, - height: 40.h, - ).paddingSymmetrical(16.w, 12.h), - ], + fit: BoxFit.contain, + width: 136.w, + height: 136.h) + .paddingSymmetrical(24.w, 8.h), + "samsungwatch" + .tr() + .needTranslation + .toText16(isBold: true), + CustomButton( + text: LocaleKeys.selectSmartWatch + .tr(context: context), + onPressed: () { + context.read().setSelectedWatchType( + SmartWatchTypes.samsung, + "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg"); + getIt.get().pushPage( + page: SmartwatchInstructionsPage( + smartwatchDetails: SmartwatchDetails( + SmartWatchTypes.samsung, + "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", + AppAssets.bluetooth, + LocaleKeys + .samsunghealthapplicationshouldbeinstalledinyourphone + .tr(context: context), + LocaleKeys + .unabletodetectapplicationinstalledpleasecomebackonceinstalled + .tr(context: context), + LocaleKeys + .samsungwatchshouldbeconnected + .tr(context: context)), + )); + }, + backgroundColor: + AppColors.primaryRedColor.withAlpha(40), + borderColor: + AppColors.primaryRedColor.withAlpha(0), + textColor: AppColors.primaryRedColor, + fontSize: 14.f, + isBold: true, + borderRadius: 12.r, + height: 40.h, + ).paddingSymmetrical(16.w, 12.h), + ], + ), ), - ), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, + Container( + decoration: + RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + ), + child: Column( + children: [ + Utils.buildImgWithAssets( + icon: + "assets/images/png/smartwatches/Huawei_Watch.png", + width: 136.w, + height: 136.h) + .paddingSymmetrical(24.w, 8.h), + "huaweiwatch" + .tr() + .needTranslation + .toText16(isBold: true), + CustomButton( + text: LocaleKeys.selectSmartWatch + .tr(context: context), + onPressed: () { + // context.read().setSelectedWatchType(SmartWatchTypes.huawei, "assets/images/png/smartwatches/Huawei_Watch.png"); + // getIt.get().pushPage(page: SmartwatchInstructionsPage( + // smartwatchDetails: SmartwatchDetails(SmartWatchTypes.huawei, + // "assets/images/png/smartwatches/Huawei_Watch.png", + // AppAssets.bluetooth, + // LocaleKeys.huaweihealthapplicationshouldbeinstalledinyourphone.tr(context: context), + // LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), + // LocaleKeys.huaweiwatchshouldbeconnected.tr(context: context)), + // )); + showUnavailableDialog(context); + }, + backgroundColor: + AppColors.primaryRedColor.withAlpha(40), + borderColor: + AppColors.primaryRedColor.withAlpha(0), + textColor: AppColors.primaryRedColor, + fontSize: 14.f, + isBold: true, + borderRadius: 12.r, + height: 40.h, + ).paddingSymmetrical(16.w, 12.h), + ], + ), ), - child: Column( - children: [ - Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/Whoop_Watch.png", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), - "Whoop Watch".needTranslation.toText16(isBold: true), - CustomButton( - text: LocaleKeys.selectSmartWatch.tr(context: context), - onPressed: () { - showUnavailableDialog(context); - // context.read().setSelectedWatchType(SmartWatchTypes.whoop, "assets/images/png/smartwatches/Whoop_Watch.png"); - // getIt.get().pushPage(page: SmartwatchInstructionsPage( - // smartwatchDetails: SmartwatchDetails(SmartWatchTypes.whoop, - // "assets/images/png/smartwatches/Whoop_Watch.png", - // AppAssets.bluetooth, - // LocaleKeys.whoophealthapplicationshouldbeinstalledinyourphone.tr(context: context), - // LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), - // LocaleKeys.whoopwatchshouldbeconnected.tr(context: context)), - // )); - }, - backgroundColor: AppColors.primaryRedColor.withAlpha(40), - borderColor: AppColors.primaryRedColor.withAlpha(0), - textColor: AppColors.primaryRedColor, - fontSize: 14.f, - isBold: true, - borderRadius: 12.r, - height: 40.h, - ).paddingSymmetrical(16.w, 12.h), - ], + Container( + decoration: + RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + ), + child: Column( + children: [ + Utils.buildImgWithAssets( + icon: + "assets/images/png/smartwatches/Whoop_Watch.png", + width: 136.w, + height: 136.h) + .paddingSymmetrical(24.w, 8.h), + "whoopwatch" + .tr() + .needTranslation + .toText16(isBold: true), + CustomButton( + text: LocaleKeys.selectSmartWatch + .tr(context: context), + onPressed: () { + showUnavailableDialog(context); + // context.read().setSelectedWatchType(SmartWatchTypes.whoop, "assets/images/png/smartwatches/Whoop_Watch.png"); + // getIt.get().pushPage(page: SmartwatchInstructionsPage( + // smartwatchDetails: SmartwatchDetails(SmartWatchTypes.whoop, + // "assets/images/png/smartwatches/Whoop_Watch.png", + // AppAssets.bluetooth, + // LocaleKeys.whoophealthapplicationshouldbeinstalledinyourphone.tr(context: context), + // LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), + // LocaleKeys.whoopwatchshouldbeconnected.tr(context: context)), + // )); + }, + backgroundColor: + AppColors.primaryRedColor.withAlpha(40), + borderColor: + AppColors.primaryRedColor.withAlpha(0), + textColor: AppColors.primaryRedColor, + fontSize: 14.f, + isBold: true, + borderRadius: 12.r, + height: 40.h, + ).paddingSymmetrical(16.w, 12.h), + ], + ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), ), - ), - ); + ); + }); } void showUnavailableDialog(BuildContext context) { @@ -229,7 +299,8 @@ class SmartwatchHomePage extends StatelessWidget { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: LocaleKeys.featureComingSoonDescription.tr(context: context), + loadingText: + LocaleKeys.featureComingSoonDescription.tr(context: context), isShowActionButtons: false, showOkButton: true, onConfirmTap: () async { diff --git a/lib/presentation/smartwatches/smartwatch_instructions_page.dart b/lib/presentation/smartwatches/smartwatch_instructions_page.dart index 7c0d0b97..8636e94e 100644 --- a/lib/presentation/smartwatches/smartwatch_instructions_page.dart +++ b/lib/presentation/smartwatches/smartwatch_instructions_page.dart @@ -24,7 +24,7 @@ class SmartwatchInstructionsPage extends StatelessWidget { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "How does it work".needTranslation, + title: "smartwatchHowItWorks".tr(context: context), bottomChild: Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor,