diff --git a/android/app/build.gradle b/android/app/build.gradle index f13bce1b..25230849 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -112,5 +112,8 @@ dependencies { implementation "com.opentok.android:opentok-android-sdk:2.19.1" + compile 'com.facebook.stetho:stetho:1.5.1' + implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' + } diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt index 0708653a..a9c5ea88 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt @@ -1,16 +1,40 @@ //package com.cloud.diplomaticquarterapp package com.ejada.hmg +import com.facebook.stetho.Stetho import io.flutter.app.FlutterApplication import io.flutter.plugin.common.PluginRegistry import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback -import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService class Application : FlutterApplication(), PluginRegistrantCallback { override fun onCreate() { super.onCreate() FlutterFirebaseMessagingService.setPluginRegistrant(this) + +// Stetho.initializeWithDefaults(this); + // Create an InitializerBuilder + // Create an InitializerBuilder + val initializerBuilder = Stetho.newInitializerBuilder(this) + + + // Enable Chrome DevTools + initializerBuilder.enableWebKitInspector( + Stetho.defaultInspectorModulesProvider(this) + ) + + // Enable command line interface + initializerBuilder.enableDumpapp( + Stetho.defaultDumperPluginsProvider(this) + ) + + + // Use the InitializerBuilder to generate an Initializer + val initializer = initializerBuilder.build() + + + // Initialize Stetho with the Initializer + Stetho.initialize(initializer) } override fun registerWith(registry: PluginRegistry) { diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt index 0cdc3751..d53d6f9a 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt @@ -5,8 +5,10 @@ import android.os.Handler import android.os.Looper import android.util.Log import android.view.ViewGroup +import com.facebook.stetho.urlconnection.StethoURLConnectionManager import com.opentok.android.* import io.flutter.embedding.engine.FlutterEngine +import io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel @@ -21,7 +23,7 @@ enum class OpenTokSDKState { class OpenTok(private var context: Context, private var flutterEngine: FlutterEngine){ private lateinit var remoteVideoPlatformView: RemoteVideoPlatformView private lateinit var localVideoPlatformView: LocalVideoPlatformView - + init { remoteVideoPlatformView = RemoteVideoFactory.getViewInstance(context) flutterEngine diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 549f5592..565b2db9 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -450,6 +450,10 @@ PODS: - TOCropViewController (~> 2.5.4) - image_picker (0.0.1): - Flutter + - in_app_review (0.2.0): + - Flutter + - in_app_update (0.0.1): + - Flutter - just_audio (0.0.1): - Flutter - leveldb-library (1.22) @@ -579,6 +583,8 @@ DEPENDENCIES: - huawei_map (from `.symlinks/plugins/huawei_map/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) + - in_app_review (from `.symlinks/plugins/in_app_review/ios`) + - in_app_update (from `.symlinks/plugins/in_app_update/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) - location (from `.symlinks/plugins/location/ios`) @@ -719,6 +725,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/image_cropper/ios" image_picker: :path: ".symlinks/plugins/image_picker/ios" + in_app_review: + :path: ".symlinks/plugins/in_app_review/ios" + in_app_update: + :path: ".symlinks/plugins/in_app_update/ios" just_audio: :path: ".symlinks/plugins/just_audio/ios" local_auth: @@ -843,6 +853,8 @@ SPEC CHECKSUMS: huawei_map: 34fbad9c274ea78a4151487c9ebe27f1887777e7 image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + in_app_review: 4a97249f7a2f539a0f294c2d9196b7fe35e49541 + in_app_update: 16e877e205f4360264cb536e3a6481f0d90299e1 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437 diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 21ff8632..7f77d115 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1290,7 +1290,7 @@ const Map localizedValues = { "pay-options": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "livecare-service": {"en": "LiveCare Service", "ar": "خدمة لايف كير"}, "livecare-service-desc": {"en": "is to obtain medical advice with a specialist doctor Via a video call", "ar": "هي الحصول على استشارة طبية مع طبيب مختص عن طريق اتصال فيديو"}, - "why-livecare": {"en": "WHY LIVECARE", "ar": "لماذا خدمة اللايف كير"}, + "why-livecare": {"en": "Why LiveCare?", "ar": "?لماذا خدمة اللايف كير"}, "livecare-point-1": {"en": "No need to wait you will get Medical consultation immediately via Video call", "ar": "لا داعي للانتظار سوف تحصل على الاستشارة الطبية فورا عن طريق مكالمة الفيديو"}, "doc-virtual-appo-ins4": {"en": "The doctor will see your medical file", "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كامل"}, "doc-virtual-appo-ins5": {"en": "Free prescription delivery service", "ar": "خدمة توصيل الادوية مجانا"}, @@ -1298,7 +1298,7 @@ const Map localizedValues = { "en": "** The service is included with some insurance companies according to the terms and conditions with our best wishes for health and wellness", "ar": "** الخدمة مشمولة لدى بعض شركات التامين على حسب الشروط والاحكام مع تمنياتنا لكم بدوام الصحة والعافية" }, - "livecare-option-1": {"en": "Get Medical consultation immediately", "ar": "الحصول على الاستشارة فورا"}, + "livecare-option-1": {"en": "Get consultation immediately", "ar": "الحصول على الاستشارة فورا"}, "livecare-option-2": {"en": "Instant video call", "ar": "اتصال فيديو فوري"}, "livecare-option-3": {"en": "Book Appointment", "ar": "حجز موعد"}, "livecare-option-4": {"en": "Schedule video call", "ar": "اتصال فيديو مجدول"}, diff --git a/lib/core/service/packages_offers/PackagesOffersServices.dart b/lib/core/service/packages_offers/PackagesOffersServices.dart index dbc32029..46e042a4 100644 --- a/lib/core/service/packages_offers/PackagesOffersServices.dart +++ b/lib/core/service/packages_offers/PackagesOffersServices.dart @@ -224,16 +224,17 @@ class OffersAndPackagesServices extends BaseService { // -------------------- // Shopping Cart // -------------------- - Future> cartItems({@required BuildContext context, bool showLoading = true}) async{ + Future> cartItems({@required BuildContext context, bool showLoading = true}) async{ Future errorThrow; cartItemList.clear(); _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/${customer.id}'; + Map jsonResponse; await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); - var jsonResponse = json.decode(stringResponse); + jsonResponse = json.decode(stringResponse); jsonResponse['shopping_carts'].forEach((json) { cartItemList.add(PackagesCartItemsResponseModel.fromJson(json)); }); @@ -244,7 +245,7 @@ class OffersAndPackagesServices extends BaseService { errorThrow = Future.error({"error":error, "statusCode":statusCode}); }, queryParams: null); - return errorThrow ?? cartItemList; + return errorThrow ?? jsonResponse; } Future> addProductToCart(AddProductToCartRequestModel request, {@required BuildContext context, bool showLoading = true}) async{ diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart index 86a320e6..420ec1fa 100644 --- a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -14,7 +14,7 @@ class PrescriptionViewModel extends BaseViewModel { getPrescription() async { await getSavedLanguage(); - if(prescriptionsList.isNotEmpty){ + if(prescriptionsList.isEmpty){ setState(ViewState.Busy); await _prescriptionService.getPrescription(); if (_prescriptionService.hasError) { diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index ccee254b..542c1c23 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -70,15 +70,6 @@ class _PaymentMethodState extends State { padding: EdgeInsets.all(7.0), child: Image.asset("assets/images/new/payment/Mada.png"), ), - // mWidth(12), - // Text( - // "Mada", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "MADA") Container( diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 7fcfecae..4714c208 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; @@ -236,7 +237,7 @@ class _HomePageFragment2State extends State { ), FlatButton( onPressed: () { - Navigator.push(context, FadePage(page: AllHabibMedicalService())); + Navigator.push(context, FadePage(page: AllHabibMedicalSevicePage2())); }, child: Text( TranslationBase.of(context).viewAllServices, diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 6ae272e2..aa6f0d1c 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -4,10 +4,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; @@ -146,9 +145,7 @@ class _LandingPagePharmacyState extends State { try { String barcode = result; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient() - .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", - onSuccess: (dynamic response, int statusCode) { + await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); @@ -158,8 +155,7 @@ class _LandingPagePharmacyState extends State { AppToast.showErrorToast(message: "Product not found"); }); } catch (apiEx) { - AppToast.showErrorToast( - message: "Something went wrong, please try again"); + AppToast.showErrorToast(message: "Something went wrong, please try again"); } } catch (barcodeEx) {} } diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index f91121e3..b0150c03 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingRequest.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; @@ -62,7 +60,24 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt body: Container( child: Column(children: [ TabBar( - labelColor: Colors.black, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), tabs: [ Tab( child: Text( @@ -87,7 +102,6 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt ), ), ], - controller: _tabController, ), Expanded( child: TabBarView( diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 85bae24b..e07c5615 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -28,188 +29,71 @@ class _LiveCareTypeSelectState extends State { showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).livecare.toUpperCase(), - // appBar: AppBar( - // leading: InkWell( - // onTap: () { - // Navigator.pop(context, null); - // }, - // child: Icon( - // Icons.close, - // color: Colors.white, - // ), - // ), - // title: Text(TranslationBase.of(context).bookAppo, - // style: TextStyle(color: Colors.white)), - // ), body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).livecareService, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 15.0, bottom: 10.0), - child: Image.asset( - languageID == 'ar' - ? "assets/images/new-design/liveCare_ar_bg.png" - : "assets/images/new-design/liveCare_en_bg.png", - width: 120), - ), - Container( - alignment: Alignment.center, - child: Text(TranslationBase.of(context).livecareService, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), - Container( - margin: EdgeInsets.only(top: 0.0), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).livecareServiceDesc, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18.0))), + margin: EdgeInsets.only(top: 7.0), + child: Text(TranslationBase.of(context).livecareServiceDesc, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(TranslationBase.of(context).whyLivecare, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).whyLivecare, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.only(top: 0.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).livecarePoint1, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(TranslationBase.of(context).livecarePoint1, + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns4, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns5, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 10.0), - child: Text( - TranslationBase.of(context).livecareSummary, - style: TextStyle(fontSize: 12.0))), - InkWell( - onTap: (){ - Navigator.pop(context, "immediate"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.red[900], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 100.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon_white.svg", - width: 80), - ), - Container( - width: MediaQuery.of(context).size.width * 0.56, - margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(TranslationBase.of(context).livecareOption1, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - Container( - margin: EdgeInsets.only(top: 0.0), - child: Text(TranslationBase.of(context).livecareOption2, textAlign: TextAlign.start, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), - ), - InkWell( - onTap: (){ - Navigator.pop(context, "schedule"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[600], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 100.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Image.asset( - "assets/images/new-design/calendar.png", - width: 60), - ), - Container( - width: MediaQuery.of(context).size.width * 0.53, - margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), - child: Column( - children: [ - Container( - child: Text(TranslationBase.of(context).livecareOption3, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).livecareOption4, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).livecareSummary, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), + + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 40.0), + shrinkWrap: true, + children: [ + _loginOptionButton(TranslationBase.of(context).livecareOption1, 'assets/images/new/Live_Care.svg', 1), + _loginOptionButton(TranslationBase.of(context).livecareOption4, 'assets/images/new/book appointment.svg', 2), + ], ), SizedBox( height: 40.0, @@ -221,6 +105,44 @@ class _LiveCareTypeSelectState extends State { ); } + Widget _loginOptionButton(String _title, String _icon, int _loginIndex) { + return InkWell( + onTap: () { + if (_loginIndex == 1) { + Navigator.pop(context, "immediate"); + } else { + Navigator.pop(context, "schedule"); + } + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: _loginIndex == 1 ? 60 : 50, + width: _loginIndex == 1 ? 60 : 50, + ), + Text( + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); + } + getLanguageID() async { var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 6a7573d7..49337ee4 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; @@ -14,11 +15,7 @@ class ClinicCard extends StatefulWidget { var languageID; int isOnline; - ClinicCard( - {this.isSelected, - this.languageID, - this.isOnline, - @required this.patientERGetClinicsList}); + ClinicCard({this.isSelected, this.languageID, this.isOnline, @required this.patientERGetClinicsList}); @override _State createState() => _State(); @@ -35,90 +32,69 @@ class _State extends State { @override Widget build(BuildContext context) { - return Row( - children: [ - Card( - margin: EdgeInsets.fromLTRB(15.0, 10.0, 8.0, 8.0), - color: widget.isSelected ? Color(0xff06b806) : widget.patientERGetClinicsList.isOnline == 1 ? Colors.white : Colors.grey, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + return Container( + width: double.infinity, + margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - child: Container( - width: MediaQuery.of(context).size.width * 0.75, - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ + border: Border.all(width: 2, color: widget.isSelected ? CustomColors.green : Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Container( + padding: EdgeInsets.fromLTRB(12.0, 25.0, 12.0, 25.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text(widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16)), + ), + Row( + children: [ Container( - child: Text( - widget.languageID == 'ar' - ? widget.patientERGetClinicsList.serviceNameN - : widget.patientERGetClinicsList.serviceName, - style: TextStyle( - fontSize: 16.0, - color: - widget.isSelected ? Colors.white : Colors.black)), + child: Text(".", style: TextStyle(fontSize: 30.0)), + ), + Container( + child: Text("Online"), ), ], ), - ), - ), - InkWell( - onTap: () { - getClinicTimings(widget.patientERGetClinicsList); - }, - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - child: Container( - padding: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Icon(Icons.access_time, size: 26.0, color: Colors.red[800]), - ], - ), - ), - ), + ], ), - ], + ), ); } getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getLivecareClinicTiming(patientERGetClinicsList.serviceID, context) - .then((res) { + service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - clinicsServiceTimingsResponse = - ClinicsServiceTimingsResponse.fromJson(res); - print(clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList.length); + clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res); + print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList.length); showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { - final curvedValue = - Curves.easeInOutBack.transform(a1.value) - 1.0; + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; return Transform( - transform: - Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), child: Opacity( opacity: a1.value, child: ClinicTimingsDialog( clinicName: patientERGetClinicsList.serviceName, - patientERGetClinicsServiceTimingsList: - clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList, + patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, ), ), ); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index afb41ea2..9a463150 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -76,11 +76,8 @@ class _clinic_listState extends State { if (LiveCareHome.isLiveCareTypeSelected != true) { openLiveCareSelectionDialog(); } else { - print("LiveCare Type Selected"); setState(() { currentSelectedLiveCareType = "immediate"; - // isDataLoaded = true; - // print(liveCareOnlineClinicsListResponse.length); getLiveCareClinicsList(); }); } @@ -440,33 +437,35 @@ class _clinic_listState extends State { isDataLoaded ? Container( height: MediaQuery.of(context).size.height * 0.7, - child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); - }, - child: ScheduleClinicCard( - isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, - clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], - languageID: languageID, + child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); + }, + child: ScheduleClinicCard( + isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, + clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], + languageID: languageID, + ), + ); + }, ), - ); - }, - ), - Container( - height: 10.0, - ), - ], - ): getNoDataWidget(context), + Container( + height: 10.0, + ), + ], + ) + : getNoDataWidget(context), ) : Container(), isDataLoaded @@ -509,16 +508,11 @@ class _clinic_listState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Text(TranslationBase.of(context).onlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - // itemCount: liveCareClinicsListResponse.patientERGetClinicsList.length, + padding: const EdgeInsets.only(top: 16.0), itemCount: liveCareOnlineClinicsListResponse.length, itemBuilder: (context, index) { return InkWell( @@ -533,10 +527,10 @@ class _clinic_listState extends State { ); }, ), - Container( - margin: EdgeInsets.all(15.0), - child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), + // Container( + // margin: EdgeInsets.all(15.0), + // child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + // ), ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 08df2e6c..1903e561 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -12,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -21,6 +23,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -34,13 +37,12 @@ import 'package:intl/intl.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/pages/login/register_new.dart'; class ConfirmLogin extends StatefulWidget { final Function changePageViewIndex; + const ConfirmLogin({Key key, this.changePageViewIndex}) : super(key: key); + @override _ConfirmLogin createState() => _ConfirmLogin(); } @@ -640,15 +642,14 @@ class _ConfirmLogin extends State { if (result.isNeedUserAgreement == true) { //move to agreement page. } else { - insertIMEI(); + goToHome(); } } insertIMEI() { - authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}).catchError((err) { + authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { print(err); }); - // authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); } getToDoCount() { @@ -670,7 +671,7 @@ class _ConfirmLogin extends State { projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - getToDoCount(); + // getToDoCount(); appointmentRateViewModel .getIsLastAppointmentRatedList() @@ -694,13 +695,12 @@ class _ConfirmLogin extends State { page: LandingPage(), ), (r) => false) - } + }, + insertIMEI() }) .catchError((err) { print(err); - //GifLoaderDialogUtils.hideDialog(context); }); - // SMSOTP.showLoadingDialog(context, false), } loading(flag) { @@ -752,37 +752,6 @@ class _ConfirmLogin extends State { ), ), ); - - // return InkWell( - // onTap: () { - // if (_flag == 0) { - // setState(() { - // isMoreOption = true; - // }); - // } else { - // authenticateUser(4, isActive: _loginIndex); - // } - // }, - // child: RoundedContainer( - // height: 150, - // borderColor: Colors.grey, - // showBorder: true, - // child: Padding( - // padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - // child: Column( - // children: [ - // Image.asset( - // _icon, - // height: SizeConfig.imageSizeMultiplier * 13, - // width: SizeConfig.imageSizeMultiplier * 16, - // ), - // SizedBox( - // height: 20, - // ), - // Texts(_title, fontSize: SizeConfig.textMultiplier * 2, color: Colors.black) - // ], - // ), - // ))); } // todo 'sikander' optimize this after knowing usage diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 727cea23..310e2c35 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompleted import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesCartItemCard.dart'; @@ -36,6 +37,8 @@ class _PackagesCartPageState extends State languageID = await sharedPref.getString(APP_LANGUAGE); } + double subtotal,tax, total; + @override void initState() { _agreeTerms = false; @@ -145,6 +148,9 @@ class _PackagesCartPageState extends State .catchError((error) { utils.Utils.showErrorToast(error); }); + if(response.status){ + fetchData(); + } return response.status ?? false; }, )); @@ -170,9 +176,10 @@ class _PackagesCartPageState extends State width: 100, color: Colors.grey[300], ), - _paymentOptions(context, (paymentMethod) { - setState(() => _selectedPaymentMethod = paymentMethod); - }), + Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12.0), + child: getPaymentMethods(), + ), Container( height: 0.25, color: Colors.grey[300], @@ -186,7 +193,7 @@ class _PackagesCartPageState extends State height: 0.25, color: Colors.grey[300], ), - _payNow(context, onPayNowClick: onPayNowClick) + _payNow(context, subtotal: subtotal, tax: tax, total: total, onPayNowClick: onPayNowClick) ], ), ) @@ -197,7 +204,12 @@ class _PackagesCartPageState extends State } fetchData() async { - await viewModel.service.cartItems(context: context).catchError((error) {}); + await viewModel.service.cartItems(context: context).then((value){ + subtotal = value['subtotal'] ?? 0.0; + tax = value['tax'] ?? 0.0; + total = value['total'] ?? 0.0; + }).catchError((error) {}); + setState(() {}); } @@ -335,9 +347,13 @@ Widget _termsAndCondition(BuildContext context, ); } -Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { +Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) { bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null)); + String _subtotal = (subtotal ?? 0.0).toStringAsFixed(2); + String _tax = (tax ?? 0.0).toStringAsFixed(2); + String _total = (total ?? 0).toStringAsFixed(2); + return Padding( padding: const EdgeInsets.all(5), child: Container( @@ -350,13 +366,13 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - '${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}', + '${TranslationBase.of(context).subtotal}: $_subtotal ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8), Texts( - '${TranslationBase.of(context).vat}: ${'14.9'} ${TranslationBase.of(context).sar}', + '${TranslationBase.of(context).vat}: $_tax ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, @@ -370,7 +386,7 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { ), ), Texts( - '${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}', + '${TranslationBase.of(context).total}: $_total ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index 09c39f3d..f81b3ef0 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -23,7 +22,10 @@ import 'package:provider/provider.dart'; import 'cart-page/cart-order-preview.dart'; class CartOrderPage extends StatefulWidget { - const CartOrderPage({Key key}) : super(key: key); + + final Function(int) changeTab; + + const CartOrderPage({Key key, this.changeTab}) : super(key: key); @override _CartOrderPageState createState() => _CartOrderPageState(); @@ -36,6 +38,7 @@ class _CartOrderPageState extends State { void initState() { super.initState(); getData(); + } @override @@ -46,10 +49,9 @@ class _CartOrderPageState extends State { final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; AppScaffold appScaffold; return NetworkBaseView( - // baseViewModel: model, isLoading: isLoading, isLocalLoader: true, - child: AppScaffold( + child: appScaffold = AppScaffold( appBarTitle: TranslationBase.of(context).shoppingCart, isShowAppBar: true, isPharmacy: true, @@ -202,13 +204,12 @@ class _CartOrderPageState extends State { indent: 0, endIndent: 0, ), - getPaymentMethods(), -// Image.asset( -// "assets/images/pharmacy_module/payment.png", -// width: mediaQuery.size.width - 20, -// height: 30.0, -// fit: BoxFit.scaleDown, -// ), + Image.asset( + "assets/images/pharmacy_module/payment.png", + width: mediaQuery.size.width - 20, + height: 30.0, + fit: BoxFit.scaleDown, + ), SizedBox( height: 120, ) @@ -294,7 +295,7 @@ class _OrderBottomWidgetState extends State { Container( height: widget.height * 0.070, color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.only(left: 15.0, right: 15.0), child: Row( children: [ InkWell( @@ -354,7 +355,8 @@ class _OrderBottomWidgetState extends State { ), Container( height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + padding: EdgeInsets.only(left: 20.0, right: 20.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -399,32 +401,27 @@ class _OrderBottomWidgetState extends State { onPressed: isAgree // && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { - if (cart.isCartItemsOutOfStock()) - { - // Toast msg - AppToast.showErrorToast( - message: TranslationBase.of(context) - .outOfStockMsg) - } - else - { - Navigator.push( - context, - FadePage( - page: OrderPreviewPage( - widget.addresses))) - } - } + if(cart.isCartItemsOutOfStock()){ + // Toast msg + AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg) + }else { + Navigator.push( + context, + FadePage( + page: + OrderPreviewPage(widget.addresses))) + } + } : null, child: new Text( "${TranslationBase.of(context).checkOut}", style: new TextStyle( color: - isAgree ? Colors.white : Colors.grey.shade300, + isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), color: Color(0xFF4CAF50), - disabledColor: Color(0xFF4CAF50), + disabledColor:Color(0xFF4CAF50), // disabledColor: Color(0xff005aff), ) // RaisedButton( diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 19286b6a..ca8222ac 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -10,8 +11,6 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../../locator.dart'; import '../../../../../routes.dart'; -import '../../cart-page/cart-order-page.dart'; -import '../product-detail.dart'; class FooterWidget extends StatefulWidget { final bool isAvailable; @@ -26,13 +25,8 @@ class FooterWidget extends StatefulWidget { int quantity; bool isOverQuantity; - FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item, - {this.quantity, - this.isOverQuantity = false, - this.addToCartFunction, - this.addToShoppingCartFunction, - this.model}); + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, + {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model}); @override _FooterWidgetState createState() => _FooterWidgetState(); @@ -41,8 +35,7 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { @@ -77,8 +70,7 @@ class _FooterWidgetState extends State { padding: const EdgeInsets.all(8.0), child: Text( "Quantity", - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), ), ), InkWell( @@ -101,11 +93,7 @@ class _FooterWidgetState extends State { SizedBox( width: 5, ), - for (int i = 1; i <= 10; i++) - QuantityBox( - label: i, - onTapFunc: onChangeValue, - isSelected: widget.quantity == i), + for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), Container( width: 100, decoration: BoxDecoration( @@ -113,16 +101,14 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration( - labelText: ' Quantity # '), + decoration: InputDecoration(labelText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; } else { setState(() { widget.quantity = int.parse(text); - if (widget.quantity >= - widget.quantityLimit) { + if (widget.quantity >= widget.quantityLimit) { widget.isOverQuantity = true; } else { widget.isOverQuantity = false; @@ -187,20 +173,14 @@ class _FooterWidgetState extends State { width: MediaQuery.of(context).size.width * 0.45, child: SecondaryButton( label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity == 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, - disableColor: Color(0xFF4CAF50), + disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, onTap: () async { if (!authenticatedUserObject.isLogin) { Navigator.of(context).pushNamed( WELCOME_LOGIN, ); } else - await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); }, fontWeight: FontWeight.w600, borderColor: Color(0xFF4CAF50), @@ -215,14 +195,9 @@ class _FooterWidgetState extends State { width: MediaQuery.of(context).size.width * 0.35, child: SecondaryButton( label: TranslationBase.of(context).buyNow.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, + disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, onTap: () async { - await widget.addToShoppingCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); Navigator.push( context, FadePage(page: CartOrderPage()), @@ -232,11 +207,7 @@ class _FooterWidgetState extends State { borderColor: Colors.grey[800], borderRadius: 3, disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null - ? Colors.grey - : Colors.grey[800], + color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null ? Colors.grey : Colors.grey[800], ), ), ], diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index 6dc571d6..a9e2a66c 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -12,7 +13,6 @@ import 'package:provider/provider.dart'; import '../../../../../locator.dart'; import '../../../compare-list.dart'; -import '../../cart-page/cart-order-page.dart'; import 'icon_with_bg.dart'; class ProductAppBar extends StatelessWidget with PreferredSizeWidget { diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 28556679..fe8ca977 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_h import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -27,30 +25,21 @@ class PrescriptionsWidget extends StatelessWidget { isLocalLoader: true, baseViewModel: model, child: Container( - height: model.prescriptionsList.length > 0 - ? MediaQuery.of(context).size.height * 0.28 - : 0, child: Column( children: [ - ViewAllHomeWidget( - TranslationBase.of(context).myPrescription, - HomePrescriptionsPage()), + ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 14.0), - margin: EdgeInsets.only(left: 10), + margin: EdgeInsets.only(right: 10.0, left: 10.0), + height: MediaQuery.of(context).size.height * 0.18, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), itemCount: model.prescriptionsList.length, itemBuilder: (context, index) { return Container( - height: MediaQuery.of(context).size.height * 0.3, - padding: EdgeInsets.only( - bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), + padding: EdgeInsets.only(left: 8.0, right: 8.0), + margin: EdgeInsets.only(right: 5.0, left: 5.0), decoration: BoxDecoration( border: Border.all( color: Colors.grey, @@ -59,167 +48,130 @@ class PrescriptionsWidget extends StatelessWidget { ), color: Colors.white, borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( children: [ - Row( - children: [ - Column(children: [ - Container( - padding: EdgeInsets.only( - top: 10.0, - left: 10.0, - right: 10.0, - bottom: 15.0, - ), - child: CircleAvatar( - radius: 30, - backgroundColor: - Colors.transparent, - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, - ), - ), + Column(children: [ + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 10.0, + bottom: 15.0, + ), + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index].doctorImageURL, + width: 60, + height: 60, ), - ]), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 1), - padding: EdgeInsets.only( - left: 15.0, right: 15.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0, - ), - color: Colors.green, - borderRadius: - BorderRadius.circular( - 30.0)), - child: Text( - model.languageID == "ar" - ? model - .prescriptionsList[ - index] - .isInOutPatientDescriptionN - .toString() - : model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - ), - )), - Row(children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, - ), - Text( - DateUtil.convertStringToDate( - model - .prescriptionsList[ - index] - .appointmentDate - .toString()) - .toString() - .substring(0, 10), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - ), - ) - ]), - ], ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ + ), + ]), + Column( + children: [ Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - Text( - model.prescriptionsList[index] - .doctorTitle - .toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - Text( - model.prescriptionsList[index] - .doctorName - .toString(), + margin: EdgeInsets.only(left: 1), + padding: EdgeInsets.only(left: 15.0, right: 15.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0)), + child: Text( + model.languageID == "ar" + ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() + : model.prescriptionsList[index].isInOutPatientDescription.toString(), style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 15.0, - fontWeight: FontWeight.bold, ), - ), - ]), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text( - model.prescriptionsList[index] - .clinicDescription - .toString(), + )), + Row(children: [ + Image.asset( + 'assets/images/Icon-awesome-calendar.png', + width: 30, + height: 30, + ), + Text( + DateUtil.convertStringToDate(model.prescriptionsList[index].appointmentDate.toString()).toString().substring(0, 10), style: TextStyle( - color: Colors.green, + color: Colors.black, fontSize: 15.0, -// fontWeight: FontWeight.bold, ), + ) + ]), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index].doctorTitle.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, ), ), - ], + Text( + model.prescriptionsList[index].doctorName.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .prescriptionsList[index] - .actualDoctorRate - .toDouble(), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index].clinicDescription.toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), // initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ) - ]), - ]), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + ]), + ]), ); }), ), diff --git a/lib/widgets/offers_packages/PackagesCartItemCard.dart b/lib/widgets/offers_packages/PackagesCartItemCard.dart index c59c08cd..ddca9d90 100644 --- a/lib/widgets/offers_packages/PackagesCartItemCard.dart +++ b/lib/widgets/offers_packages/PackagesCartItemCard.dart @@ -77,16 +77,16 @@ class PackagesCartItemCardState extends State { ), ), - Positioned( - bottom: 8, - left: 10, - child: Row( - children: [ - _totalLabel(context: context), - _totalPrice((widget.itemModel.product.price * widget.itemModel.quantity), context: context), - ], - ), - ) + // Positioned( + // bottom: 8, + // left: 10, + // child: Row( + // children: [ + // _totalLabel(context: context), + // _totalPrice((widget.itemModel.product.price * widget.itemModel.quantity), context: context), + // ], + // ), + // ) ], ) ) @@ -136,15 +136,18 @@ Widget _itemName(String name) => Padding( ); -Widget _itemPrice(double price, {@required BuildContext context}) => Padding( +Widget _itemPrice(double price, {@required BuildContext context}) { + final prc = (price ?? 0.0).toStringAsFixed(2); + return Padding( padding: const EdgeInsets.all(0), child: Texts( - '${price} ${TranslationBase.of(context).sar}', + '${prc} ${TranslationBase.of(context).sar}', fontWeight: FontWeight.bold, color: Colors.green, fontSize: 15 ) ); +} // -------------------- @@ -159,16 +162,19 @@ Widget _priceSeperator() => Padding( // -------------------- // Product Price // -------------------- -Widget _itemOldPrice(double oldPrice, {@required BuildContext context}) => Padding( +Widget _itemOldPrice(double oldPrice, {@required BuildContext context}) { + final prc = (oldPrice ?? 0.0).toStringAsFixed(2); + return Padding( padding: const EdgeInsets.all(0), child: Texts( - '${oldPrice} ${TranslationBase.of(context).sar}', + '${prc} ${TranslationBase.of(context).sar}', fontWeight: FontWeight.normal, decoration: TextDecoration.lineThrough, color: Colors.grey, fontSize: 10 ) ); +} // -------------------- // Product Price diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index f3654b74..1c2f87cc 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -26,27 +26,27 @@ class productTile extends StatelessWidget { final dynamic productID; final Function onDelete; final dynamic approvedTotalReviews; -// final VoidCallback deleteWishlistItems; - productTile( - {this.productName, - this.productPrice, - this.productRate, - this.productReviews, - this.qyt, - this.totalPrice, - this.isOrderDetails = false, - this.productImage, - this.showLine = true, - this.img, - this.imgs, - this.status, - this.product, - this.productID, - this.onDelete, - this.approvedTotalReviews, +// final VoidCallback deleteWishlistItems; - }); + productTile({ + this.productName, + this.productPrice, + this.productRate, + this.productReviews, + this.qyt, + this.totalPrice, + this.isOrderDetails = false, + this.productImage, + this.showLine = true, + this.img, + this.imgs, + this.status, + this.product, + this.productID, + this.onDelete, + this.approvedTotalReviews, + }); @override Widget build(BuildContext context) { @@ -91,10 +91,7 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: productName, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), ), ), ), @@ -106,19 +103,16 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: 'SAR $productPrice', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), ), ), ), ), this.isOrderDetails == false ? Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( margin: EdgeInsets.all(5), child: Align( alignment: Alignment.topLeft, @@ -134,14 +128,12 @@ class productTile extends StatelessWidget { ), ), ), - Text( '$approvedTotalReviews', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), - ), - ], - ) + Text( + '$approvedTotalReviews', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + ), + ], + ) : Container(), ], ), @@ -164,9 +156,11 @@ class productTile extends StatelessWidget { height: 50, ), IconButton( - icon: Icon(Icons.shopping_cart, + icon: Icon( + Icons.shopping_cart, size: 18, - color: Colors.blue,), + color: Colors.blue, + ), onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, productID); @@ -192,13 +186,8 @@ class productTile extends StatelessWidget { margin: EdgeInsets.only(bottom: 5.0), child: RichText( text: TextSpan( - text: TranslationBase.of(context).quantity + - "" + - '$qyt', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), + text: TranslationBase.of(context).quantity + "" + '$qyt', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), ), @@ -224,10 +213,7 @@ class productTile extends StatelessWidget { RichText( text: TextSpan( text: ' $totalPrice SAR', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 15), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15), ), ), ], @@ -268,30 +254,19 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: '($productReviews reviews)', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), ), ), InkWell( onTap: () { - Navigator.push( - context, FadePage(page: ProductReviewPage(product))); + Navigator.push(context, FadePage(page: ProductReviewPage(product))); }, child: Container( - padding: - EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), height: 30.0, - decoration: BoxDecoration( - border: Border.all( - color: Colors.orange, - style: BorderStyle.solid, - width: 1.0), - color: Colors.transparent, - borderRadius: BorderRadius.circular(5.0)), + decoration: BoxDecoration(border: Border.all(color: Colors.orange, style: BorderStyle.solid, width: 1.0), color: Colors.transparent, borderRadius: BorderRadius.circular(5.0)), child: Text( TranslationBase.of(context).writeReview, style: TextStyle(