* localization of string is performed.

* date time handling converting it to locale time before consuming it.
* loader issue handled that was not hiding after call to hide loader
Main_App_Replacement
taha 1 week ago
parent 3234d493fe
commit 77b2011fcd

@ -1,4 +1,4 @@
package com.cloudsolutions.hmg.PermissionManager; package com.ejada.hmg.PermissionManager;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;

@ -1533,6 +1533,7 @@
"vatPercent": "ضريبة القيمة المضافة (15%)", "vatPercent": "ضريبة القيمة المضافة (15%)",
"proceedToPayment": "المتابعة للدفع", "proceedToPayment": "المتابعة للدفع",
"supportedSmartWatches": "كيف تعمل؟", "supportedSmartWatches": "كيف تعمل؟",
"smartwatchHowItWorks": "كيف تعمل الساعة الذكية",
"pleaseMakeSureSamsungWatchConnected": "يرجى التأكد من أن ساعة Samsung الخاصة بك متصلة بهاتفك، ومتزامنة ومحدثة بشكل نشط.", "pleaseMakeSureSamsungWatchConnected": "يرجى التأكد من أن ساعة Samsung الخاصة بك متصلة بهاتفك، ومتزامنة ومحدثة بشكل نشط.",
"beforeSyncingDataFollowInstructions": "قبل مزامنة البيانات، يرجى التأكد من اتباع التعليمات بشكل صحيح.", "beforeSyncingDataFollowInstructions": "قبل مزامنة البيانات، يرجى التأكد من اتباع التعليمات بشكل صحيح.",
"viewWatchInstructions": "عرض تعليمات الساعة", "viewWatchInstructions": "عرض تعليمات الساعة",
@ -1544,6 +1545,18 @@
"seconds": "ثواني", "seconds": "ثواني",
"secs": "ثواني", "secs": "ثواني",
"noAllergiesDataFound": "لم يتم العثور على بيانات الحساسية...", "noAllergiesDataFound": "لم يتم العثور على بيانات الحساسية...",
"allHealthData": "جميع البيانات الصحية",
"activityCalories": "سعرات النشاط",
"activityCaloriesDescription": "توفر حلقات النشاط مرجعًا بصريًا سريعًا لمدى نشاطك خلال كل يوم.",
"steps": "الخطوات",
"distanceCovered": "المسافة المقطوعة",
"distanceCoveredDescription": "المسافة المقطوعة على مدار اليوم",
"sleepScore": "مؤشر النوم",
"sleepScoreDescription": "يتتبع هذا عدد ساعات نومك خلال اليوم",
"bloodOxygen": "أكسجين الدم",
"bloodOxygenTrackingDescription": "يتتبع هذا مستوى أكسجين الدم لمراقبة السجل الصحي وتحديثه",
"bodyTemperature": "درجة حرارة الجسم",
"bodyTemperatureTrackingDescription": "يتتبع هذا درجة حرارة الجسم لمراقبة السجل الصحي وتحديثه",
"heartRateDescription": "معدل ضربات قلبك يشير إلى عدد المرات التي ينبض فيها قلبك في الدقيقة", "heartRateDescription": "معدل ضربات قلبك يشير إلى عدد المرات التي ينبض فيها قلبك في الدقيقة",
"bloodOxygenDescription": "مستوى الأكسجين في الدم يشير إلى كمية الأكسجين التي تحملها خلايا الدم الحمراء", "bloodOxygenDescription": "مستوى الأكسجين في الدم يشير إلى كمية الأكسجين التي تحملها خلايا الدم الحمراء",
"stepsDescription": "عدد الخطوات المتخذة على مدار اليوم", "stepsDescription": "عدد الخطوات المتخذة على مدار اليوم",

