diff --git a/assets/images/pharmacy/offers_banner.png b/assets/images/pharmacy/offers_banner.png new file mode 100644 index 00000000..6eab63fb Binary files /dev/null and b/assets/images/pharmacy/offers_banner.png differ diff --git a/assets/images/pharmacy/offers_banner_ar.png b/assets/images/pharmacy/offers_banner_ar.png new file mode 100644 index 00000000..d987d3c6 Binary files /dev/null and b/assets/images/pharmacy/offers_banner_ar.png differ diff --git a/assets/images/pharmacy_module/offers_banner.png b/assets/images/pharmacy_module/offers_banner.png new file mode 100644 index 00000000..6eab63fb Binary files /dev/null and b/assets/images/pharmacy_module/offers_banner.png differ diff --git a/assets/images/pharmacy_module/offers_banner_ar.png b/assets/images/pharmacy_module/offers_banner_ar.png new file mode 100644 index 00000000..d987d3c6 Binary files /dev/null and b/assets/images/pharmacy_module/offers_banner_ar.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index bbbacaa4..fe92ba99 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -14,8 +14,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -457,6 +457,11 @@ const ADD_RRT_ORDER_RC = "rc/api/rrt/add"; const GET_ALL_RRT_ORDERS_RC = "rc/api/rrt/list"; const UPDATE_RRT_ORDER_RC = 'rc/api/rrt/update'; +// PRESCRIPTION RC SERVICES +const ADD_PRESCRIPTION_ORDER_RC = "rc/api/prescription/add"; +const GET_ALL_PRESCRIPTION_ORDERS_RC = "rc/api/prescription/list"; +const UPDATE_PRESCRIPTION_ORDER_RC = 'rc/api/prescription/update'; + //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4e085e46..f26dccf5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1596,7 +1596,7 @@ const Map localizedValues = { "ios-instructions-2": { "en": "Make sure that your Apple Watch is connected with the Watch & Health Apps.", "ar": "تأكد من اتصال Apple Watch بتطبيقات Watch & Health." }, "ios-instructions-3": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your health app.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق صحتك." }, "supportedWatches": { "en": "Supported SmartWatches", "ar": "الساعات الذكية المدعومة" }, - "watchInstructions": { "en": "Watch Instructions:", "ar": "تعليمات الساعة:" }, + "watchInstructions": { "en": "View watch instructions", "ar": "عرض تعليمات الساعة" }, "monthlyTab": {"en": "Monthly", "ar": "شهري"}, "moreSupportedWatches": {"en": "More Supported Smartwatches...", "ar": "المزيد من الساعات الذكية المدعومة..."}, "android-instructions-1": { "en": "Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.", "ar": "تأكد من تثبيت تطبيقات 'WearOS' و 'Google Fit' من متجر Google PlayStore." }, diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart index c36efe89..104b390d 100644 --- a/lib/core/service/PrescriptionDeliveryService.dart +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -2,13 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class PrescriptionDeliveryService extends BaseService { - Future insertDeliveryOrder( - {int lineItemNo, - double latitude, - double longitude, - int appointmentNo, - int createdBy, - int dischargeID}) async { + Future insertDeliveryOrder({int lineItemNo, double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { hasError = false; Map body = Map(); body['LineItemNo'] = lineItemNo; @@ -17,11 +11,26 @@ class PrescriptionDeliveryService extends BaseService { body['AppointmentNo'] = appointmentNo; body['CreatedBy'] = createdBy; body['DischargeID'] = dischargeID; - await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - var asd=""; - }, - onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + print(error); + super.error = error; + }, body: body); + } + + Future insertDeliveryOrderRC({double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { + hasError = false; + Map body = Map(); + body['latitude'] = latitude; + body['longitude'] = longitude; + body['AppointmentNo'] = appointmentNo; + body['CreatedBy'] = createdBy; + body['DischargeID'] = dischargeID; + await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { hasError = true; print(error); super.error = error; diff --git a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart index 424a4b20..ada4da78 100644 --- a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart +++ b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart @@ -7,15 +7,11 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; class PrescriptionDeliveryViewModel extends BaseViewModel { - CustomerAddressesService _customerAddressesService = - locator(); - PharmacyModuleService _pharmacyModuleService = - locator(); - PrescriptionDeliveryService _prescriptionDeliveryService = - locator(); + CustomerAddressesService _customerAddressesService = locator(); + PharmacyModuleService _pharmacyModuleService = locator(); + PrescriptionDeliveryService _prescriptionDeliveryService = locator(); - List get addressesList => - _customerAddressesService.addressesList; + List get addressesList => _customerAddressesService.addressesList; Future getCustomerInfo() async { setState(ViewState.Busy); @@ -27,28 +23,16 @@ class PrescriptionDeliveryViewModel extends BaseViewModel { if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); - } else { - } + } else {} await getCustomerAddresses(); } - Future insertDeliveryOrder( - {int lineItemNo, - double latitude, - double longitude, - int appointmentNo, - int createdBy, - int dischargeID}) async { - + Future insertDeliveryOrder({int lineItemNo, double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { setState(ViewState.BusyLocal); - await _prescriptionDeliveryService.insertDeliveryOrder( - lineItemNo: lineItemNo, - latitude: latitude, - longitude: longitude, - appointmentNo: appointmentNo, - createdBy: createdBy, - dischargeID: dischargeID - ); + // await _prescriptionDeliveryService.insertDeliveryOrder( + // lineItemNo: lineItemNo, latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, createdBy: createdBy, dischargeID: dischargeID); + await _prescriptionDeliveryService.insertDeliveryOrderRC( + latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, createdBy: createdBy, dischargeID: dischargeID); if (_prescriptionDeliveryService.hasError) { error = _prescriptionDeliveryService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 0c1fafdf..03018878 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -77,7 +77,6 @@ class PrescriptionsViewModel extends BaseViewModel { } getPrescriptionsOrders({bool showLoading = false}) async { - // print(showLoading); setState(ViewState.Busy); Future.delayed(new Duration(milliseconds: 300)).then((value) async { await _prescriptionsService.getPrescriptionsOrders(); diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index facccf1e..27fe3234 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -1,16 +1,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; -import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; //import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; @@ -20,13 +16,11 @@ import '../../../locator.dart'; class PharmacyModuleViewModel extends BaseViewModel { PharmacyModuleService _pharmacyService = locator(); - RecommendedProductService _recommendedProductService = - locator(); + RecommendedProductService _recommendedProductService = locator(); List get bannerList => _pharmacyService.bannerItems; - List get recommendedProductList => - _recommendedProductService.recommendedList; + List get recommendedProductList => _recommendedProductService.recommendedList; Future generatePharmacyToken() async { setState(ViewState.Busy); @@ -40,8 +34,6 @@ class PharmacyModuleViewModel extends BaseViewModel { } Future verifyCustomer() async { - // if (authenticatedUserObject.isLogin) await generatePharmacyToken(); - var data = await sharedPref.getObject(USER_PROFILE); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); @@ -70,11 +62,9 @@ class PharmacyModuleViewModel extends BaseViewModel { Future getBannerList() async { if (bannerList.isEmpty) { - GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); await _pharmacyService.getBannerListList(); - GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_pharmacyService.hasError) { error = _pharmacyService.error; setState(ViewState.Error); @@ -83,9 +73,15 @@ class PharmacyModuleViewModel extends BaseViewModel { } } - List getBannerImagesUrl() { + List getBannerImagesUrl(ProjectViewModel projectViewModel) { List images = List(); images.add('assets/images/pharmacy_module/pharmacy_logo_green.png'); + + if (projectViewModel.isArabic) + images.add('assets/images/pharmacy_module/offers_banner_ar.png'); + else + images.add('assets/images/pharmacy_module/offers_banner.png'); + _pharmacyService.bannerItems.forEach((element) { images.add(element.src); }); diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart index d4dd6efe..986fb848 100644 --- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -171,7 +171,7 @@ class PrescriptionOrderOverview extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(context); await model .insertDeliveryOrder( - lineItemNo: 0, + lineItemNo: 1, longitude: longitude, latitude: latitude, appointmentNo: prescriptions.appointmentNo, diff --git a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart index da82d540..077ed4bf 100644 --- a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart @@ -107,7 +107,11 @@ class _HeartRateTrackerState extends State with SingleTickerPr child: new TabBarView( physics: NeverScrollableScrollPhysics(), children: [ - isWeeklyDataLoaded ? getWeeklyHeartRateDetails() : Container(), + isWeeklyDataLoaded + ? avgWeeklyHearRateValue != 0 + ? getWeeklyHeartRateDetails() + : getNoDataWidget(context) + : Container(), isMonthlyDataLoaded ? getMonthlyHeartRateDetails() : Container(), isYearlyDataLoaded ? getYearlyHeartRateDetails() : Container() ], @@ -135,9 +139,11 @@ class _HeartRateTrackerState extends State with SingleTickerPr weeklyDataLength++; } }); - generateWeekData(); + if (weekyHearRateList.isNotEmpty) generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyHearRateValue ~/ weeklyDataLength; + if (avgWeeklyHearRateValue != 0) { + weeklyStatsAvgValue = avgWeeklyHearRateValue ~/ weeklyDataLength; + } isWeeklyDataLoaded = true; }); }).catchError((err) { 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 index 4fc233db..17d9d8a8 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -9,7 +9,6 @@ import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchI import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -40,19 +39,31 @@ class _SmartWatchInstructionsState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).smartWatches, - isShowAppBar: true, - isShowDecPage: true, - showNewAppBar: true, - showNewAppBarTitle: true, - description: TranslationBase.of(context).infoHealthData, - imagesInfo: [ - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') - ], - body: Container( - child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(), - )); + appBarTitle: TranslationBase.of(context).smartWatches, + isShowAppBar: true, + isShowDecPage: true, + showNewAppBar: true, + showNewAppBarTitle: true, + description: TranslationBase.of(context).infoHealthData, + imagesInfo: [ + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') + ], + body: Container( + child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(), + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 30.0), + child: DefaultButton( + TranslationBase.of(context).continues, + () { + _openHealthDataList(); + }, + color: Color(0xff359846), + ), + ), + ); } _getAppleWatchInstructions() { @@ -61,250 +72,200 @@ class _SmartWatchInstructionsState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Flexible( - 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), + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), + ), + 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 1", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], ), - child: i == 1 - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), - ), - 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Apple Watch Series 1", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Apple Watch Series 2", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Apple Watch Series 3", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Apple Watch Series 4", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Apple Watch Series 5", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Apple Watch Series 6", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Mi Band 3", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 30.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Container( - margin: EdgeInsets.fromLTRB(15.0, 40.0, 15.0, 0.0), - child: DefaultButton( - TranslationBase.of(context).continues, - () { - buttonCarouselController.nextPage(); - }, - color: Color(0xff359846), - ), - ), - ], - ) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).watchInstructions, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).iosInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).iosInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Text(TranslationBase.of(context).iosInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), - ), - Padding( - padding: const EdgeInsets.fromLTRB(12.0, 50.0, 12.0, 20.0), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).syncHealthData, - () {}, - color: Color(0xFFD02127), - disabledColor: Color(0xff28323A).withOpacity(0.3), - ), - ), - mWidth(12), - if (hasAlreadySynced) - Expanded( - child: DefaultButton( - TranslationBase.of(context).alreadySynced, - () { - _openHealthDataList(); - }, - color: Color(0xff359846), - ), - ), - ], - ), - ), - ], + ), + ), + 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 2", overflow: TextOverflow.clip, 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 3", overflow: TextOverflow.clip, 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 4", overflow: TextOverflow.clip, 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 5", overflow: TextOverflow.clip, 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 6", overflow: TextOverflow.clip, 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, 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), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), ), - )); + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 30.0, 10.0, 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + InkWell( + onTap: () { + showInstructionsDialog(); }, - ); - }).toList(), + child: Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ), + ], ), - ) + ), ], ), ); @@ -312,204 +273,245 @@ class _SmartWatchInstructionsState extends State { _getGoogleWatchInstructions() { return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: CarouselSlider( - carouselController: buttonCarouselController, - options: CarouselOptions( - // enableInfiniteScroll: true, - viewportFraction: 0.99, - 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.only(top: 16.0, bottom: 8.0), - // fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white.withOpacity(1.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + child: Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), + ), + 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Huawei Watch 2", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mobovi TicWatch E2", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Huawei Watch", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Fossil Sport", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("MisFit Vapor 2", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("LG Watch Sport", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, 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( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, 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(TranslationBase.of(context).moreSupportedWatches, style: TextStyle(fontSize: 14.0, color: Colors.blue, decoration: TextDecoration.underline, letterSpacing: -0.36)), + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + InkWell( + onTap: () { + showInstructionsDialog(); + }, + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ), + ], + ), + ), + ); + } + + showInstructionsDialog() { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 350.0, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(TranslationBase.of(context).smartWatches, style: TextStyle(fontSize: 22.0, color: Colors.black, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + IconButton( + icon: Icon( + Icons.close, + color: Colors.black, + ), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), ), - child: i == 1 + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Platform.isIOS ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), - ), - 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Huawei Watch 2", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Mobovi TicWatch E2", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Huawei Watch", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Fossil Sport", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("MisFit Vapor 2", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("LG Watch Sport", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Mi Band 3", overflow: TextOverflow.clip, 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( - width: MediaQuery.of(context).size.width * 0.22, - child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - InkWell( - onTap: () { - launch("https://wearos.google.com/#find-your-watch"); - }, - child: Container( - margin: EdgeInsets.only(top: 20.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).moreSupportedWatches, - textAlign: TextAlign.center, style: TextStyle(fontSize: 14.0, color: Colors.blue, decoration: TextDecoration.underline, letterSpacing: -0.36)), - ), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).iosInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).iosInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(15.0), - child: DefaultButton( - TranslationBase.of(context).continues, - () { - buttonCarouselController.nextPage(); - }, - color: CustomColors.green, - ), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 21.0), + child: Text(TranslationBase.of(context).iosInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), ], ) @@ -517,114 +519,37 @@ class _SmartWatchInstructionsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).watchInstructions, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.34)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.34)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).androidInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.34)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).androidInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.34)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions4, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), - Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).androidInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.34)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).androidInstructions4, style: TextStyle(fontSize: 14.0, letterSpacing: -0.34)), - ), - Padding( - padding: const EdgeInsets.fromLTRB(12.0, 50.0, 12.0, 20.0), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).syncHealthData, - () {}, - color: Color(0xFFD02127), - disabledColor: Color(0xff28323A).withOpacity(0.3), - ), - ), - mWidth(12), - if (hasAlreadySynced) - Expanded( - child: DefaultButton( - TranslationBase.of(context).alreadySynced, - () { - _openHealthDataList(); - }, - color: Color(0xff359846), - ), - ), - ], - ), - ), - // Container( - // margin: EdgeInsets.fromLTRB(15.0, 75.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, - // elevation: 0, - // 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, - // elevation: 0, - // disabledTextColor: Colors.white, - // disabledColor: new Color(0xFFbcc2c4), - // onPressed: () { - // _openHealthDataList(); - // }, - // child: Text("ALREADY SYNCED", style: TextStyle(fontSize: 18.0)), - // ), - // ), - // ) - // : Container(), ], ), - )); - }, - ); - }).toList(), + ], + ), + ), + ], + ), + ), ), - ) - ], - ), - ); + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); } getLastPatientRecord(BuildContext context) { diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 454b391c..c805144c 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -50,10 +50,8 @@ class _PharmacyPageState extends State { width: double.infinity, child: SingleChildScrollView( child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - GridViewButtons(model), PrescriptionsWidget(), ShopByBrandWidget(), RecentlyViewedWidget(), diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 6f1155dd..6302f263 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -1,10 +1,15 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewCard.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class BannerPager extends StatefulWidget { final PharmacyModuleViewModel _model; @@ -20,14 +25,16 @@ class _BannerPagerState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( child: Column( children: [ CarouselSlider( options: CarouselOptions( - aspectRatio: 7 / 2, + aspectRatio: 5 / 2, enlargeCenterPage: true, enableInfiniteScroll: false, + viewportFraction: 1.0, initialPage: 0, autoPlay: true, autoPlayInterval: Duration(seconds: 3), @@ -39,53 +46,44 @@ class _BannerPagerState extends State { }); }, ), - items: widget._model - .getBannerImagesUrl() - .mapIndexed( - (item, index) => InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: OffersCategorisePage())); - }, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 1.0), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5.0)), - child: Center( - child: index == 0 - ? Image.asset( - item, - fit: BoxFit.cover, - ) - : CachedNetworkImage( - imageUrl: item, - fit: BoxFit.fitWidth, - errorWidget: (context, url, error) => - SizedBox()), - ), + items: widget._model.getBannerImagesUrl(projectViewModel).mapIndexed( + (item, index) { + return InkWell( + onTap: () { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 1.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Center( + child: index == 0 || index == 1 + ? Image.asset( + item, + fit: BoxFit.cover, + ) + : CachedNetworkImage(imageUrl: item, fit: BoxFit.fitWidth, errorWidget: (context, url, error) => SizedBox()), ), ), ), - ) - .toList(), + ); + }, + ).toList(), ), Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: widget._model - .getBannerImagesUrl() + .getBannerImagesUrl(projectViewModel) .mapIndexed( (item, index) => Container( width: 12.0, height: 4.0, - margin: - EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), + margin: EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), decoration: BoxDecoration( shape: BoxShape.rectangle, - color: _current == index - ? Color.fromRGBO(0, 250, 0, 0.9) - : Color.fromRGBO(0, 0, 0, 0.4), + color: _current == index ? Color.fromRGBO(0, 250, 0, 0.9) : Color.fromRGBO(0, 0, 0, 0.4), ), ), ) diff --git a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart index 1a33ce74..8a549b48 100644 --- a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart +++ b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart @@ -39,44 +39,44 @@ class GridViewButtons extends StatelessWidget { Navigator.push(context, FadePage(page: OffersCategorisePage())); }), ), - DashboardItem( - imageName: 'pharmacy_module/bg_2.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).medicationRefill, - 'assets/images/pharmacy_module/medication_icon.png', () { - Navigator.push( - context, FadePage(page: HomePrescriptionsPage())); - - // model.checkUserIsActivated().then((isActivated) { - // if (isActivated) { - // Navigator.push(context, FadePage(page: LakumMainPage())); - // } else { - // Navigator.push( - // context, FadePage(page: LakumActivationVidaPage())); - // } - // }); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_3.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).myPrescriptions, - 'assets/images/pharmacy_module/prescription_icon.png', () { - Navigator.push( - context, FadePage(page: HomePrescriptionsPage())); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_4.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard( - TranslationBase.of(context).searchAndScanMedication, - 'assets/images/pharmacy_module/search_scan_icon.png', - () {Navigator.push(context, FadePage(page: SearchProductsPage()));}), - ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_2.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard(TranslationBase.of(context).medicationRefill, + // 'assets/images/pharmacy_module/medication_icon.png', () { + // Navigator.push( + // context, FadePage(page: HomePrescriptionsPage())); + // + // // model.checkUserIsActivated().then((isActivated) { + // // if (isActivated) { + // // Navigator.push(context, FadePage(page: LakumMainPage())); + // // } else { + // // Navigator.push( + // // context, FadePage(page: LakumActivationVidaPage())); + // // } + // // }); + // }), + // ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_3.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard(TranslationBase.of(context).myPrescriptions, + // 'assets/images/pharmacy_module/prescription_icon.png', () { + // Navigator.push( + // context, FadePage(page: HomePrescriptionsPage())); + // }), + // ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_4.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard( + // TranslationBase.of(context).searchAndScanMedication, + // 'assets/images/pharmacy_module/search_scan_icon.png', + // () {Navigator.push(context, FadePage(page: SearchProductsPage()));}), + // ), ], ), ),