diff --git a/lib/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart index f69d035b..dbef5737 100644 --- a/lib/core/model/pharmacies/PharmacyProduct.dart +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -108,10 +108,10 @@ class PharmacyProduct { List manufacturerIds; List reviews; List images; - List attributes; + List attributes; List specifications; - List associatedProductIds; - List tags; + List associatedProductIds; + List tags; int vendorId; String seName; @@ -367,7 +367,7 @@ class PharmacyProduct { }); } if (json['attributes'] != null) { - attributes = new List(); + attributes = new List(); json['attributes'].forEach((v) { attributes.add(v); }); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index e74a353b..d5e5a207 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -785,7 +785,8 @@ class BaseAppClient { final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { - onFailure('Error While Fetching data', statusCode); + var parsed = json.decode(utf8.decode(response.bodyBytes)); + onFailure(parsed['error']['ErrorEndUserMsg'] ??'Error While Fetching data', statusCode); } else { // var parsed = json.decode(response.body.toString()); var parsed = json.decode(utf8.decode(response.bodyBytes)); diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index d982c519..b32b86e0 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -113,7 +113,6 @@ class PharmacyModuleService extends BaseService { } Future getTopManufacturerList() async { - hasError = false; Map queryParams = {'page': '1', 'limit': '8'}; try { await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, @@ -125,6 +124,7 @@ class PharmacyModuleService extends BaseService { manufacturerList.add(Manufacturer.fromJson(item)); // } }); + hasError = false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -146,6 +146,7 @@ class PharmacyModuleService extends BaseService { response['products'].forEach((item) { bestSellerProducts.add(PharmacyProduct.fromJson(item)); }); + hasError = false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -161,6 +162,7 @@ class PharmacyModuleService extends BaseService { null) { lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + // lastVisited = "2458,4561"; try { await baseAppClient .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", @@ -169,8 +171,9 @@ class PharmacyModuleService extends BaseService { response['products'].forEach((item) { lastVisitedProducts.add(PharmacyProduct.fromJson(item)); }); + hasError = false; }, onFailure: (String error, int statusCode) { - hasError = true; + hasError = true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, ""); super.error = error; }); } catch (error) { diff --git a/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart b/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart index efc628d6..f38851d9 100644 --- a/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart @@ -13,7 +13,7 @@ class LastVisitedViewModel extends BaseViewModel { _pharmacyService.lastVisitedProducts; getLastVisitedProducts() async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _pharmacyService.getLastVisitedProducts(); if (_pharmacyService.hasError) { error = _pharmacyService.error; diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index a34f3b57..acc05e71 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -825,15 +825,10 @@ class _HomePageState extends State { } else { GifLoaderDialogUtils.showMyDialog(context); await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - if (pharmacyModuleViewModel.error.isNotEmpty) { - await pharmacyModuleViewModel.verifyCustomer().then((value) { - GifLoaderDialogUtils.hideDialog(context); - Navigator.push(context, FadePage(page: LandingPagePharmacy())); - }); - } else { + await pharmacyModuleViewModel.verifyCustomer().then((value) { GifLoaderDialogUtils.hideDialog(context); Navigator.push(context, FadePage(page: LandingPagePharmacy())); - } + }); }); } } diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index ee5c077f..c158341d 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -48,10 +48,8 @@ class _PharmacyPageState extends State { return BaseView( onModelReady: (model) async { - // GifLoaderDialogUtils.showMyDialog(context); await model.getSavedLanguage(); await model.getBannerList(); - // GifLoaderDialogUtils.hideDialog(context); }, allowAny: true, builder: (_, model, wi) => AppScaffold( diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 40895a00..07abe2db 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -24,6 +24,7 @@ class ProductTileItem extends StatelessWidget { void _saveLastVisitProducts() async { String lastVisited = ""; bool isIdExist = false; + List items = []; if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { lastVisited = @@ -32,8 +33,27 @@ class ProductTileItem extends StatelessWidget { if (id == item.id) { isIdExist = true; } + items.add(id); }); } + + if(items.length >= 15){ + items.removeAt(0); + // lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), ''); + } + + lastVisited = ""; + for(int i = items.length - 1; i >= 0; i--){ + if (lastVisited == "") { + // it means there is no lastVisited yet + lastVisited = "${items[i]}"; + } else { + // there is lastVisited id's and this product id is not found + lastVisited += ",${items[i]}"; + } + } + + if (!isIdExist) { if (lastVisited == "") { // it means there is no lastVisited yet @@ -42,8 +62,8 @@ class ProductTileItem extends StatelessWidget { // there is lastVisited id's and this product id is not found lastVisited += ",${item.id}"; } - sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited); } + sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited); } @override diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart index b07c6da6..aaedee65 100644 --- a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -15,31 +16,44 @@ class RecentlyViewedWidget extends StatelessWidget { onModelReady: (model) => model.getLastVisitedProducts(), allowAny: true, builder: (_, model, wi) => NetworkBaseView( - isLocalLoader: true, - baseViewModel: model, - child: Container( - child: Column( - children: [ - ViewAllHomeWidget( - TranslationBase.of(context).recentlyViewed, - FinalProductsPage( - id: "", - productType: 3, - )), - Container( - height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 4 + 20 - : 0, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.lastVisitedProducts[i]), - scrollDirection: Axis.horizontal, - itemCount: model.lastVisitedProducts.length, - ), + isLocalLoader: true, + baseViewModel: model, + child: Container( + child: Column( + children: [ + ViewAllHomeWidget( + TranslationBase.of(context).recentlyViewed, + FinalProductsPage( + id: "", + productType: 3, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 4 + 20 + : 0, + child: ListView.builder( + itemBuilder: (ctx, i) => + ProductTileItem(model.lastVisitedProducts[i]), + scrollDirection: Axis.horizontal, + itemCount: model.lastVisitedProducts.length, + ), + ) + else + Container( + height: 80, + child: Center( + child:CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], ), - ], - ), - ), - )); + ), + )); } -} \ No newline at end of file +} diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart index 25981466..93a9df0c 100644 --- a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -14,7 +14,7 @@ class ViewAllHomeWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(10, 10, 10, 10), + margin: EdgeInsets.fromLTRB(16, 10, 16, 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -28,7 +28,7 @@ class ViewAllHomeWidget extends StatelessWidget { borderColor: Colors.green, textColor: Colors.green, vPadding: 6, - hPadding: 4, + hPadding: 8, handler: () { Navigator.push( context, diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 3cf28592..0854f4bc 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -19,7 +19,10 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/pharmacy/my_account_items.dart'; +import 'package:diplomaticquarterapp/widgets/pharmacy/my_account_services.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -98,7 +101,7 @@ class _ProfilePageState extends State { isPharmacy: true, body: user != null ? Container( - color: Colors.white, + color: Colors.white, child: SingleChildScrollView( child: Column( children: [ @@ -108,47 +111,56 @@ class _ProfilePageState extends State { Container( child: Row( children: [ - Container( - padding: EdgeInsets.only( - top: 20.0, - left: 10.0, - right: 10.0, - bottom: 10.0, - ), - child: LargeAvatar( - name: user.firstName.toString(), - url: '', + Padding( + padding: EdgeInsets.symmetric( + horizontal: 15.0, vertical: 8.0), + child: Container( + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: LargeAvatar( + radius: 55.0, + name: user.firstName.toString(), + url: + 'https://thumbs.dreamstime.com/b/default-avatar-profile-vector-user-profile-default-avatar-profile-vector-user-profile-profile-179376714.jpg', + ), ), ), - Column(children: [ - Row(children: [ - Text( - TranslationBase.of(context) - .welcome, - style: TextStyle( - fontSize: 14.0, + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row(children: [ + Texts( + TranslationBase.of(context) + .welcome, + fontSize: 16.0, + ), + ]), + SizedBox( + height: 5.0, + ), + Row(children: [ + Texts( + languageID == "ar" + ? user.firstNameN + .toString() + + " " + + user.lastNameN + .toString() + : user.firstName + .toString() + + " " + + user.lastName + .toString(), + fontSize: 17.0, fontWeight: FontWeight.bold, - color: Colors.grey), - ), - ]), - SizedBox( - height: 10, - ), - Row(children: [ - Text( - languageID == "ar" - ? user.firstNameN.toString() + - " " + - user.lastNameN.toString() - : user.firstName.toString() + - " " + - user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold), - ), - ]), - ]), + ), + ]), + ]), ], ), ) @@ -168,125 +180,53 @@ class _ProfilePageState extends State { Container( child: Row( children: [ - Expanded( - child: InkWell( - onTap: () { - if (customerId == null) { - AppToast.showErrorToast( - message: "Customer not found"); - return; - } - Navigator.push( - context, - FadePage( - page: OrderPage( - customerID: customerId))); - }, - child: Column( - children: [ -// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), - SvgPicture.asset( - 'assets/images/pharmacy/orders_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).orders, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), + AccountServices( + title: TranslationBase.of(context).orders, + serviceImage: + 'assets/images/pharmacy/orders_icon.svg', + onTap: () { + if (customerId == null) { + AppToast.showErrorToast( + message: "Customer not found"); + return; + } + Navigator.push( + context, + FadePage( + page: OrderPage( + customerID: customerId))); + }, ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: LakumMainPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/lakum_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).lakum, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold), - ), - ], - ), - ), + AccountServices( + title: TranslationBase.of(context).lakum, + serviceImage: + 'assets/images/pharmacy/lakum_icon.svg', + onTap: () { + Navigator.push(context, + FadePage(page: LakumMainPage())); + }, ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - WishlistPage(true))); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/wishlist_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).wishlist, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyReviewsPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/review_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), + AccountServices( + title: TranslationBase.of(context).wishlist, + serviceImage: + 'assets/images/pharmacy/wishlist_icon.svg', + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + WishlistPage(true))); + }, ), + AccountServices( + title: TranslationBase.of(context).reviews, + serviceImage: + 'assets/images/pharmacy/review_icon.svg', + onTap: () { + Navigator.push(context, + FadePage(page: MyReviewsPage())); + }, + ) ], )), SizedBox( @@ -303,16 +243,13 @@ class _ProfilePageState extends State { height: 10, ), Container( - padding: EdgeInsets.only(left: 10.0), + padding: EdgeInsets.symmetric(horizontal: 25.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), - ), + Texts(TranslationBase.of(context).myAccount, + fontSize: 16.0, + fontWeight: FontWeight.bold), SizedBox( height: 10, ), @@ -327,24 +264,11 @@ class _ProfilePageState extends State { FadePage( page: HomePrescriptionsPage())); }, - child: Row( - children: [ - SvgPicture.asset( + child: AccountItem( + title: TranslationBase.of(context) + .myPrescription, + itemIcon: 'assets/images/pharmacy/my_prescription_icon.svg', - width: 28, - height: 28, - ), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context) - .myPrescription, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], ), ), SizedBox( @@ -355,28 +279,16 @@ class _ProfilePageState extends State { height: 20, ), InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: ComparePage())); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/compare.png', - width: 35, - height: 35), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context).compare, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), + onTap: () { + Navigator.push(context, + FadePage(page: ComparePage())); + }, + child: AccountItem( + isTerms: true, + title: TranslationBase.of(context) + .compare, + itemIcon: + "assets/images/pharmacy/compare.png")), SizedBox( height: 5, ), @@ -391,25 +303,11 @@ class _ProfilePageState extends State { FadePage( page: HomePrescriptionsPage())); }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/medication_refill_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context) - .medicationsRefill, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), + child: AccountItem( + title: TranslationBase.of(context) + .medicationsRefill, + itemIcon: + 'assets/images/pharmacy/medication_refill_icon.svg'), ), SizedBox( height: 5, @@ -423,23 +321,10 @@ class _ProfilePageState extends State { Navigator.push( context, FadePage(page: MyFamily())); }, - child: Row( - children: [ - SvgPicture.asset( + child: AccountItem( + title: TranslationBase.of(context).family, + itemIcon: 'assets/images/pharmacy/my_family_icon.svg', - width: 20, - height: 20, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).family, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], ), ), SizedBox( @@ -456,24 +341,11 @@ class _ProfilePageState extends State { FadePage( page: PharmacyAddressesPage())); }, - child: Row( - children: [ - SvgPicture.asset( + child: AccountItem( + itemIcon: 'assets/images/pharmacy/shipping_addresses_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context) - .shippingAddresses, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + title: TranslationBase.of(context) + .shippingAddresses, ), ), SizedBox( @@ -484,32 +356,19 @@ class _ProfilePageState extends State { height: 20, ), InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyTermsConditions())); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context) + onTap: () { + Navigator.push( + context, + FadePage( + page: + PharmacyTermsConditions())); + }, + child: AccountItem( + isTerms: true, + title: TranslationBase.of(context) .conditionsHMG, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), + itemIcon: + 'assets/images/pharmacy/terms.png')), SizedBox( height: 5, ), @@ -518,39 +377,24 @@ class _ProfilePageState extends State { height: 20, ), InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: LakumTermsConditions( - this.identificationNo, - this.firstName, - this.lastName, - this.mobileNo, - this.languageId))); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), -// IconButton(icon: Icon(Icons.error_outline), iconSize: 30, -// color: Colors.black,), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context) - .conditions, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), + onTap: () { + Navigator.push( + context, + FadePage( + page: LakumTermsConditions( + this.identificationNo, + this.firstName, + this.lastName, + this.mobileNo, + this.languageId))); + }, + child: AccountItem( + title: TranslationBase.of(context) + .conditions, + itemIcon: + 'assets/images/pharmacy/terms.png', + isTerms: true, + )), ], ), ), @@ -567,77 +411,54 @@ class _ProfilePageState extends State { SizedBox( height: 10, ), - Container( - padding: EdgeInsets.only(left: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).reachUs, - style: TextStyle( + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 15.0, vertical: 8.0), + child: Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).reachUs, fontSize: 16.0, fontWeight: FontWeight.bold), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: LiveChatPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/contact_us_icon.svg', - width: 20, - height: 20, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).contactUs, - style: TextStyle(fontSize: 13.0), - ), - ], + SizedBox( + height: 5, ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: FindUsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/our_locations_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context) - .ourLocations, - style: TextStyle(fontSize: 13.0), - ), - ], + Divider( + color: Colors.grey, + height: 20, ), - ) - ], + InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: LiveChatPage())); + }, + child: AccountItem( + title: TranslationBase.of(context) + .contactUs, + itemIcon: + 'assets/images/pharmacy/contact_us_icon.svg'), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: FindUsPage())); + }, + child: AccountItem( + title: TranslationBase.of(context) + .ourLocations, + itemIcon: + 'assets/images/pharmacy/our_locations_icon.svg')) + ], + ), ), ) ], diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index f85faf2c..0f86df23 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -98,7 +98,7 @@ class ProductDetailService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - AppToast.showErrorToast(message: 'something went wrong please try again'); + AppToast.showErrorToast(message: super.error??'something went wrong please try again'); }, body: request); } diff --git a/lib/widgets/pharmacy/my_account_items.dart b/lib/widgets/pharmacy/my_account_items.dart new file mode 100644 index 00000000..bb514e57 --- /dev/null +++ b/lib/widgets/pharmacy/my_account_items.dart @@ -0,0 +1,50 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class AccountItem extends StatelessWidget { + final String title; + final String itemIcon; + final bool isTerms; + + const AccountItem({this.title, this.itemIcon, this.isTerms = false}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + isTerms == false + ? Container( + height: 35.0, + width: 35.0, + child: SvgPicture.asset( + '$itemIcon', + width: 35, + height: 35, + ), + ) + : Container( + height: 35.0, + width: 35.0, + child: Image.asset( + '$itemIcon', + width: 35, + height: 35, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + width: 20, + ), + Texts( + title, + fontSize: 15.0, + ), + ], + ) + ], + ); + } +} diff --git a/lib/widgets/pharmacy/my_account_services.dart b/lib/widgets/pharmacy/my_account_services.dart new file mode 100644 index 00000000..e3b9948d --- /dev/null +++ b/lib/widgets/pharmacy/my_account_services.dart @@ -0,0 +1,52 @@ +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class AccountServices extends StatelessWidget { + final String title; + final String serviceImage; + final Function onTap; + + const AccountServices({this.title, this.onTap, this.serviceImage}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: InkWell( + onTap: onTap, + // () { + // if (customerId == null) { + // AppToast.showErrorToast( + // message: "Customer not found"); + // return; + // } + // Navigator.push( + // context, + // FadePage( + // page: OrderPage( + // customerID: customerId))); + // }, + child: Column( + children: [ +// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), + SvgPicture.asset( + '$serviceImage', + width: 55, + height: 55, + ), + SizedBox( + height: 7, + ), + Texts( + title, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + ); + } +}