@ -1526,6 +1526,7 @@
"vatPercent": "VAT (15%)", "vatPercent": "VAT (15%)",
"proceedToPayment": "Proceed to Payment", "proceedToPayment": "Proceed to Payment",
"supportedSmartWatches": "Supported Smart Watches", "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.", "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.", "beforeSyncingDataFollowInstructions": "Before syncing data, please make sure that you have followed the instructions properly.",
"viewWatchInstructions": "View watch instructions", "viewWatchInstructions": "View watch instructions",
@ -1537,6 +1538,18 @@
"seconds": "Seconds", "seconds": "Seconds",
"secs": "Secs", "secs": "Secs",
"noAllergiesDataFound": "No allergies data found...", "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", "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", "bloodOxygenDescription": "Blood oxygen level indicates how much oxygen your red blood cells are carrying",
"stepsDescription": "Number of steps taken throughout the day", "stepsDescription": "Number of steps taken throughout the day",

@ -122,15 +122,15 @@ class HealthProvider with ChangeNotifier {
notifyListeners(); notifyListeners();
final result = await _healthService.initDevice(); final result = await _healthService.initDevice();
isLoading = false; isLoading = false;
LoaderBottomSheet.hideLoader(); // LoaderBottomSheet.hideLoader();
if (result.isError) { if (result.isError) {
print("the result is error ${(result.asError?.error as PlatformException)?.message}"); if(result.asError?.error is PlatformException) {
error = 'Error initializing device: ${result.asError}'; error = 'Error initializing device: ${(result.asError?.error as PlatformException)?.message}';
}
} else { } else {
print("the result is not error"); // LoaderBottomSheet.showLoader();
LoaderBottomSheet.showLoader();
await getVitals(); await getVitals();
// LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
// await Future.delayed(Duration(seconds: 5)); // await Future.delayed(Duration(seconds: 5));
getIt.get<NavigationService>().pushPage(page: SmartWatchesHealthDataScreen()); getIt.get<NavigationService>().pushPage(page: SmartWatchesHealthDataScreen());
} }
@ -289,4 +289,8 @@ class HealthProvider with ChangeNotifier {
} }
return formattedString; return formattedString;
} }
void clearError(){
error = null;
}
} }

@ -22,6 +22,7 @@ class Vitals {
if (timestamp.isEmpty) { if (timestamp.isEmpty) {
timestamp = DateTime.now().toIso8601String(); timestamp = DateTime.now().toIso8601String();
} }
timestamp = DateTime.parse(timestamp).toLocal().toIso8601String();
return Vitals( return Vitals(
value: map['value'] ?? "", value: map['value'] ?? "",
timestamp: timestamp, timestamp: timestamp,

@ -0,0 +1 @@
class IllegalWatchTypeException implements Exception {}

@ -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/samsung_health.dart';
import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart'; import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart';
import 'IllegalWatchTypeException.dart';
class CreateWatchHelper { class CreateWatchHelper {
static WatchHelper getWatchName(SmartWatchTypes watchType) { static WatchHelper getWatchName(SmartWatchTypes watchType) {
/// if running device is ios /// if running device is ios
@ -16,7 +18,7 @@ class CreateWatchHelper {
case SmartWatchTypes.huawei: case SmartWatchTypes.huawei:
return HuaweiHealthDataConnector(); return HuaweiHealthDataConnector();
default: default:
return SamsungHealth(); throw IllegalWatchTypeException();
} }
} }
} }

@ -1,5 +1,6 @@
import 'dart:math'; import 'dart:math';
import 'package:easy_localization/easy_localization.dart';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
@ -43,7 +44,7 @@ class _ActivityDetailsState extends State<ActivityDetails> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView( body: CollapsingListView(
title: "All Health Data".needTranslation, title: "allHealthData".tr(),
child: Column( child: Column(
spacing: 16.h, spacing: 16.h,
children: [ children: [
@ -113,8 +114,8 @@ class _ActivityDetailsState extends State<ActivityDetails> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
widget.sectionName.capitalizeFirstofEach.toText32(isBold: true, color: AppColors.textColor), widget.sectionName.capitalizeFirstofEach.tr().toText32(isBold: true, color: AppColors.textColor),
"Average".toText12(isBold: true, color: AppColors.greyTextColor) "average".tr().needTranslation.toText12(isBold: true, color: AppColors.greyTextColor)
], ],
), ),
Selector<HealthProvider, Tuple2<double?, String?>>( Selector<HealthProvider, Tuple2<double?, String?>>(

@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
@ -20,14 +21,14 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView( body: CollapsingListView(
title: "All Health Data".needTranslation, title: "allHealthData".tr(context: context),
child: Column( child: Column(
spacing: 16.h, spacing: 16.h,
children: [ children: [
resultItem( resultItem(
leadingIcon: AppAssets.watchActivity, leadingIcon: AppAssets.watchActivity,
title: "Activity Calories".needTranslation, title: "activityCalories".tr(context: context),
description: "Activity rings give you a quick visual reference of how active you are each day. ".needTranslation, description: "activityCaloriesDescription".tr(context: context),
trailingIcon: AppAssets.watchActivityTrailing, trailingIcon: AppAssets.watchActivityTrailing,
result: context.read<HealthProvider>().sumOfNonEmptyData(context.read<HealthProvider>().vitals?.activity ?? []), result: context.read<HealthProvider>().sumOfNonEmptyData(context.read<HealthProvider>().vitals?.activity ?? []),
unitsOfMeasure: "Kcal") unitsOfMeasure: "Kcal")
@ -36,12 +37,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
context.read<HealthProvider>().deleteDataIfSectionIsDifferent("activity"); context.read<HealthProvider>().deleteDataIfSectionIsDifferent("activity");
context.read<HealthProvider>().saveSelectedSection("activity"); context.read<HealthProvider>().saveSelectedSection("activity");
context.read<HealthProvider>().fetchData(); context.read<HealthProvider>().fetchData();
context.read<HealthProvider>().navigateToDetails("activity", sectionName: "Activity Calories", uom: "Kcal"); context.read<HealthProvider>().navigateToDetails("activity", sectionName: "activityCalories".tr(), uom: "Kcal");
}), }),
resultItem( resultItem(
leadingIcon: AppAssets.watchSteps, leadingIcon: AppAssets.watchSteps,
title: "Steps".needTranslation, title: "steps".tr(context: context),
description: "Step count is the number of steps you take throughout the day.".needTranslation, description: "stepsDescription".tr(context: context),
trailingIcon: AppAssets.watchStepsTrailing, trailingIcon: AppAssets.watchStepsTrailing,
result: context.read<HealthProvider>().sumOfNonEmptyData(context.read<HealthProvider>().vitals?.step ?? []), result: context.read<HealthProvider>().sumOfNonEmptyData(context.read<HealthProvider>().vitals?.step ?? []),
unitsOfMeasure: "Steps") unitsOfMeasure: "Steps")
@ -60,12 +61,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
context.read<HealthProvider>().deleteDataIfSectionIsDifferent("steps"); context.read<HealthProvider>().deleteDataIfSectionIsDifferent("steps");
context.read<HealthProvider>().saveSelectedSection("steps"); context.read<HealthProvider>().saveSelectedSection("steps");
context.read<HealthProvider>().fetchData(); context.read<HealthProvider>().fetchData();
context.read<HealthProvider>().navigateToDetails("steps", sectionName: "Steps", uom: "Steps"); context.read<HealthProvider>().navigateToDetails("steps", sectionName: "steps".tr(), uom: "Steps");
}), }),
resultItem( resultItem(
leadingIcon: AppAssets.watchSteps, leadingIcon: AppAssets.watchSteps,
title: "Distance Covered".needTranslation, title: "distanceCovered".tr(context: context),
description: "Step count is the distance you take throughout the day.".needTranslation, description: "distanceCoveredDescription".tr(context: context),
trailingIcon: AppAssets.watchStepsTrailing, trailingIcon: AppAssets.watchStepsTrailing,
result: context.read<HealthProvider>().sumOfNonEmptyData(context.read<HealthProvider>().vitals?.distance ?? []), result: context.read<HealthProvider>().sumOfNonEmptyData(context.read<HealthProvider>().vitals?.distance ?? []),
unitsOfMeasure: "Km") unitsOfMeasure: "Km")
@ -74,12 +75,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
context.read<HealthProvider>().deleteDataIfSectionIsDifferent("distance"); context.read<HealthProvider>().deleteDataIfSectionIsDifferent("distance");
context.read<HealthProvider>().saveSelectedSection("distance"); context.read<HealthProvider>().saveSelectedSection("distance");
context.read<HealthProvider>().fetchData(); context.read<HealthProvider>().fetchData();
context.read<HealthProvider>().navigateToDetails("distance", sectionName: "Distance Covered", uom: "km"); context.read<HealthProvider>().navigateToDetails("distance", sectionName: "distanceCovered".tr(), uom: "km");
}), }),
resultItem( resultItem(
leadingIcon: AppAssets.watchSleep, leadingIcon: AppAssets.watchSleep,
title: "Sleep Score".needTranslation, title: "sleepScore".tr(context: context),
description: "This will keep track of how much hours you sleep in a day".needTranslation, description: "sleepScoreDescription".tr(context: context),
trailingIcon: AppAssets.watchSleepTrailing, trailingIcon: AppAssets.watchSleepTrailing,
result: DateUtil.millisToHourMin( result: DateUtil.millisToHourMin(
int.parse(context.read<HealthProvider>().firstNonEmptyValue(context.read<HealthProvider>().vitals?.sleep ?? []))) int.parse(context.read<HealthProvider>().firstNonEmptyValue(context.read<HealthProvider>().vitals?.sleep ?? [])))
@ -94,12 +95,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
context.read<HealthProvider>().deleteDataIfSectionIsDifferent("sleep"); context.read<HealthProvider>().deleteDataIfSectionIsDifferent("sleep");
context.read<HealthProvider>().saveSelectedSection("sleep"); context.read<HealthProvider>().saveSelectedSection("sleep");
context.read<HealthProvider>().fetchData(); context.read<HealthProvider>().fetchData();
context.read<HealthProvider>().navigateToDetails("sleep", sectionName: "Sleep Score", uom: ""); context.read<HealthProvider>().navigateToDetails("sleep", sectionName: "sleepScore".tr(), uom: "");
}), }),
resultItem( resultItem(
leadingIcon: AppAssets.watchWeight, leadingIcon: AppAssets.watchWeight,
title: "Blood Oxygen".needTranslation, title: "bloodOxygen".tr(context: context),
description: "This will calculate your Blood Oxygen to keep track and update history".needTranslation, description: "bloodOxygenTrackingDescription".tr(context: context),
trailingIcon: AppAssets.watchWeightTrailing, trailingIcon: AppAssets.watchWeightTrailing,
result: context.read<HealthProvider>().firstNonEmptyValue( result: context.read<HealthProvider>().firstNonEmptyValue(
context.read<HealthProvider>().vitals?.bodyOxygen ?? [], context.read<HealthProvider>().vitals?.bodyOxygen ?? [],
@ -110,12 +111,12 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
context.read<HealthProvider>().deleteDataIfSectionIsDifferent("bodyOxygen"); context.read<HealthProvider>().deleteDataIfSectionIsDifferent("bodyOxygen");
context.read<HealthProvider>().saveSelectedSection("bodyOxygen"); context.read<HealthProvider>().saveSelectedSection("bodyOxygen");
context.read<HealthProvider>().fetchData(); context.read<HealthProvider>().fetchData();
context.read<HealthProvider>().navigateToDetails("bodyOxygen", uom: "%", sectionName: "Blood Oxygen"); context.read<HealthProvider>().navigateToDetails("bodyOxygen", uom: "%", sectionName: "bloodOxygen".tr());
}), }),
resultItem( resultItem(
leadingIcon: AppAssets.watchWeight, leadingIcon: AppAssets.watchWeight,
title: "Body temperature".needTranslation, title: "bodyTemperature".tr(context: context),
description: "This will calculate your Body temprerature to keep track and update history".needTranslation, description: "bodyTemperatureTrackingDescription".tr(context: context),
trailingIcon: AppAssets.watchWeightTrailing, trailingIcon: AppAssets.watchWeightTrailing,
result: context.read<HealthProvider>().firstNonEmptyValue(context.read<HealthProvider>().vitals?.bodyTemperature ?? []), result: context.read<HealthProvider>().firstNonEmptyValue(context.read<HealthProvider>().vitals?.bodyTemperature ?? []),
unitsOfMeasure: "C") unitsOfMeasure: "C")
@ -124,7 +125,7 @@ class SmartWatchesHealthDataScreen extends StatelessWidget {
context.read<HealthProvider>().deleteDataIfSectionIsDifferent("bodyTemperature"); context.read<HealthProvider>().deleteDataIfSectionIsDifferent("bodyTemperature");
context.read<HealthProvider>().saveSelectedSection("bodyTemperature"); context.read<HealthProvider>().saveSelectedSection("bodyTemperature");
context.read<HealthProvider>().fetchData(); context.read<HealthProvider>().fetchData();
context.read<HealthProvider>().navigateToDetails("bodyTemperature", sectionName: "Body temperature".capitalizeFirstofEach, uom: "C"); context.read<HealthProvider>().navigateToDetails("bodyTemperature", sectionName: "bodyTemperature".tr().capitalizeFirstofEach, uom: "C");
}), }),
], ],
).paddingSymmetrical(24.w, 24.h), ).paddingSymmetrical(24.w, 24.h),

@ -25,6 +25,12 @@ class SmartwatchHomePage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<HealthProvider>(builder: (context, healthProvider, child) {
if (healthProvider.error != null &&
healthProvider.error?.isNotEmpty == true) {
Utils.showToast(healthProvider.error!);
healthProvider.clearError();
}
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView( body: CollapsingListView(
@ -62,7 +68,8 @@ class SmartwatchHomePage extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), padding:
EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h),
child: GridView( child: GridView(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
shrinkWrap: true, shrinkWrap: true,
@ -71,37 +78,55 @@ class SmartwatchHomePage extends StatelessWidget {
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 16.h, crossAxisSpacing: 16.h,
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
childAspectRatio: isFoldable ? 1.1 : (isTablet ? 1.3 : 0.7), childAspectRatio:
isFoldable ? 1.1 : (isTablet ? 1.3 : 0.7),
), ),
children: [ children: [
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,
borderRadius: 24.r, borderRadius: 24.r,
), ),
child: Column( child: Column(
children: [ children: [
Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/apple-watch-5.jpg", width: 136.h, height: 136.h).paddingSymmetrical(24.w, 8.h), Utils.buildImgWithAssets(
"Apple Watch".needTranslation.toText16(isBold: true), icon:
"assets/images/png/smartwatches/apple-watch-5.jpg",
width: 136.h,
height: 136.h)
.paddingSymmetrical(24.w, 8.h),
"applewatch"
.tr()
.needTranslation
.toText16(isBold: true),
CustomButton( CustomButton(
text: LocaleKeys.selectSmartWatch.tr(context: context), text: LocaleKeys.selectSmartWatch
.tr(context: context),
onPressed: () { onPressed: () {
context context.read<HealthProvider>().setSelectedWatchType(
.read<HealthProvider>() SmartWatchTypes.apple,
.setSelectedWatchType(SmartWatchTypes.apple, "assets/images/png/smartwatches/apple-watch-5.jpg"); "assets/images/png/smartwatches/apple-watch-5.jpg");
getIt.get<NavigationService>().pushPage( getIt.get<NavigationService>().pushPage(
page: SmartwatchInstructionsPage( page: SmartwatchInstructionsPage(
smartwatchDetails: SmartwatchDetails( smartwatchDetails: SmartwatchDetails(
SmartWatchTypes.apple, SmartWatchTypes.apple,
"assets/images/png/smartwatches/apple-watch-5.jpg", "assets/images/png/smartwatches/apple-watch-5.jpg",
AppAssets.bluetooth, AppAssets.bluetooth,
LocaleKeys.applehealthapplicationshouldbeinstalledinyourphone.tr(context: context), LocaleKeys
LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), .applehealthapplicationshouldbeinstalledinyourphone
LocaleKeys.applewatchshouldbeconnected.tr(context: context)), .tr(context: context),
LocaleKeys
.unabletodetectapplicationinstalledpleasecomebackonceinstalled
.tr(context: context),
LocaleKeys.applewatchshouldbeconnected
.tr(context: context)),
)); ));
}, },
backgroundColor: AppColors.primaryRedColor.withAlpha(40), backgroundColor:
borderColor: AppColors.primaryRedColor.withAlpha(0), AppColors.primaryRedColor.withAlpha(40),
borderColor:
AppColors.primaryRedColor.withAlpha(0),
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 14.f, fontSize: 14.f,
isBold: true, isBold: true,
@ -112,31 +137,51 @@ class SmartwatchHomePage extends StatelessWidget {
), ),
), ),
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), decoration: RoundedRectangleBorder()
.toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24.r),
child: Column( child: Column(
children: [ children: [
Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", fit: BoxFit.contain, width: 136.w, height: 136.h) 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), .paddingSymmetrical(24.w, 8.h),
"Samsung Watch".needTranslation.toText16(isBold: true), "samsungwatch"
.tr()
.needTranslation
.toText16(isBold: true),
CustomButton( CustomButton(
text: LocaleKeys.selectSmartWatch.tr(context: context), text: LocaleKeys.selectSmartWatch
.tr(context: context),
onPressed: () { onPressed: () {
context context.read<HealthProvider>().setSelectedWatchType(
.read<HealthProvider>() SmartWatchTypes.samsung,
.setSelectedWatchType(SmartWatchTypes.samsung, "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg"); "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg");
getIt.get<NavigationService>().pushPage( getIt.get<NavigationService>().pushPage(
page: SmartwatchInstructionsPage( page: SmartwatchInstructionsPage(
smartwatchDetails: SmartwatchDetails( smartwatchDetails: SmartwatchDetails(
SmartWatchTypes.samsung, SmartWatchTypes.samsung,
"assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg",
AppAssets.bluetooth, AppAssets.bluetooth,
LocaleKeys.samsunghealthapplicationshouldbeinstalledinyourphone.tr(context: context), LocaleKeys
LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), .samsunghealthapplicationshouldbeinstalledinyourphone
LocaleKeys.samsungwatchshouldbeconnected.tr(context: context)), .tr(context: context),
LocaleKeys
.unabletodetectapplicationinstalledpleasecomebackonceinstalled
.tr(context: context),
LocaleKeys
.samsungwatchshouldbeconnected
.tr(context: context)),
)); ));
}, },
backgroundColor: AppColors.primaryRedColor.withAlpha(40), backgroundColor:
borderColor: AppColors.primaryRedColor.withAlpha(0), AppColors.primaryRedColor.withAlpha(40),
borderColor:
AppColors.primaryRedColor.withAlpha(0),
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 14.f, fontSize: 14.f,
isBold: true, isBold: true,
@ -147,30 +192,42 @@ class SmartwatchHomePage extends StatelessWidget {
), ),
), ),
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,
borderRadius: 24.r, borderRadius: 24.r,
), ),
child: Column( child: Column(
children: [ children: [
Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/Huawei_Watch.png", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), Utils.buildImgWithAssets(
"Huawei Watch".needTranslation.toText16(isBold: true), 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( CustomButton(
text: LocaleKeys.selectSmartWatch.tr(context: context), text: LocaleKeys.selectSmartWatch
.tr(context: context),
onPressed: () { onPressed: () {
context.read<HealthProvider>().setSelectedWatchType(SmartWatchTypes.huawei, "assets/images/png/smartwatches/Huawei_Watch.png"); // context.read<HealthProvider>().setSelectedWatchType(SmartWatchTypes.huawei, "assets/images/png/smartwatches/Huawei_Watch.png");
getIt.get<NavigationService>().pushPage(page: SmartwatchInstructionsPage( // getIt.get<NavigationService>().pushPage(page: SmartwatchInstructionsPage(
smartwatchDetails: SmartwatchDetails(SmartWatchTypes.huawei, // smartwatchDetails: SmartwatchDetails(SmartWatchTypes.huawei,
"assets/images/png/smartwatches/Huawei_Watch.png", // "assets/images/png/smartwatches/Huawei_Watch.png",
AppAssets.bluetooth, // AppAssets.bluetooth,
LocaleKeys.huaweihealthapplicationshouldbeinstalledinyourphone.tr(context: context), // LocaleKeys.huaweihealthapplicationshouldbeinstalledinyourphone.tr(context: context),
LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), // LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context),
LocaleKeys.huaweiwatchshouldbeconnected.tr(context: context)), // LocaleKeys.huaweiwatchshouldbeconnected.tr(context: context)),
)); // ));
// showUnavailableDialog(context); showUnavailableDialog(context);
}, },
backgroundColor: AppColors.primaryRedColor.withAlpha(40), backgroundColor:
borderColor: AppColors.primaryRedColor.withAlpha(0), AppColors.primaryRedColor.withAlpha(40),
borderColor:
AppColors.primaryRedColor.withAlpha(0),
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 14.f, fontSize: 14.f,
isBold: true, isBold: true,
@ -181,16 +238,26 @@ class SmartwatchHomePage extends StatelessWidget {
), ),
), ),
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,
borderRadius: 24.r, borderRadius: 24.r,
), ),
child: Column( child: Column(
children: [ children: [
Utils.buildImgWithAssets(icon: "assets/images/png/smartwatches/Whoop_Watch.png", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), Utils.buildImgWithAssets(
"Whoop Watch".needTranslation.toText16(isBold: true), 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( CustomButton(
text: LocaleKeys.selectSmartWatch.tr(context: context), text: LocaleKeys.selectSmartWatch
.tr(context: context),
onPressed: () { onPressed: () {
showUnavailableDialog(context); showUnavailableDialog(context);
// context.read<HealthProvider>().setSelectedWatchType(SmartWatchTypes.whoop, "assets/images/png/smartwatches/Whoop_Watch.png"); // context.read<HealthProvider>().setSelectedWatchType(SmartWatchTypes.whoop, "assets/images/png/smartwatches/Whoop_Watch.png");
@ -203,8 +270,10 @@ class SmartwatchHomePage extends StatelessWidget {
// LocaleKeys.whoopwatchshouldbeconnected.tr(context: context)), // LocaleKeys.whoopwatchshouldbeconnected.tr(context: context)),
// )); // ));
}, },
backgroundColor: AppColors.primaryRedColor.withAlpha(40), backgroundColor:
borderColor: AppColors.primaryRedColor.withAlpha(0), AppColors.primaryRedColor.withAlpha(40),
borderColor:
AppColors.primaryRedColor.withAlpha(0),
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 14.f, fontSize: 14.f,
isBold: true, isBold: true,
@ -222,6 +291,7 @@ class SmartwatchHomePage extends StatelessWidget {
), ),
), ),
); );
});
} }
void showUnavailableDialog(BuildContext context) { void showUnavailableDialog(BuildContext context) {
@ -229,7 +299,8 @@ class SmartwatchHomePage extends StatelessWidget {
title: LocaleKeys.notice.tr(context: context), title: LocaleKeys.notice.tr(context: context),
context, context,
child: Utils.getWarningWidget( child: Utils.getWarningWidget(
loadingText: LocaleKeys.featureComingSoonDescription.tr(context: context), loadingText:
LocaleKeys.featureComingSoonDescription.tr(context: context),
isShowActionButtons: false, isShowActionButtons: false,
showOkButton: true, showOkButton: true,
onConfirmTap: () async { onConfirmTap: () async {

@ -24,7 +24,7 @@ class SmartwatchInstructionsPage extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView( body: CollapsingListView(
title: "How does it work".needTranslation, title: "smartwatchHowItWorks".tr(context: context),
bottomChild: Container( bottomChild: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,

Loading…
Cancel
Save