From c7a0d39aabb291af4fc230cf56e10c5334d68c0c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 4 Oct 2021 15:37:58 +0300 Subject: [PATCH 1/9] first step of ProductDetailPage refactor --- lib/config/config.dart | 14 +- lib/pages/final_products_page.dart | 2 +- lib/pages/landing/landing_page_pharmcy.dart | 2 +- lib/pages/parent_categorise_page.dart | 2 +- lib/pages/pharmacies/product_detail.dart | 2198 ----------------- .../screens/pharmacy_module_page.dart | 2 +- .../product-details/availability_info.dart | 114 + .../screens/product-details/details_info.dart | 59 + .../product-details/discount_description.dart | 48 + .../product-details/footer-widget.dart | 492 ++++ .../product-details/product-detail.dart | 842 +++++++ .../product-name-and-price.dart | 177 ++ .../product-details/recommended_products.dart | 388 +++ .../screens/product-details/reviews_info.dart | 92 + .../pharmacies/widgets/ProductTileItem.dart | 2 +- lib/pages/search_products_page.dart | 2 +- lib/pages/sub_categorise_page.dart | 2 +- .../others/app_scafold_detail_page.dart | 49 +- 18 files changed, 2274 insertions(+), 2213 deletions(-) delete mode 100644 lib/pages/pharmacies/product_detail.dart create mode 100644 lib/pages/pharmacies/screens/product-details/availability_info.dart create mode 100644 lib/pages/pharmacies/screens/product-details/details_info.dart create mode 100644 lib/pages/pharmacies/screens/product-details/discount_description.dart create mode 100644 lib/pages/pharmacies/screens/product-details/footer-widget.dart create mode 100644 lib/pages/pharmacies/screens/product-details/product-detail.dart create mode 100644 lib/pages/pharmacies/screens/product-details/product-name-and-price.dart create mode 100644 lib/pages/pharmacies/screens/product-details/recommended_products.dart create mode 100644 lib/pages/pharmacies/screens/product-details/reviews_info.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 5af95569..6e18e0cd 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,16 +13,16 @@ 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/'; -const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // Pharmacy Production URLs -// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; -// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; +const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; @@ -551,7 +551,7 @@ const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; -const GET_MOST_VIEWED_PRODUCTS = "mostview?"; +const GET_MOST_VIEWED_PRODUCTS = "mostview"; const GET_NEW_PRODUCTS = "newproducts?"; // Home Health Care diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 78ed3383..51e9e60c 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 5da853fb..45f60bb7 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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'; diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 40bf2dc7..d7249c6b 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart deleted file mode 100644 index 06cae695..00000000 --- a/lib/pages/pharmacies/product_detail.dart +++ /dev/null @@ -1,2198 +0,0 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; -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/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; -import 'screens/cart-order-page.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - -int price = 0; -dynamic languageID; -bool isOverQuantity = false; -bool isInWishlit = false; -//int isSelected = 1; -bool isSelected= true; -String itemID; -var customerId; -CompareList compareItems = new CompareList(); -PharmacyProduct specificationData; -//Products recommendedData; - -class ProductDetailPage extends StatefulWidget { - final PharmacyProduct product; -// final Products recommendedProducts; - - - ProductDetailPage(this.product ); - - - @override - __ProductDetailPageState createState() => __ProductDetailPageState(); -} - -class __ProductDetailPageState extends State { - AppSharedPreferences sharedPref = AppSharedPreferences(); - - bool isTrue = true; - bool isDetails = true; - bool isReviews = false; - bool isAvailabilty = false; - dynamic wishlistItems; - //var model; - - // String ProductId="4561"; - // String productId = ""; - getLanguageID() async { - languageID = await sharedPref.getString(APP_LANGUAGE); - } - - checkWishlist() async { - GifLoaderDialogUtils.showMyDialog(context); - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.checkWishlistData(); - -// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); - - for (int i = 0; i < x.wishListItems.length; i++) { - if (itemID == x.wishListItems[i].product.id) { - isInWishlit = true; - break; - } else { - isInWishlit = false; - } - } - GifLoaderDialogUtils.hideDialog(context); - setState(() {}); - } - - - void initState() { - getLanguageID(); - price = 1; - specificationData = widget.product; - userInfo(); - super.initState(); - } - - void userInfo() async { - print(specificationData); - customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - if (customerId != null) { - itemID = widget.product.id; - checkWishlist(); - } - print("customerId:$customerId"); - - setState(() {}); - } - - Widget build(BuildContext context) { - return customerId != null - ? DetailPageScafold( - appBarTitle: TranslationBase.of(context).productDetails, - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - color: Colors.white, - child: Column( - children: [ - Image.network( - widget.product.images[0].src.trim(), - ), - widget.product.discountDescription != null - ? Container( - width: double.infinity, - height: 50, - color: Colors.yellowAccent, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Container( - alignment: Alignment.centerRight, - child: languageID == "ar" - ? Text( - widget.product - .discountDescriptionn, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ) - : Text( - widget.product - .discountDescription, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 0, - child: Container( - child: Image( - image: AssetImage( - 'assets/images/offer.png'), - ), - ), - ), - ], - ), - ) - : Container(), - ], - ), - ), - SizedBox( - height: 4, - ), - Container( - width: 500, - height: 220, - color: Colors.white, - child: productNameAndPrice(context, widget.product), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - height: 100, - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).specification, - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ), - Divider(color: Colors.grey), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).noData, -// "there is no data", - ), - ), - ), - ], - ), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - margin: EdgeInsets.only(bottom: 6), -// height: 350, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = true; - isReviews = false; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isDetails - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container() - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = true; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isReviews - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = false; - isAvailabilty = true; - }); - }, - child: Text( - TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isAvailabilty - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - ], - ), - SizedBox( - height: 10, - ), - isDetails - ? Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Text( - TranslationBase.of(context) - .description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - SizedBox( - height: 10, - ), - Divider(height: 1, color: Colors.grey), - SizedBox( - height: 15, - ), - Container( - child: Text( - languageID == "ar" - ? widget.product.fullDescriptionn - : widget.product.fullDescription ?? - "", - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - SizedBox( - height: 20, - ), - ]), - ) - -// Container( -// child: Text( -// languageID == 'ar' -// ? widget.product.fullDescriptionn -// : widget.product.fullDescription, -// style: TextStyle( -// fontSize: 16, -// fontFamily: 'WorkSans-Regular'), -// ), -// ), -// SizedBox( -// height: 10, -// ), -// Container( -// child: Text( -// TranslationBase.of(context).howToUse, -// style: TextStyle( -// fontSize: 17, -// color: Colors.grey, -// fontWeight: FontWeight.w600), -// ), -// ), -// SizedBox( -// height: 6, -// ), -// Divider( -// height: 2, -// color: Colors.grey), -// SizedBox( -// height: 10, -// ), -// Container( -// child: Text( -// languageID == 'ar' -// ? widget.product.shortDescriptionn -// : widget.product.shortDescription, -// style: TextStyle( -// fontSize: 16, -// fontFamily: 'WorkSans-Regular'), -// ), -// ), - // ], - // ), - // ) - : isReviews - ? BaseView( - onModelReady: (model) => - model.getProductReviewsData( - widget.product.id), - builder: (_, model, wi) => model - .productDetailService - .length != - 0 && - model.productDetailService[0] - .reviews.length != - 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model - .productDetailService[0] - .reviews - .length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[ - index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors - .grey, - fontWeight: - FontWeight - .w600), - ), - ), - Container( - margin: - EdgeInsets.only( - left: 210), - child: RatingBar - .readOnly( - initialRating: model - .productDetailService[ - 0] - .reviews[ - index] - .rating - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[index] - .reviewText, - style: TextStyle( - fontSize: 20), - ), - ), - SizedBox( - height: 50, - ), - Divider( - height: 1, - color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).noReviewsAvailable,), -// Text('No Reviews Available'), - ), - ) - : isAvailabilty - ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => model - .productLocationService - .length == - 0 - ? Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).noLocationAvailable,), -// Text('No location Available'), - ) - : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model - .productLocationService - .length, - itemBuilder: - (BuildContext context, - int index) { - return Padding( - padding: - EdgeInsets.all(8.0), - child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( -// crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Expanded( - flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - model - .productLocationService[ - index] - .locationDescription + - "\n" + - fixingString(model - .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle( - fontSize: - 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .location_on), - color: - Colors.red, - onPressed: - () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .phone), - color: - Colors.red, - onPressed: - () {}, - ), - ), - ], - ), - Divider( - height: 1.2, - color: Colors.grey) - ], - ), - ); - }, - ), - ) - : Container(), - ], - ), - ), - Row( - children: [ - customerId != null ? Container( - width: 410, - height: 50, - // margin: EdgeInsets.only(bottom: 5), - color: Colors.white, - child: Texts( - TranslationBase.of(context).recommended, - bold: true, - ), - ) - : Container(), - ], - ), - SingleChildScrollView( - child: Container( - width: 410, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, -// mainAxisSize: MainAxisSize.min, - children: [ - Container( - color: Colors.white, - height: 210, - margin: EdgeInsets.only(bottom: 75), - padding: EdgeInsets.only(bottom: 5), - // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), - child: BaseView( - - onModelReady: (model) => model.getRecommendedProducts(widget.product.id), - builder: (_, model, wi) => Container( - child: - model.recommendedProductList.length != null - ? Expanded( - child: ListView.builder( - scrollDirection: - Axis.horizontal, - shrinkWrap: true, - physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), - itemCount: model.recommendedProductList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () - async { - GifLoaderDialogUtils.showMyDialog(context); - RecommendedProductModel data = model.recommendedProductList[index]; - var json = data.toJson(); - PharmacyProduct product = new PharmacyProduct.fromJson(json); - await Navigator.pushReplacement( - context, - FadePage( - page: ProductDetailPage(product), - )); - GifLoaderDialogUtils.hideDialog(context); - }, - child: Card( - elevation: 2, - shape: RoundedRectangleBorder( - side: BorderSide( - color: Colors.grey[300], - width: 2), - borderRadius: BorderRadius.circular(10)), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 0, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(15), - ), - ), - padding: EdgeInsets.symmetric(horizontal: 4), - width: MediaQuery.of(context).size.width / 3, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - Container( - child: Align( - alignment: Alignment.topRight, - child: IconButton( - icon: Icon(model.recommendedProductList[index].isinwishlist != true ? Icons.favorite_border : Icons.favorite), - color: model.recommendedProductList[index].isinwishlist != true ? Colors.grey : Colors.red, - onPressed: () async { - - if (customerId != null ) { - if (!isInWishlit && model.recommendedProductList[index].isinwishlist != true) { - GifLoaderDialogUtils.showMyDialog(context); - await addToWishlistFunction(model.recommendedProductList[index].id); -// checkWishlist(); - GifLoaderDialogUtils.hideDialog(context); - setState((){ - model.recommendedProductList[index].isinwishlist= true; - }); - - } else { - GifLoaderDialogUtils.showMyDialog(context); - await deleteFromWishlistFunction(model.recommendedProductList[index].id); - GifLoaderDialogUtils.hideDialog(context); - setState((){ - model.recommendedProductList[index].isinwishlist = false; - }); - } - } else { - return ; - } - setState(() { - // checkWishlist(); - }); - }, - )), - -// child: Align( -// alignment: Alignment.topRight, -// child:itemID.contains(model.recommendedProductList[index]['id']) -// // !isInWishlist -// ? IconButton( -// icon: Icon(Icons.favorite_border), -// color: Colors.grey, -// iconSize: 30, -// onPressed: () { -// setState(() { -// if (customerId != null && isInWishlit ) { -// deleteFromWishlistFunction( -// model.recommendedProductList[index].id); -// } }); -// }, -// ) -// : IconButton( -// icon: Icon(Icons.favorite), -// color: Colors.red, -// iconSize: 30, -// onPressed: () { -// setState(() { -// if (customerId != null && !isInWishlit ) { -// addToWishlistFunction( -// model.recommendedProductList[index].id); -// } }); -// }, -// ) -// ), - ), - - Container( - margin: EdgeInsets.fromLTRB( - 0, - 16, - 10, - 16), - alignment: - Alignment.center, -// padding: EdgeInsets.only(left: 25, bottom: 20), - child: (model.recommendedProductList[index].images != null && - model.recommendedProductList[index].images.length > 0) - ? Image.network( - model.recommendedProductList[index].images[0].src.toString(), -// item.images[0].src, - fit: BoxFit.cover, - height: 60, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 60, - ), - ), - Container( - width: model.recommendedProductList[index].rxMessage != - null - ? MediaQuery.of(context).size.width / - 5 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: - Color(0xffb23838), - borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), - ), - child: model.recommendedProductList[index].rxMessage != null - ? Texts( - languageID == "ar" - ? model.recommendedProductList[index].rxMessagen - : model.recommendedProductList[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ):Texts (""), - ), - ]), - Container( - margin: EdgeInsets - .symmetric( - horizontal: - 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Text( - languageID == "ar" - ? model.recommendedProductList[index].namen - : model.recommendedProductList[index].name, - style: - TextStyle( - color: - Colors.black, - fontSize: - 13.0, -// fontWeight: FontWeight.bold, - ), - ), - Padding( -// padding: const EdgeInsets.only(top: 15, bottom: 10), - padding: const EdgeInsets.only( - top: - 10, - bottom: - 5), - child: - Texts( - "SAR ${model.recommendedProductList[index].price}", - bold: - true, - fontSize: - 14, - ), - ), - ], - ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Container( - padding: - EdgeInsets.only(right: 10), -// margin: EdgeInsets.only(left: 5), - child: - Align( - alignment: - Alignment.topLeft, - child: - RatingBar.readOnly( - initialRating: model.recommendedProductList[index].approvedRatingSum.toDouble(), -// initialRating: productRate, - size: - 13.0, - filledColor: - Colors.yellow[700], - emptyColor: - Colors.grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons.star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - ), - ), - Texts( - "(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})", -// bold: true, - fontSize: - 12, - ), - ]), - ], - ), - ), - ), - ); - }), - ) - : Container( - // color: Colors.white, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).nonRecommended, - color: Colors.black,), - ], - ), - ), - )), - ), - ], - ), - ), - ) - ], - ), - ), - bottomSheet: footerWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product), - ) - : AppScaffold( - appBarTitle: TranslationBase.of(context).productDetails, - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - showPharmacyCart: false, - showHomeAppBarIcon: false, - body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - color: Colors.white, - child: Column( - children: [ - Image.network( - widget.product.images[0].src.trim(), - ), - widget.product.discountDescription != null - ? Container( - width: double.infinity, - height: 50, - color: Colors.yellowAccent, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Container( - alignment: Alignment.centerRight, - child: languageID == 'ar' - ? Text( - widget.product - .discountDescriptionn, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ) - : Text( - widget.product - .discountDescription, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 0, - child: Container( - child: Image( - image: AssetImage( - 'assets/images/offer.png'), - ), - ), - ), - ], - ), - ) - : Container(), - ], - ), - ), - SizedBox( - height: 4, - ), - Container( - width: 500, - height: 150, - color: Colors.white, - child: productNameAndPrice(context, widget.product), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - height: 120, - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).specification, - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ), - Divider(color: Colors.grey) - ], - ), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - margin: EdgeInsets.only(bottom: 100), -// height: 350, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = true; - isReviews = false; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isDetails - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container() - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = true; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isReviews - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = false; - isAvailabilty = true; - }); - }, - child: Text( - TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isAvailabilty - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - ], - ), - SizedBox( - height: 10, - ), - isDetails - ? Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Text( - TranslationBase.of(context).description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - SizedBox( - height: 6, - ), - Divider(height: 1, color: Colors.grey), - SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.shortDescriptionn - : widget.product.shortDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - TranslationBase.of(context).howToUse, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - SizedBox( - height: 6, - ), - Divider(height: 2, color: Colors.grey), - SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.fullDescriptionn - : widget.product.fullDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - ], - ), - ) - : isReviews - ? BaseView( - onModelReady: (model) => - model.getProductReviewsData( - widget.product.id), - builder: (_, model, wi) => model - .productDetailService - .length != - 0 && - model.productDetailService[0] - .reviews.length != - 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model - .productDetailService[0] - .reviews - .length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[ - index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors - .grey, - fontWeight: - FontWeight - .w600), - ), - ), - Container( - margin: - EdgeInsets.only( - left: 210), - child: RatingBar - .readOnly( - initialRating: model - .productDetailService[ - 0] - .reviews[ - index] - .rating - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[index] - .reviewText, - style: TextStyle( - fontSize: 20), - ), - ), - SizedBox( - height: 50, - ), - Divider( - height: 1, - color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).noReviewsAvailable), -// Text('No Reviews Available'), - ), - ) - : isAvailabilty - ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => - ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model - .productLocationService.length, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( -// crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - model - .productLocationService[ - index] - .locationDescription + - "\n" + - fixingString(model - .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle( - fontSize: 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .location_on), - color: Colors.red, - onPressed: () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: - Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, - ), - ), - ], - ), - Divider( - height: 1.2, - color: Colors.grey) - ], - ), - ); - }, - ), - ) - : Container(), - ], - ), - ), -// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), - ], - ), - ), - bottomSheet: footerWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product), - ); - } -} - -class footerWidget extends StatefulWidget { - final bool isAvailble; - final int maxQuantity; - final int minQuantity; - final int quantityLimit; - final PharmacyProduct item; - - footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item); - - @override - _footerWidgetState createState() => _footerWidgetState(); -} - -class _footerWidgetState extends State { - double quantityUI = 70; - bool showUI = false; - - @override - Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: quantityUI, - color: Colors.white, - child: Column( - children: [ - showUI - ? Container( - width: double.infinity, - height: 90, - color: Colors.white, - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).quantity, - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), - ), - ), -// ListView( -// scrollDirection: Axis.horizontal, -// children: [ -// itemQuantity(), -// ], -// ), - Container( -// margin: EdgeInsets.symmetric(vertical: 20.0), - height: 50.0, - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '1', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 1; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '2', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 2; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '3', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 3; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '4', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 4; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '5', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 5; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '6', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 6; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '7', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 7; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '8', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 8; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '9', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 9; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '10', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 10; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - Container( - width: 50.0, - child: TextField( - decoration: - InputDecoration(labelText: 'quantity #'), - onChanged: (text) { - print(price); - print(widget.quantityLimit); - if (int.tryParse(text) == null) { - text = ''; - } else { - setState(() { - price = int.parse(text); - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - } - }); - } - }, - ), - ), - ], - ), - ) - ], - ), - ), - ) - : Container( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 70, - height: 50, - child: FlatButton( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 4, - child: Text( - price.toString(), - style: TextStyle(fontSize: 20), - ), - ), - Expanded( - flex: 5, - child: Text( - TranslationBase.of(context).quantityShortcut, - style: TextStyle(fontSize: 16), - ), - ), - ], - ), - onPressed: () { - setState(() { - if (showUI) { - quantityUI = 70; - showUI = false; - } else { - quantityUI = 150; - showUI = true; - } - }); - }, - ), - ), - !widget.isAvailble && price > 0 || - price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 190, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - addToCartFunction(price, widget.item.id, context); - }, - child: Container( - alignment: Alignment.center, - width: 190, - height: 46, - color: Colors.green, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ), - SizedBox( - width: 5, - ), - !widget.isAvailble && price > 0 || - price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 120, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - print('buy now'); - addToCartFunction(price, widget.item.id, context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - child: Container( - alignment: Alignment.center, - width: 120, - height: 46, - color: Colors.blue, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ), - ], - ), - ], - ), - ); - } -} - -class productNameAndPrice extends StatefulWidget { - BuildContext context; - PharmacyProduct item; - - productNameAndPrice(this.context, this.item); - - @override - _productNameAndPriceState createState() => _productNameAndPriceState(); -} - -class _productNameAndPriceState extends State { - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Text( - widget.item.price.toString() + " " + "SAR", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), - ), - SizedBox( - width: 40, - ), - Text( - languageID == 'ar'? - widget.item.stockAvailabilityn : widget.item.stockAvailability , - style: widget.item.stockAvailability == 'Out of stock' - ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) - : TextStyle( - fontWeight: FontWeight.bold, color: Colors.green), - ), - SizedBox(width: 20), - widget.item.stockAvailability == 'Out of stock' && - customerId != null - ? InkWell( - onTap: () => - notifyMeWhenAvailable(context, widget.item.id), - child: Row(children: [ - Text( - TranslationBase.of(context).notifyMe, - style: TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline, - ), - ), - SizedBox(width: 4), - Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, - ) - ]), - ) - : Container( - margin: languageID == 'ar' - ? EdgeInsets.only(right: 25) - : EdgeInsets.only(left: 25), - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: BorderRadius.circular(30), - ), - child: IconButton( - icon: Icon(!isInWishlit - ? Icons.favorite_border - : Icons.favorite), - color: !isInWishlit ? Colors.white : Colors.red, - onPressed: () async { - if (customerId != null) { - if (!isInWishlit) { - GifLoaderDialogUtils.showMyDialog(context); - await addToWishlistFunction(widget.item.id); - GifLoaderDialogUtils.hideDialog(context); - } else { - await deleteFromWishlistFunction(widget.item.id); - } - } else { - return; - } - setState(() {}); - }, - )), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: - languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, - child: Text( - languageID == 'ar' - ? widget.item.fullDescriptionn - : widget.item.fullDescription, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - ), - ), - ), - ), - Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(right: 150), - child: Align( - alignment: Alignment.bottomLeft, - child: RatingBar.readOnly( - initialRating: 3, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ), - ), - Expanded( - flex: 1, - child: Container( - child: widget.item.rxMessage != null - ? Text( - languageID == 'ar' - ? widget.item.rxMessagen.toString() - : widget.item.rxMessage.toString(), - style: TextStyle(color: Colors.red, fontSize: 10), - ) - : Container()), - ), - widget.item.rxMessage != null - ? Icon( - FontAwesomeIcons.questionCircle, - color: Colors.red, - size: 15.0, - ) - : Container(), - ], - ), - ], - ); - } -} - -slideDetail() { - return Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 15.0), - decoration: const BoxDecoration( - border: Border( - top: BorderSide(width: 0.5, color: Colors.grey), - left: BorderSide(width: 0.5, color: Colors.grey), - right: BorderSide(width: 0.5, color: Colors.grey), - bottom: BorderSide(width: 0.5, color: Colors.grey), - ), - color: Colors.white, - ), - child: const Text('1', - textAlign: TextAlign.center, - style: TextStyle(color: Color(0xFF000000))), - ), - ) - ], - ); -} - -fixingString(txt) { - String stringTxt; - String newTxt; - stringTxt = txt.toString(); - newTxt = stringTxt.split('.')[1]; - - return newTxt; -} - -//getLanguageID() async { -// languageID = await sharedPref.getString(APP_LANGUAGE); -//} - -getSpecificationData(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - specificationData = await x.productSpecificationData(itemID); -} - -addToCartFunction(quantity, itemID, BuildContext context) async { - GifLoaderDialogUtils.showMyDialog(context); - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID).then((value) { - GifLoaderDialogUtils.hideDialog(context); - }); -} - -notifyMeWhenAvailable(context, itemId) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.notifyMe(customerId, itemId); -} - -addToWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlit = true; - await x.addToWishlistData(itemID); - -} - -deleteFromWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlit = false; - await x.deletWishlistData(itemID); -} - -checkWishlist() async { - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.checkWishlistData(); - -// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); - - for (int i = 0; i < x.wishListItems.length; i++) { - if (itemID == x.wishListItems[i].product.id) { - isInWishlit = true; - break; - } else { - isInWishlit = false; - } - } -} - -class sttingModalBottomSheet extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container(); - } -} - -settingModalBottomSheet(context) { - showModalBottomSheet( - context: context, - builder: (BuildContext bc) { - return Container( - child: new Wrap( - children: [ - new ListTile( - leading: Icon(Icons.shopping_cart), - title: Text(TranslationBase.of(context) - .addToCart,), - onTap: () => { - if (price > 0) - {addToCartFunction(price, itemID, context)} - else - { - AppToast.showErrorToast( - message: "you should add quantity") - } - }), - ListTile( - leading: Icon(Icons.favorite_border), - title: Text(TranslationBase.of(context) - .addToWishlist,), - onTap: () => {addToWishlistFunction(itemID)}, - ), - ListTile( - leading: Icon(Icons.compare), - title: Text(TranslationBase.of(context) - .compare,), - onTap: () => { - Provider.of(context, listen: false) - .addItem(specificationData), - }, - ), - ], - ), - ); - }); -} diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index e5e9e230..6ede72a9 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart'; diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart new file mode 100644 index 00000000..34a1d454 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -0,0 +1,114 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class AvailabilityInfo extends StatelessWidget { + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => model + .productLocationService + .length == + 0 + ? Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context) + .noLocationAvailable, + ), +// Text('No location Available'), + ) + : ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .productLocationService + .length, + itemBuilder: + (BuildContext context, + int index) { + return Padding( + padding: + EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( +// crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Expanded( + flex: 1, + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model + .productLocationService[ + index] + .locationDescription + + "\n" + + convertCityName( + model + .productLocationService[ + 0] + .cityName + .toString(), + ), + style: TextStyle( + fontSize: + 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .location_on), + color: + Colors.red, + onPressed: + () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .phone), + color: + Colors.red, + onPressed: + () {}, + ), + ), + ], + ), + Divider( + height: 1.2, + color: Colors.grey) + ], + ), + ); + }, + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/details_info.dart b/lib/pages/pharmacies/screens/product-details/details_info.dart new file mode 100644 index 00000000..a347e941 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/details_info.dart @@ -0,0 +1,59 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DetailsInfo extends StatelessWidget { + + final PharmacyProduct product; + + const DetailsInfo({Key key, this.product}) : super(key: key); + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context) + .description, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 10, + ), + Divider(height: 1, color: Colors.grey), + SizedBox( + height: 15, + ), + Container( + child: Text( + projectViewModel.isArabic + ? product.fullDescriptionn + : product + .fullDescription ?? + "", + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + SizedBox( + height: 20, + ), + ]), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/discount_description.dart b/lib/pages/pharmacies/screens/product-details/discount_description.dart new file mode 100644 index 00000000..1c2b27d4 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/discount_description.dart @@ -0,0 +1,48 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:flutter/material.dart'; + +class DiscountDescription extends StatelessWidget { + final PharmacyProduct product; + + const DiscountDescription({Key key, this.product}) : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: Text( + product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footer-widget.dart new file mode 100644 index 00000000..db048b46 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/footer-widget.dart @@ -0,0 +1,492 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import '../cart-order-page.dart'; + +class FooterWidget extends StatefulWidget { + final bool isAvailble; + final int maxQuantity; + final int minQuantity; + final int quantityLimit; + final PharmacyProduct item; + final Function addToCartFunction; + + int price; + bool isOverQuantity; + + FooterWidget(this.isAvailble, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item, {this.price, this.isOverQuantity = false, this.addToCartFunction}); + + @override + _FooterWidgetState createState() => _FooterWidgetState(); +} + +class _FooterWidgetState extends State { + double quantityUI = 70; + bool showUI = false; + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: quantityUI, + color: Colors.white, + child: Column( + children: [ + showUI + ? Container( + width: double.infinity, + height: 90, + color: Colors.white, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).quantity, + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), + ), + ), + + Container( + height: 50.0, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '1', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 1; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '2', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 2; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '3', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 3; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '4', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 4; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '5', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 5; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '6', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 6; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '7', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 7; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '8', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 8; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '9', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 9; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '10', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + widget.price = 10; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + Container( + width: 50.0, + child: TextField( + decoration: + InputDecoration(labelText: 'quantity #'), + onChanged: (text) { + print(widget.price); + print(widget.quantityLimit); + if (int.tryParse(text) == null) { + text = ''; + } else { + setState(() { + widget.price = int.parse(text); + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + } + }); + } + }, + ), + ), + ], + ), + ) + ], + ), + ), + ) + : Container( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 70, + height: 50, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + widget.price.toString(), + style: TextStyle(fontSize: 20), + ), + ), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), + ), + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 70; + showUI = false; + } else { + quantityUI = 150; + showUI = true; + } + }); + }, + ), + ), + !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null + ? Container( + width: 190, + height: 46, + color: Colors.grey, + child: Align( + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).addToCart, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ) + : InkWell( + onTap: () { + widget.addToCartFunction(widget.price, widget.item.id, context); + }, + child: Container( + alignment: Alignment.center, + width: 190, + height: 46, + color: Colors.green, + child: Text( + TranslationBase.of(context).addToCart, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ), + SizedBox( + width: 5, + ), + !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null + ? Container( + width: 120, + height: 46, + color: Colors.grey, + child: Align( + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).buyNow, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ) + : InkWell( + onTap: () { + print('buy now'); + widget.addToCartFunction(widget.price, widget.item.id, context); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + }, + child: Container( + alignment: Alignment.center, + width: 120, + height: 46, + color: Colors.blue, + child: Text( + TranslationBase.of(context).buyNow, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ), + ], + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart new file mode 100644 index 00000000..b0777c19 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -0,0 +1,842 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; +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/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import '../cart-order-page.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; + +import 'availability_info.dart'; +import 'details_info.dart'; +import 'discount_description.dart'; +import 'footer-widget.dart'; + +int price = 0; +bool isOverQuantity = false; +bool isInWishList = false; +bool isSelected = true; +String itemID; +var customerId; +CompareList compareItems = new CompareList(); +PharmacyProduct specificationData; + +class ProductDetailPage extends StatefulWidget { + final PharmacyProduct product; + + ProductDetailPage(this.product); + + @override + __ProductDetailPageState createState() => __ProductDetailPageState(); +} + +class __ProductDetailPageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + + bool isTrue = true; + bool isDetails = true; + bool isReviews = false; + bool isAvailability = false; + + checkWishlist() async { + GifLoaderDialogUtils.showMyDialog(context); + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + + for (int i = 0; i < x.wishListItems.length; i++) { + if (itemID == x.wishListItems[i].product.id) { + isInWishList = true; + break; + } else { + isInWishList = false; + } + } + GifLoaderDialogUtils.hideDialog(context); + setState(() {}); + } + + void initState() { + price = 1; + specificationData = widget.product; + userInfo(); + super.initState(); + } + + void userInfo() async { + print(specificationData); + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = widget.product.id; + checkWishlist(); + } + setState(() {}); + } + + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return customerId != null + ? DetailPageScafold( + appBarTitle: TranslationBase.of(context).productDetails, + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + Image.network( + widget.product.images[0].src.trim(), + ), + if (widget.product.discountDescription != null) + DiscountDescription(product: widget.product) + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + width: 500, + height: 220, + color: Colors.white, + child: ProductNameAndPrice( + context, + widget.product, + customerId: customerId, + addToWishlistFunction: addToWishlistFunction, + deleteFromWishlistFunction: deleteFromWishlistFunction, + notifyMeWhenAvailable: notifyMeWhenAvailable, + isInWishList: isInWishList, + ), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + height: 100, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + Divider(color: Colors.grey), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + TranslationBase.of(context).noData, + ), + ), + ), + ], + ), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + margin: EdgeInsets.only(bottom: 6), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isDetails + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container() + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = true; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isReviews + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = false; + isAvailability = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isAvailability + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? DetailsInfo( + product: widget.product, + ) + : isReviews + ? ReviewsInfo( + product: widget.product, + ) + : isAvailability + ? AvailabilityInfo() + : Container(), + ], + ), + ), + Row( + children: [ + customerId != null + ? Container( + width: 410, + height: 50, + color: Colors.white, + child: Texts( + TranslationBase.of(context).recommended, + bold: true, + ), + ) + : Container(), + ], + ), + RecommendedProducts(product: widget.product) + ], + ), + ), + bottomSheet: FooterWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product, + price: price, + isOverQuantity: isOverQuantity, + addToCartFunction: addToCartFunction, + ), + ) + : AppScaffold( + appBarTitle: TranslationBase.of(context).productDetails, + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + Image.network( + widget.product.images[0].src.trim(), + ), + widget.product.discountDescription != null + ? Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: projectViewModel.isArabic + ? Text( + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ) + : Text( + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ) + : Container(), + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + width: 500, + height: 150, + color: Colors.white, + child: ProductNameAndPrice( + context, + widget.product, + customerId: customerId, + addToWishlistFunction: addToWishlistFunction, + deleteFromWishlistFunction: deleteFromWishlistFunction, + notifyMeWhenAvailable: notifyMeWhenAvailable, + isInWishList: isInWishList, + ), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + height: 120, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + Divider(color: Colors.grey) + ], + ), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + margin: EdgeInsets.only(bottom: 100), +// height: 350, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isDetails + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container() + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = true; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isReviews + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = false; + isAvailability = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isAvailability + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context).description, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 6, + ), + Divider(height: 1, color: Colors.grey), + SizedBox( + height: 10, + ), + Container( + child: Text( + projectViewModel.isArabic + ? widget.product.shortDescriptionn + : widget.product.shortDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + TranslationBase.of(context).howToUse, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 6, + ), + Divider(height: 2, color: Colors.grey), + SizedBox( + height: 10, + ), + Container( + child: Text( + projectViewModel.isArabic + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + ], + ), + ) + : isReviews + ? BaseView( + onModelReady: (model) => + model.getProductReviewsData( + widget.product.id), + builder: (_, model, wi) => model + .productDetailService + .length != + 0 && + model.productDetailService[0] + .reviews.length != + 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model + .productDetailService[0] + .reviews + .length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[ + index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors + .grey, + fontWeight: + FontWeight + .w600), + ), + ), + Container( + margin: + EdgeInsets.only( + left: 210), + child: RatingBar + .readOnly( + initialRating: model + .productDetailService[ + 0] + .reviews[ + index] + .rating + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[index] + .reviewText, + style: TextStyle( + fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context) + .noReviewsAvailable), + ), + ) + : isAvailability + ? BaseView( + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => + ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .productLocationService.length, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model + .productLocationService[ + index] + .locationDescription + + "\n" + + convertCityName( + model + .productLocationService[ + 0] + .cityName + .toString(), + ), + style: TextStyle( + fontSize: 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: + Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], + ), + Divider( + height: 1.2, + color: Colors.grey) + ], + ), + ); + }, + ), + ) + : Container(), + ], + ), + ), + ], + ), + ), + bottomSheet: FooterWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product, + price: price, + isOverQuantity: isOverQuantity, + addToCartFunction: addToCartFunction, + ), + ); + } +} + +convertCityName(txt) { + String stringTxt; + String newTxt; + stringTxt = txt.toString(); + newTxt = stringTxt.split('.')[1]; + + return newTxt; +} + +addToCartFunction(quantity, itemID, BuildContext context) async { + GifLoaderDialogUtils.showMyDialog(context); + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID).then((value) { + GifLoaderDialogUtils.hideDialog(context); + }); +} + +notifyMeWhenAvailable(context, itemId) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.notifyMe(customerId, itemId); +} + +addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishList = true; + await x.addToWishlistData(itemID); +} + +deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishList = false; + await x.deletWishlistData(itemID); +} diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart new file mode 100644 index 00000000..428f49e8 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -0,0 +1,177 @@ + +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class ProductNameAndPrice extends StatefulWidget { + BuildContext context; + PharmacyProduct item; + final customerId; + final bool isInWishList; + final Function notifyMeWhenAvailable; + final Function addToWishlistFunction; + final Function deleteFromWishlistFunction; + + + ProductNameAndPrice(this.context, this.item, + {this.customerId, + this.isInWishList, + this.notifyMeWhenAvailable, + this.addToWishlistFunction, + this.deleteFromWishlistFunction}); + + @override + _ProductNameAndPriceState createState() => _ProductNameAndPriceState(); +} + +class _ProductNameAndPriceState extends State { + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Text( + widget.item.price.toString() + " " + "SAR", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), + ), + SizedBox( + width: 40, + ), + Text( + projectViewModel.isArabic + ? widget.item.stockAvailabilityn + : widget.item.stockAvailability, + style: widget.item.stockAvailability == 'Out of stock' + ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) + : TextStyle( + fontWeight: FontWeight.bold, color: Colors.green), + ), + SizedBox(width: 20), + widget.item.stockAvailability == 'Out of stock' && + widget.customerId != null + ? InkWell( + onTap: () => + widget.notifyMeWhenAvailable(context, widget.item.id), + child: Row(children: [ + Text( + TranslationBase.of(context).notifyMe, + style: TextStyle( + color: Colors.blue, + decoration: TextDecoration.underline, + ), + ), + SizedBox(width: 4), + Icon( + FontAwesomeIcons.bell, + color: Colors.blue, + size: 15.0, + ) + ]), + ) + : Container( + margin: projectViewModel.isArabic + ? EdgeInsets.only(right: 25) + : EdgeInsets.only(left: 25), + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(30), + ), + child: IconButton( + icon: Icon(!widget.isInWishList + ? Icons.favorite_border + : Icons.favorite), + color: !widget.isInWishList ? Colors.white : Colors.red, + onPressed: () async { + if (widget.customerId != null) { + if (!widget.isInWishList) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.addToWishlistFunction(widget.item.id); + GifLoaderDialogUtils.hideDialog(context); + } else { + await widget.deleteFromWishlistFunction(widget.item.id); + } + } else { + return; + } + setState(() {}); + }, + )), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: + projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft, + child: Text( + projectViewModel.isArabic + ? widget.item.fullDescriptionn + : widget.item.fullDescription, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Row( + children: [ + Expanded( + flex: 2, + child: Container( + margin: EdgeInsets.only(right: 150), + child: Align( + alignment: Alignment.bottomLeft, + child: RatingBar.readOnly( + initialRating: 3, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + ), + Expanded( + flex: 1, + child: Container( + child: widget.item.rxMessage != null + ? Text( + projectViewModel.isArabic + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), + style: TextStyle(color: Colors.red, fontSize: 10), + ) + : Container()), + ), + widget.item.rxMessage != null + ? Icon( + FontAwesomeIcons.questionCircle, + color: Colors.red, + size: 15.0, + ) + : Container(), + ], + ), + ], + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/recommended_products.dart b/lib/pages/pharmacies/screens/product-details/recommended_products.dart new file mode 100644 index 00000000..f40f1f08 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/recommended_products.dart @@ -0,0 +1,388 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.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/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class RecommendedProducts extends StatefulWidget { + final PharmacyProduct product; + + const RecommendedProducts({Key key, this.product}) : super(key: key); + + @override + _RecommendedProductsState createState() => _RecommendedProductsState(); +} + +class _RecommendedProductsState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return SingleChildScrollView( + child: Container( + width: 410, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + color: Colors.white, + height: 210, + margin: EdgeInsets.only(bottom: 75), + padding: EdgeInsets.only(bottom: 5), + // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), + child: BaseView( + onModelReady: (model) => model + .getRecommendedProducts(widget.product.id), + builder: (_, model, wi) => Container( + child: + model.recommendedProductList.length != null + ? ListView.builder( + scrollDirection: + Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + itemCount: model + .recommendedProductList + .length, + itemBuilder: (context, index) { + return InkWell( + onTap: () async { + GifLoaderDialogUtils + .showMyDialog( + context); + RecommendedProductModel + data = + model.recommendedProductList[ + index]; + var json = data.toJson(); + PharmacyProduct product = + new PharmacyProduct + .fromJson(json); + await Navigator + .pushReplacement( + context, + FadePage( + page: + ProductDetailPage( + product), + ), + ); + GifLoaderDialogUtils + .hideDialog(context); + }, + child: Card( + elevation: 2, + shape: + RoundedRectangleBorder( + side: BorderSide( + color: Colors + .grey[300], + width: 2), + borderRadius: + BorderRadius + .circular(10), + ), + margin: + EdgeInsets.symmetric( + horizontal: 8, + vertical: 0, + ), + child: Container( + decoration: + BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets + .symmetric( + horizontal: 4), + width: MediaQuery.of( + context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: + Alignment + .topRight, + child: + IconButton( + icon: Icon(model.recommendedProductList[index].isinwishlist != + true + ? Icons + .favorite_border + : Icons + .favorite), + color: model.recommendedProductList[index].isinwishlist != + true + ? Colors + .grey + : Colors + .red, + onPressed: + () async { + if (customerId != + null) { + if (!isInWishList && + model.recommendedProductList[index].isinwishlist != + true) { + GifLoaderDialogUtils.showMyDialog( + context); + await addToWishlistFunction(model + .recommendedProductList[index] + .id); +// checkWishlist(); + GifLoaderDialogUtils.hideDialog( + context); + setState( + () { + model.recommendedProductList[index].isinwishlist = + true; + }); + } else { + GifLoaderDialogUtils.showMyDialog( + context); + await deleteFromWishlistFunction(model + .recommendedProductList[index] + .id); + GifLoaderDialogUtils.hideDialog( + context); + setState( + () { + model.recommendedProductList[index].isinwishlist = + false; + }); + } + } else { + return; + } + setState( + () { + // checkWishlist(); + }); + }, + ), + ), + ), + Container( + margin: EdgeInsets + .fromLTRB( + 0, + 16, + 10, + 16), + alignment: + Alignment + .center, + child: (model.recommendedProductList[index].images != + null && + model.recommendedProductList[index].images.length > + 0) + ? Image + .network( + model + .recommendedProductList[index] + .images[0] + .src + .toString(), + fit: BoxFit + .cover, + height: + 60, + ) + : Image + .asset( + "assets/images/no_image.png", + fit: BoxFit + .cover, + height: + 60, + ), + ), + Container( + width: model + .recommendedProductList[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets + .all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: + BorderRadius + .only( + topLeft: Radius + .circular( + 6), + ), + ), + child: model.recommendedProductList[index] + .rxMessage != + null + ? Texts( + projectViewModel.isArabic + ? model.recommendedProductList[index].rxMessagen + : model.recommendedProductList[index].rxMessage, + color: Colors + .white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), + ), + ]), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + projectViewModel + .isArabic + ? model + .recommendedProductList[ + index] + .namen + : model + .recommendedProductList[index] + .name, + style: + TextStyle( + color: Colors + .black, + fontSize: + 13.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: const EdgeInsets + .only( + top: 10, + bottom: + 5), + child: + Texts( + "SAR ${model.recommendedProductList[index].price}", + bold: + true, + fontSize: + 14, + ), + ), + ], + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: < + Widget>[ + Container( + padding: EdgeInsets.only( + right: + 10), + child: + Align( + alignment: + Alignment + .topLeft, + child: RatingBar + .readOnly( + initialRating: model + .recommendedProductList[index] + .approvedRatingSum + .toDouble(), + size: + 13.0, + filledColor: + Colors.yellow[700], + emptyColor: + Colors.grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons.star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + ), + ), + Texts( + "(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})", +// bold: true, + fontSize: + 12, + ), + ]), + ], + ), + ), + ), + ); + }) + : Container( + // color: Colors.white, + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context) + .nonRecommended, + color: Colors.black, + ), + ], + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart new file mode 100644 index 00000000..a133fce3 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -0,0 +1,92 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class ReviewsInfo extends StatelessWidget { + final PharmacyProduct product; + + const ReviewsInfo({Key key, this.product}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getProductReviewsData(product.id), + builder: (_, model, wi) => model.productDetailService.length != 0 && + model.productDetailService[0].reviews.length != 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model.productDetailService[0].reviews.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model.productDetailService[0].reviews[index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + Container( + margin: EdgeInsets.only(left: 210), + child: RatingBar.readOnly( + initialRating: model.productDetailService[0] + .reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model.productDetailService[0].reviews[index] + .reviewText, + style: TextStyle(fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider(height: 1, color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noReviewsAvailable, + ), +// Text('No Reviews Available'), + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index a7e71fab..c2781a98 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 16720946..42d3e61b 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 45617072..51c535b9 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; diff --git a/lib/widgets/others/app_scafold_detail_page.dart b/lib/widgets/others/app_scafold_detail_page.dart index b7f98b08..99f78062 100644 --- a/lib/widgets/others/app_scafold_detail_page.dart +++ b/lib/widgets/others/app_scafold_detail_page.dart @@ -6,7 +6,9 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; @@ -23,7 +25,7 @@ import '../progress_indicator/app_loader_widget.dart'; import 'arrow_back.dart'; import 'network_base_view.dart'; import 'not_auh_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; class DetailPageScafold extends StatefulWidget { @@ -219,4 +221,49 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { @override Size get preferredSize => Size(double.maxFinite, 60); + + + settingModalBottomSheet(context) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return Container( + child: new Wrap( + children: [ + new ListTile( + leading: Icon(Icons.shopping_cart), + title: Text( + TranslationBase.of(context).addToCart, + ), + onTap: () => { + if (price > 0) + {addToCartFunction(price, itemID, context)} + else + { + AppToast.showErrorToast( + message: "you should add quantity") + } + }), + ListTile( + leading: Icon(Icons.favorite_border), + title: Text( + TranslationBase.of(context).addToWishlist, + ), + onTap: () => {addToWishlistFunction(itemID)}, + ), + ListTile( + leading: Icon(Icons.compare), + title: Text( + TranslationBase.of(context).compare, + ), + onTap: () => { + Provider.of(context, listen: false) + .addItem(specificationData), + }, + ), + ], + ), + ); + }); + } } From 769dc4e0ac0492dc9cfc51d0b4b176180e1a8667 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 4 Oct 2021 16:03:38 +0300 Subject: [PATCH 2/9] first step of ProductDetailPage refactor --- .../screens/product-details/product-detail.dart | 12 ------------ lib/widgets/others/app_scafold_detail_page.dart | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index b0777c19..5f596e3a 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -117,8 +117,6 @@ class __ProductDetailPageState extends State { height: 4, ), Container( - width: 500, - height: 220, color: Colors.white, child: ProductNameAndPrice( context, @@ -134,8 +132,6 @@ class __ProductDetailPageState extends State { height: 6, ), Container( - width: 500, - height: 100, color: Colors.white, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -151,14 +147,6 @@ class __ProductDetailPageState extends State { ), ), Divider(color: Colors.grey), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).noData, - ), - ), - ), ], ), ), diff --git a/lib/widgets/others/app_scafold_detail_page.dart b/lib/widgets/others/app_scafold_detail_page.dart index 99f78062..595e0872 100644 --- a/lib/widgets/others/app_scafold_detail_page.dart +++ b/lib/widgets/others/app_scafold_detail_page.dart @@ -185,6 +185,18 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { ), centerTitle: true, actions: [ + /// TODO Elham* fix this + if(isPharmacy) + IconButton( + icon: Icon(Icons.shopping_cart), + color: Colors.grey, + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartOrderPage()), + ); + }), image != null ? InkWell( onTap: () => Navigator.push( From 2839af658a225a01a40c056714e152f10b0d238f Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 4 Oct 2021 18:03:06 +0300 Subject: [PATCH 3/9] fix issues --- .../product-details/availability_info.dart | 167 ++++++++---------- .../product-details/product-detail.dart | 164 ++++++++++++++--- .../screens/product-details/reviews_info.dart | 140 ++++++++------- 3 files changed, 281 insertions(+), 190 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 34a1d454..0c00d22a 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -2,112 +2,83 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; class AvailabilityInfo extends StatelessWidget { - @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => model - .productLocationService - .length == - 0 - ? Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context) - .noLocationAvailable, - ), -// Text('No location Available'), - ) - : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model - .productLocationService - .length, - itemBuilder: - (BuildContext context, - int index) { - return Padding( - padding: - EdgeInsets.all(8.0), - child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( -// crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Expanded( - flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - model - .productLocationService[ - index] - .locationDescription + - "\n" + - convertCityName( - model - .productLocationService[ - 0] - .cityName - .toString(), + onModelReady: (model) => model.getProductLocationData(), + + builder: (_, model, wi) => NetworkBaseView( + baseViewModel: model, + child: model.productLocationService.length == 0 + ? Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noLocationAvailable, + ), + ) + : ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.productLocationService.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(model + .productLocationService[index].projectImageUrl), ), - style: TextStyle( - fontSize: - 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .location_on), - color: - Colors.red, - onPressed: - () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .phone), - color: - Colors.red, - onPressed: - () {}, - ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model.productLocationService[index] + .locationDescription + + "\n" + + convertCityName( + model.productLocationService[0].cityName + .toString(), + ), + style: TextStyle(fontSize: 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], + ), + Divider(height: 1.2, color: Colors.grey) + ], ), - ], - ), - Divider( - height: 1.2, - color: Colors.grey) - ], - ), - ); - }, + ); + }, + ), ), ); } diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 5f596e3a..d677b9b8 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; @@ -14,6 +15,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -46,13 +48,16 @@ class ProductDetailPage extends StatefulWidget { __ProductDetailPageState createState() => __ProductDetailPageState(); } -class __ProductDetailPageState extends State { +class __ProductDetailPageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; AppSharedPreferences sharedPref = AppSharedPreferences(); bool isTrue = true; bool isDetails = true; bool isReviews = false; bool isAvailability = false; + int _activeTab = 0; checkWishlist() async { GifLoaderDialogUtils.showMyDialog(context); @@ -74,10 +79,18 @@ class __ProductDetailPageState extends State { void initState() { price = 1; specificationData = widget.product; + _tabController = TabController(length: 3, vsync: this); + userInfo(); super.initState(); } + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + void userInfo() async { print(specificationData); customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); @@ -90,6 +103,7 @@ class __ProductDetailPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + final screenSize = MediaQuery.of(context).size; return customerId != null ? DetailPageScafold( @@ -153,15 +167,87 @@ class __ProductDetailPageState extends State { SizedBox( height: 6, ), + // Container( + // height: 500, + // color: Colors.white, + // child: Scaffold( + // backgroundColor: Colors.white, + // extendBodyBehindAppBar: false, + // appBar: PreferredSize( + // preferredSize: Size.fromHeight( + // MediaQuery.of(context).size.height * 0.070), + // child: Container( + // height: MediaQuery.of(context).size.height * 0.070, + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Theme.of(context).dividerColor, + // width: 0.5), //width: 0.7 + // ), + // color: Colors.white), + // child: Center( + // child: TabBar( + // isScrollable: false, + // controller: _tabController, + // // indicatorColor: Colors.transparent, + // indicatorWeight: 1.0, + // indicatorSize: TabBarIndicatorSize.tab, + // indicatorColor:Colors.green, + // labelColor: Theme.of(context).primaryColor, + // labelPadding: EdgeInsets.only( + // top: 0, left: 0, right: 0, bottom: 0), + // unselectedLabelColor: Colors.grey[800], + // tabs: [ + // tabWidget(screenSize, _activeTab == 0, + // TranslationBase.of(context).details, + // ), + // tabWidget(screenSize, _activeTab == 1, + // TranslationBase.of(context).review, + // ), + // tabWidget(screenSize, _activeTab == 2, + // TranslationBase.of(context).availability), + // ], + // ), + // ), + // ), + // ), + // body: Column( + // children: [ + // Expanded( + // child: TabBarView( + // physics: BouncingScrollPhysics(), + // controller: _tabController, + // children: [ + // DetailsInfo( + // product: widget.product, + // ), + // ReviewsInfo( + // product: widget.product, + // ), + // AvailabilityInfo() + // ], + // ), + // ), + // + // ], + // ), + // ), + // ), + + SizedBox( + height: 6, + ), + + //TODO Elham* Remove this Container( - width: 500, + // width: 500, margin: EdgeInsets.only(bottom: 6), color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ @@ -181,13 +267,9 @@ class __ProductDetailPageState extends State { ), color: Colors.white, ), - isDetails - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container() + CustomDivider( + color: isDetails ? Colors.green : Colors.transparent, + ) ], ), SizedBox( @@ -211,13 +293,9 @@ class __ProductDetailPageState extends State { ), color: Colors.white, ), - isReviews - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), + CustomDivider( + color: isReviews ? Colors.green : Colors.transparent, + ), ], ), SizedBox( @@ -241,13 +319,9 @@ class __ProductDetailPageState extends State { ), color: Colors.white, ), - isAvailability - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), + CustomDivider( + color: isAvailability ? Colors.green : Colors.transparent, + ), ], ), ], @@ -795,6 +869,24 @@ class __ProductDetailPageState extends State { } } +class CustomDivider extends StatelessWidget { + const CustomDivider({ + Key key, + this.color, + }) : super(key: key); + + final Color color; + + @override + Widget build(BuildContext context) { + return Container( + width: 120, + height: 2, + color: color, + ); + } +} + convertCityName(txt) { String stringTxt; String newTxt; @@ -828,3 +920,27 @@ deleteFromWishlistFunction(itemID) async { isInWishList = false; await x.deletWishlistData(itemID); } + +//TODO Elham* move to file +Widget tabWidget( + Size screenSize, + bool isActive, + String title, +) { + return Center( + child: Container( + height: screenSize.height * 0.070, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + // color: Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + ], + ), + ), + ); +} diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index a133fce3..ed1970cd 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -14,79 +15,82 @@ class ReviewsInfo extends StatelessWidget { Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getProductReviewsData(product.id), - builder: (_, model, wi) => model.productDetailService.length != 0 && - model.productDetailService[0].reviews.length != 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model.productDetailService[0].reviews.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model.productDetailService[0].reviews[index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + builder: (_, model, wi) => NetworkBaseView( + baseViewModel:model , + child: model.productDetailService.length != 0 && + model.productDetailService[0].reviews.length != 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model.productDetailService[0].reviews.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model.productDetailService[0].reviews[index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), ), - ), - Container( - margin: EdgeInsets.only(left: 210), - child: RatingBar.readOnly( - initialRating: model.productDetailService[0] - .reviews[index].rating - .toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + Container( + margin: EdgeInsets.only(left: 210), + child: RatingBar.readOnly( + initialRating: model.productDetailService[0] + .reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), ), - ), - ], + ], + ), ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model.productDetailService[0].reviews[index] - .reviewText, - style: TextStyle(fontSize: 20), + SizedBox( + height: 10, ), - ), - SizedBox( - height: 50, - ), - Divider(height: 1, color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).noReviewsAvailable, - ), + Container( + child: Text( + model.productDetailService[0].reviews[index] + .reviewText, + style: TextStyle(fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider(height: 1, color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noReviewsAvailable, + ), // Text('No Reviews Available'), - ), + ), + ), ); } } From 6fe41382c0099c147e6598f5b5e9251298306d32 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 5 Oct 2021 11:06:20 +0300 Subject: [PATCH 4/9] first step from design --- .../product-details/product-detail.dart | 26 +- .../product-name-and-price.dart | 225 +++++++++--------- 2 files changed, 132 insertions(+), 119 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index d677b9b8..015e7958 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -119,8 +119,13 @@ class __ProductDetailPageState extends State color: Colors.white, child: Column( children: [ - Image.network( - widget.product.images[0].src.trim(), + if(widget.product.images.isNotEmpty) + Container( + height: MediaQuery.of(context).size.height*.40, + child: Image.network( + widget.product.images[0].src.trim(), + fit: BoxFit.contain, + ), ), if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) @@ -151,16 +156,17 @@ class __ProductDetailPageState extends State mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).specification, - style: TextStyle(fontWeight: FontWeight.bold), - ), + Container( + + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + child: Texts( + TranslationBase.of(context).specification, + fontSize: 15, + fontWeight: FontWeight.bold, ), + width: double.infinity, ), - Divider(color: Colors.grey), + // Divider(color: Colors.grey), ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 428f49e8..14b94269 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -1,8 +1,8 @@ - import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; @@ -17,7 +17,6 @@ class ProductNameAndPrice extends StatefulWidget { final Function addToWishlistFunction; final Function deleteFromWishlistFunction; - ProductNameAndPrice(this.context, this.item, {this.customerId, this.isInWishList, @@ -30,7 +29,6 @@ class ProductNameAndPrice extends StatefulWidget { } class _ProductNameAndPriceState extends State { - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -38,78 +36,72 @@ class _ProductNameAndPriceState extends State { return Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(8.0), + SizedBox(height: 10,), + FractionallySizedBox( + widthFactor: 0.95, child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - widget.item.price.toString() + " " + "SAR", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), - ), - SizedBox( - width: 40, - ), - Text( - projectViewModel.isArabic - ? widget.item.stockAvailabilityn - : widget.item.stockAvailability, - style: widget.item.stockAvailability == 'Out of stock' - ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) - : TextStyle( - fontWeight: FontWeight.bold, color: Colors.green), + Texts(widget.item.price.toString() + " " + "SAR", + fontWeight: FontWeight.bold, fontSize: 20 + ), + Texts( projectViewModel.isArabic + ? widget.item.stockAvailabilityn + : widget.item.stockAvailability, + fontWeight: FontWeight.bold, fontSize: 15, color: widget.item.stockAvailability == 'Out of stock'?Colors.red:Colors.green, ), - SizedBox(width: 20), + // SizedBox(width: 20), widget.item.stockAvailability == 'Out of stock' && - widget.customerId != null + widget.customerId != null ? InkWell( - onTap: () => - widget.notifyMeWhenAvailable(context, widget.item.id), - child: Row(children: [ - Text( - TranslationBase.of(context).notifyMe, - style: TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline, - ), - ), - SizedBox(width: 4), - Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, - ) - ]), - ) + onTap: () => + widget.notifyMeWhenAvailable(context, widget.item.id), + child: Row(children: [ + Texts( + TranslationBase.of(context).notifyMe, + decoration: TextDecoration.underline, + color: Colors.blue, + ), + SizedBox(width: 4), + Icon( + FontAwesomeIcons.bell, + color: Colors.blue, + size: 15.0, + ) + ]), + ) : Container( - margin: projectViewModel.isArabic - ? EdgeInsets.only(right: 25) - : EdgeInsets.only(left: 25), - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: BorderRadius.circular(30), - ), - child: IconButton( - icon: Icon(!widget.isInWishList - ? Icons.favorite_border - : Icons.favorite), - color: !widget.isInWishList ? Colors.white : Colors.red, - onPressed: () async { - if (widget.customerId != null) { - if (!widget.isInWishList) { - GifLoaderDialogUtils.showMyDialog(context); - await widget.addToWishlistFunction(widget.item.id); - GifLoaderDialogUtils.hideDialog(context); - } else { - await widget.deleteFromWishlistFunction(widget.item.id); - } - } else { - return; - } - setState(() {}); - }, - )), + margin: projectViewModel.isArabic + ? EdgeInsets.only(right: 25) + : EdgeInsets.only(left: 25), + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(30), + ), + child: IconButton( + icon: Icon(!widget.isInWishList + ? Icons.favorite_border + : Icons.favorite), + color: !widget.isInWishList ? Colors.white : Colors.red, + onPressed: () async { + if (widget.customerId != null) { + if (!widget.isInWishList) { + GifLoaderDialogUtils.showMyDialog(context); + await widget + .addToWishlistFunction(widget.item.id); + GifLoaderDialogUtils.hideDialog(context); + } else { + await widget + .deleteFromWishlistFunction(widget.item.id); + } + } else { + return; + } + setState(() {}); + }, + )), ], ), ), @@ -118,59 +110,74 @@ class _ProductNameAndPriceState extends State { child: Container( margin: EdgeInsets.only(left: 5), child: Align( - alignment: - projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft, + alignment: projectViewModel.isArabic + ? Alignment.topRight + : Alignment.topLeft, child: Text( projectViewModel.isArabic - ? widget.item.fullDescriptionn - : widget.item.fullDescription, + ? widget.item.namen + : widget.item.name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), ), ), - Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(right: 150), + FractionallySizedBox( + widthFactor: 0.95, + child: Row( + children: [ + Container( child: Align( alignment: Alignment.bottomLeft, - child: RatingBar.readOnly( - initialRating: 3, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + child: Row( + children: [ + RatingBar.readOnly( + initialRating:double.parse( widget.item.approvedRatingSum.toString()), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[400], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + SizedBox(width: 10,), + Texts( + "${widget.item.approvedTotalReviews}", + fontSize: 12, + ), + SizedBox(width: 30,), + Texts( + "(${widget.item.approvedTotalReviews} ${TranslationBase.of(context).review})", + fontSize: 12, + ), + ], ), ), ), - ), - Expanded( - flex: 1, - child: Container( - child: widget.item.rxMessage != null - ? Text( - projectViewModel.isArabic - ? widget.item.rxMessagen.toString() - : widget.item.rxMessage.toString(), - style: TextStyle(color: Colors.red, fontSize: 10), - ) - : Container()), - ), - widget.item.rxMessage != null - ? Icon( - FontAwesomeIcons.questionCircle, - color: Colors.red, - size: 15.0, - ) - : Container(), - ], + Expanded( + flex: 1, + child: Container( + child: widget.item.rxMessage != null + ? Text( + projectViewModel.isArabic + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), + style: TextStyle(color: Colors.red, fontSize: 10), + ) + : Container()), + ), + widget.item.rxMessage != null + ? Icon( + FontAwesomeIcons.questionCircle, + color: Colors.red, + size: 15.0, + ) + : Container(), + ], + ), ), + SizedBox(height: 10,), ], ); } From d4fd95606e31943e0917f3d95b24df423f89e5c2 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 5 Oct 2021 11:40:13 +0300 Subject: [PATCH 5/9] add pharmacy icons for bottom nav --- assets/app_icons/config.json | 178 ++++++++++++++++++ assets/app_icons/fonts/DQIcons.ttf | Bin 28064 -> 32800 bytes lib/d_q_icons_icons.dart | 97 +++++++--- .../pharmacy/bottom_nav_pharmacy_bar.dart | 14 +- .../pharmacy/bottom_nav_pharmacy_item.dart | 7 +- 5 files changed, 265 insertions(+), 31 deletions(-) diff --git a/assets/app_icons/config.json b/assets/app_icons/config.json index e2e1afdb..ceb65b05 100644 --- a/assets/app_icons/config.json +++ b/assets/app_icons/config.json @@ -271,6 +271,184 @@ "search": [ "roboticon" ] + }, + { + "uid": "8ce732688587909ad0a9d8323eaca8ad", + "css": "marquee", + "code": 59590, + "src": "fontelico" + }, + { + "uid": "ec8496ef645f3be7b28147ec60cd9ab1", + "css": "crown-minus", + "code": 59589, + "src": "fontelico" + }, + { + "uid": "36ef9feb0754335302784521267a9ad4", + "css": "crown-plus", + "code": 59588, + "src": "fontelico" + }, + { + "uid": "186dec7a13156bbe2550790c158fb85d", + "css": "crown", + "code": 59587, + "src": "fontelico" + }, + { + "uid": "2a46f1d1c9bd036e17a74e46613c1636", + "css": "ie", + "code": 59586, + "src": "fontelico" + }, + { + "uid": "9c2b737b16ae2c8d66b7bfd29ba5ecd8", + "css": "chrome", + "code": 59584, + "src": "fontelico" + }, + { + "uid": "45861dd1e5ce4fde338bcccf01eeb808", + "css": "opera", + "code": 59585, + "src": "fontelico" + }, + { + "uid": "2bd5f98482d86649958312ea2ab5bb40", + "css": "emo-laugh", + "code": 59576, + "src": "fontelico" + }, + { + "uid": "fc92480dedc439d274d4e3e4b425edf4", + "css": "emo-squint", + "code": 59575, + "src": "fontelico" + }, + { + "uid": "4843d0d6050dd508d4c101a334f46db2", + "css": "emo-shoot", + "code": 59574, + "src": "fontelico" + }, + { + "uid": "04688d76a33ce7a7950e40fae79c08ac", + "css": "emo-cry", + "code": 59573, + "src": "fontelico" + }, + { + "uid": "e4b163acaaa08255819f2f78afe8f075", + "css": "cart_menu_icon", + "code": 59412, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M367.1 624.3H972.6A33.2 33.2 0 0 0 1004.7 601.7L1138.2 164.7A29.6 29.6 0 0 0 1132.9 137.3 34.3 34.3 0 0 0 1106.3 124.9H289.9L266.3 24.5A33 33 0 0 0 233.7 0H33.4A32.4 32.4 0 0 0 0 31.2 32.4 32.4 0 0 0 33.4 62.4H206.9L327.4 569.6A93.8 93.8 0 0 0 267.1 655.5 97.1 97.1 0 0 0 367.2 749.1H972.6A31.3 31.3 0 1 0 972.6 686.7H367.2A31.3 31.3 0 1 1 367.2 624.3ZM1061.9 187.3L947.4 561.9H394L305 187.3ZM1061.9 187.3M315.3 894.6A105.4 105.4 0 1 0 420.7 789.2 105.4 105.4 0 0 0 315.3 894.6ZM420.7 859.4A35.2 35.2 0 1 1 385.6 894.6 35.2 35.2 0 0 1 420.7 859.4ZM420.7 859.4M735.4 894.6A105.4 105.4 0 1 0 840.9 789.2 105.4 105.4 0 0 0 735.4 894.6ZM840.9 859.4A35.2 35.2 0 1 1 805.7 894.6 35.2 35.2 0 0 1 840.9 859.4ZM840.9 859.4", + "width": 1140 + }, + "search": [ + "cart_menu_icon" + ] + }, + { + "uid": "45f50872f02e050e19f0910ca3e0e8e6", + "css": "categories_menu_icon", + "code": 59413, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M332.7 458.9H126.3A126.3 126.3 0 0 1 0 332.7V126.3A126.3 126.3 0 0 1 126.3 0H332.7A126.3 126.3 0 0 1 459 126.3V332.7A126.3 126.3 0 0 1 332.7 458.9ZM126.3 61.2A65.1 65.1 0 0 0 61.2 126.3V332.7A65.1 65.1 0 0 0 126.3 397.8H332.7A65.1 65.1 0 0 0 397.8 332.7V126.3A65.1 65.1 0 0 0 332.7 61.2ZM873.8 458.9H667.3A126.3 126.3 0 0 1 541 332.6V126.3A126.3 126.3 0 0 1 667.3 0H873.9A126.3 126.3 0 0 1 1000.2 126.3V332.7A126.3 126.3 0 0 1 873.8 458.9ZM667.3 61.2A65.1 65.1 0 0 0 602.2 126.3V332.7A65.1 65.1 0 0 0 667.3 397.8H873.9A65.1 65.1 0 0 0 938.9 332.7V126.3A65.1 65.1 0 0 0 873.9 61.3ZM332.7 999.9H126.3A126.3 126.3 0 0 1 0 873.7V667.3A126.3 126.3 0 0 1 126.3 541H332.7A126.3 126.3 0 0 1 459 667.3V873.9A126.3 126.3 0 0 1 332.7 999.9ZM126.3 602.2A65.1 65.1 0 0 0 61.2 667.3V873.9A65.1 65.1 0 0 0 126.3 938.8H332.7A65.1 65.1 0 0 0 397.8 873.8V667.3A65.1 65.1 0 0 0 332.7 602.3ZM873.8 999.9H667.3A126.3 126.3 0 0 1 541 873.7V667.3A126.3 126.3 0 0 1 667.3 541H873.8A126.3 126.3 0 0 1 1000.1 667.3V873.9A126.3 126.3 0 0 1 873.8 999.9ZM667.3 602.2A65.1 65.1 0 0 0 602.2 667.3V873.9A65.1 65.1 0 0 0 667.3 938.8H873.8A65.1 65.1 0 0 0 938.8 873.8V667.3A65.1 65.1 0 0 0 873.8 602.3Z", + "width": 1000 + }, + "search": [ + "categories_menu_icon" + ] + }, + { + "uid": "de65d94899c08a719eb8f9b723f73fc4", + "css": "hmg_logo_icon", + "code": 59414, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M146 835.7S180.9 835.5 205.5 835.5L392.2 836.4C414.4 836.4 433 812.7 434 778.5L434 622.5C434 589.3 448.9 563.3 472 561.7L529.2 561.2C552.3 562.7 568.1 588.9 568.1 622L568.1 778.9C569.2 813.1 584.7 835.5 607.1 835.5L858.4 836.1 858.8 643.3C858.8 610.2 842.9 584.4 819.8 583L718.8 582.5C696.5 582.5 678.9 558.9 677.9 524.7L677.5 472.6C678.6 438.4 696.4 414.8 718.7 414.8L820.2 415.1C843.3 413.6 858.3 386.4 858.3 353.3L858.5 112.8A102.4 102.4 0 0 1 780.8 161.4L610.2 161.4C587.9 161.4 569.4 185.7 568.3 219.9V374.6C567.2 408.8 549.8 432.9 527.5 432.9L475.8 432C453.4 432 435.6 408.6 434.5 374.7L434.5 218.4C433.4 184.3 415.6 161.2 393.4 161.2L145.6 161.2 145.6 353.4C145.6 386.6 161.2 413.1 184.3 414.7L285.8 414.3C308.8 415.8 325.1 443.2 325.1 476.2L324.8 520.7C324.8 553.8 309.1 580.4 286 581.9L184.3 581.7C161.2 583.3 145.6 609.5 145.6 642.6ZM999.3 99.1V902.8A102.2 102.2 0 0 1 896 1000H102.8A101.9 101.9 0 0 1 0 902.8L0 97.6A102.3 102.3 0 0 1 103 0L895.4 0.3A104 104 0 0 1 999.3 99.1Z", + "width": 999 + }, + "search": [ + "hmg_logo_icon" + ] + }, + { + "uid": "baf8798b7336aad03b1d61cacc015142", + "css": "user_menu_icon", + "code": 59415, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M853.6 146.4A500 500 0 0 0 146.4 853.6 500 500 0 0 0 853.6 146.4ZM217 838.5A286.1 286.1 0 0 1 500 586.7 285 285 0 0 1 783 838.5 440.5 440.5 0 0 1 217 838.5ZM500 526.3A151.8 151.8 0 1 1 651.8 374.5 152.1 152.1 0 0 1 500 526.3ZM833.4 788.8A344.4 344.4 0 0 0 617.6 548.7 210.5 210.5 0 1 0 382.1 548.7 344.2 344.2 0 0 0 166.3 788.7 441.4 441.4 0 1 1 833.2 788.7ZM833.4 788.8", + "width": 1000 + }, + "search": [ + "user_menu_icon" + ] + }, + { + "uid": "d3f621623139837ff2fb5fe09cf16994", + "css": "cart_menu_icon-1", + "code": 59416, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M367.1 624.3H972.6A33.2 33.2 0 0 0 1004.7 601.7L1138.2 164.7A29.6 29.6 0 0 0 1132.9 137.3 34.3 34.3 0 0 0 1106.3 124.9H289.9L266.3 24.5A33 33 0 0 0 233.7 0H33.4A32.4 32.4 0 0 0 0 31.2 32.4 32.4 0 0 0 33.4 62.4H206.9L327.4 569.6A93.8 93.8 0 0 0 267.1 655.5 97.1 97.1 0 0 0 367.2 749.1H972.6A31.3 31.3 0 1 0 972.6 686.7H367.2A31.3 31.3 0 1 1 367.2 624.3ZM1061.9 187.3L947.4 561.9H394L305 187.3ZM1061.9 187.3M315.3 894.6A105.4 105.4 0 1 0 420.7 789.2 105.4 105.4 0 0 0 315.3 894.6ZM420.7 859.4A35.2 35.2 0 1 1 385.6 894.6 35.2 35.2 0 0 1 420.7 859.4ZM420.7 859.4M735.4 894.6A105.4 105.4 0 1 0 840.9 789.2 105.4 105.4 0 0 0 735.4 894.6ZM840.9 859.4A35.2 35.2 0 1 1 805.7 894.6 35.2 35.2 0 0 1 840.9 859.4ZM840.9 859.4", + "width": 1140 + }, + "search": [ + "cart_menu_icon" + ] + }, + { + "uid": "6aac6f399374da0b9c4811b6a7110627", + "css": "categories_menu_icon-1", + "code": 59417, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M332.7 458.9H126.3A126.3 126.3 0 0 1 0 332.7V126.3A126.3 126.3 0 0 1 126.3 0H332.7A126.3 126.3 0 0 1 459 126.3V332.7A126.3 126.3 0 0 1 332.7 458.9ZM126.3 61.2A65.1 65.1 0 0 0 61.2 126.3V332.7A65.1 65.1 0 0 0 126.3 397.8H332.7A65.1 65.1 0 0 0 397.8 332.7V126.3A65.1 65.1 0 0 0 332.7 61.2ZM873.8 458.9H667.3A126.3 126.3 0 0 1 541 332.6V126.3A126.3 126.3 0 0 1 667.3 0H873.9A126.3 126.3 0 0 1 1000.2 126.3V332.7A126.3 126.3 0 0 1 873.8 458.9ZM667.3 61.2A65.1 65.1 0 0 0 602.2 126.3V332.7A65.1 65.1 0 0 0 667.3 397.8H873.9A65.1 65.1 0 0 0 938.9 332.7V126.3A65.1 65.1 0 0 0 873.9 61.3ZM332.7 999.9H126.3A126.3 126.3 0 0 1 0 873.7V667.3A126.3 126.3 0 0 1 126.3 541H332.7A126.3 126.3 0 0 1 459 667.3V873.9A126.3 126.3 0 0 1 332.7 999.9ZM126.3 602.2A65.1 65.1 0 0 0 61.2 667.3V873.9A65.1 65.1 0 0 0 126.3 938.8H332.7A65.1 65.1 0 0 0 397.8 873.8V667.3A65.1 65.1 0 0 0 332.7 602.3ZM873.8 999.9H667.3A126.3 126.3 0 0 1 541 873.7V667.3A126.3 126.3 0 0 1 667.3 541H873.8A126.3 126.3 0 0 1 1000.1 667.3V873.9A126.3 126.3 0 0 1 873.8 999.9ZM667.3 602.2A65.1 65.1 0 0 0 602.2 667.3V873.9A65.1 65.1 0 0 0 667.3 938.8H873.8A65.1 65.1 0 0 0 938.8 873.8V667.3A65.1 65.1 0 0 0 873.8 602.3Z", + "width": 1000 + }, + "search": [ + "categories_menu_icon" + ] + }, + { + "uid": "0a4cf1ff2671b9ea852d635e27df1e69", + "css": "hmg_logo_icon-1", + "code": 59418, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M146 835.7S180.9 835.5 205.5 835.5L392.2 836.4C414.4 836.4 433 812.7 434 778.5L434 622.5C434 589.3 448.9 563.3 472 561.7L529.2 561.2C552.3 562.7 568.1 588.9 568.1 622L568.1 778.9C569.2 813.1 584.7 835.5 607.1 835.5L858.4 836.1 858.8 643.3C858.8 610.2 842.9 584.4 819.8 583L718.8 582.5C696.5 582.5 678.9 558.9 677.9 524.7L677.5 472.6C678.6 438.4 696.4 414.8 718.7 414.8L820.2 415.1C843.3 413.6 858.3 386.4 858.3 353.3L858.5 112.8A102.4 102.4 0 0 1 780.8 161.4L610.2 161.4C587.9 161.4 569.4 185.7 568.3 219.9V374.6C567.2 408.8 549.8 432.9 527.5 432.9L475.8 432C453.4 432 435.6 408.6 434.5 374.7L434.5 218.4C433.4 184.3 415.6 161.2 393.4 161.2L145.6 161.2 145.6 353.4C145.6 386.6 161.2 413.1 184.3 414.7L285.8 414.3C308.8 415.8 325.1 443.2 325.1 476.2L324.8 520.7C324.8 553.8 309.1 580.4 286 581.9L184.3 581.7C161.2 583.3 145.6 609.5 145.6 642.6ZM999.3 99.1V902.8A102.2 102.2 0 0 1 896 1000H102.8A101.9 101.9 0 0 1 0 902.8L0 97.6A102.3 102.3 0 0 1 103 0L895.4 0.3A104 104 0 0 1 999.3 99.1Z", + "width": 999 + }, + "search": [ + "hmg_logo_icon" + ] + }, + { + "uid": "d19eb878f1dee49848276b6d0faa6602", + "css": "wishlist_menu_icon", + "code": 59411, + "src": "custom_icons", + "selected": false, + "svg": { + "path": "M877.6 0A394.8 394.8 0 0 0 600.7 112.2 394.8 394.8 0 0 0 323.8 0 332.4 332.4 0 0 0 0 349 515.4 515.4 0 0 0 138.3 679.5 1351.1 1351.1 0 0 0 580.3 995.3 46.9 46.9 0 0 0 621.1 995.3 1351.1 1351.1 0 0 0 1063.1 679.5 515.4 515.4 0 0 0 1201.4 349 332.5 332.5 0 0 0 877.6 0ZM991.8 618.5A1233.8 1233.8 0 0 1 600.7 900.8 1233.7 1233.7 0 0 1 209.5 618.5 418.4 418.4 0 0 1 93.8 349 239.1 239.1 0 0 1 323.8 93.8 297.2 297.2 0 0 1 500.6 150.7 283.5 283.5 0 0 1 562 209.5 46.5 46.5 0 0 0 600.5 230H600.5A46.9 46.9 0 0 0 639.1 209.3 301.2 301.2 0 0 1 877.2 93.8 239.2 239.2 0 0 1 1107.1 349 418.4 418.4 0 0 1 991.8 618.5Z", + "width": 1201 + }, + "search": [ + "wishlist_menu_icon" + ] } ] } \ No newline at end of file diff --git a/assets/app_icons/fonts/DQIcons.ttf b/assets/app_icons/fonts/DQIcons.ttf index bc92c83de143966170d64f05992da0c9495e33f0..e0a15c88fa043bde0c93d16c0bde22f39f2e3a8f 100644 GIT binary patch delta 5201 zcmb_gX>c6Zaen<~?_*|Eqv+e!s-N zBj#(|B-Sm2GATZ6q_}%E49jq9^?BH8zo}1k44b{Y`VVldXgFQ3v$42$k*f8dbHnvJ zxQ;vAyC{FEzOL(V@!VIjz7xwsj8?PM|B0Aa&8&3IkVj#bd^V;-v(5j~z zsD870vtB2pN~&V@_391AZ#;nQvZR-6TYZ|Qk|L3aOcc^6eZ)@!BuJV_h^Qn?A|y&; zID={RRl2r%gPH{g8wI|g!x47F{Rm6#qa1c_J8id1=s@x!)fK-(R;Z&rGeqyAz z_al#_w+|qXq_=+^c_hNx{zZduaisc<2H`SE^_w~!A-G~vz0n|CJE^|eAlwD1{#Ao; zKcxEY2I0;~^*as1J(4PdixKXYRBtwj#8$5x(rVYO+>7~G{-wgU;^pEyrJ2%O-M;SY zJ&~T*ddt1feC_*&S0^=Vy{(nI>l4)PH)LXHyB674FMyv2k$n#@8Q z#7v^R8N580Rj!1pd?Fr=CGth!qFfY2S(n6kTI!NT6I0}jzfA~B^a;D$@T^gCt!Y2> zaUT0$J4Mm?%DF%kKnOK^=@U+m$GQF@zUg;Pt^eIo`m1%Ra%9VvHYusP=6FdANumI~ zzahHiu)*s>0H*9tPry?%*gBfL%>f>;;t6`-_1dT4?0UIv%a$V*mzorC7!9fUegW3e zmKH+lbKJk8RlFolN@N!qB~KEKTtWQAV_Db&`3h`?E)_x`^1#JRSfXvZil|A%AHI$D z|1i*jw`09A{A(2d9!w;HZ?hK-eTZWHr*{<^>-i8};1hQz(C2~YHYUNDYAYYETRZgO zI@V9ySoLoV%7RjTmaC!*b|V-`shCp`jD>u0D=@38kW)(eL@ zBGByrh2*C(|L6TtlzhP-xe_F-VLoNOS*-(O1O7 zoh1jzL4;o-nK0u%O^OPNT&h5+m`p&0A`}&q*_2Fp5uON6tRpZX3&{$;Vm!zS_QKA3 z7rnFDWahNP$1iExr5iDPZrtV8m!nZx*-vjA|KL#ipzB}RwbIwOva4V5`4srr#$Y&NP5bq* zrY0{vJ3RdCrDW*h@W{!9`Niu^_*`F{UpR@5H`MRc|C}4;yciq{q@T>74PpXi2TqX{ zIoCrG78OV`%0dp^Z<51cl5vZ89!o|1b%yVX zfGVPhso4)?oAcsfa0-D?(%Vm;Qk?Xa3W#%W$-C1tcjOLI~Q z29&^#xYe2#d6$b9(^hMI2a1A9vbn{bsu*j3<4X7JNau3t?d3MdCj)jTSW~Tn4Gc!R z6twXzXZMR9At^qwZ*SHmL=iuC>N9xB58-{2Am_||rd6LCcj zQ%R-RyjYT2VkQaI8jj2^7B-iZXiSIQlARqCp<75MnE#5U9&`*kcndIZ;mo+YMq3rD zx++)b3Zp|S?0m543Jo{?A#;=D3#8Sc)4^5twvP-tU`>uh+Z>*_ulrMb+;O`vowUnRQ^+1lazi>i2IKt!*~y0k znbu^mMaia&e;jU)MB2kg6p>o2{s3>4g2~+n_s7GrkZ~eqG8+Im3Qcmhshk%lO>Qe_ zs{F!^sOZI|c!0A@A)YgU6=nff4wkToI_>kI%A&Yorx;jPLT^7y}272NV6uvs16bu({O0LOyYkxfATnpFg_C?vn+_(9G1| zpO_gETy0?&HCaD;;T*u(3*$x;Cxq!3GnUpKj%1k4YI82fU|WhywjLB*5XrdELyvWI zaGhOa*xa27V<1|uf0=uV-o}irMD`KPbM?d2fS{~&%1Vx{O%Ebjh%$)Y)8U%KklWCC zQ7P#MNmJwo!t)7Zl&2WMe$YD;b6T1+PHFqD5c8Osqe6R>3bEtxYVYhl9b(O3LQA(t zI6i*-_&SGh>#t0XKR$4+Z=f|p!|Pf4d+Ldg?;L-L-Y#uIPnf-G$SiRtFdL|whT2`N z?b-(woP{Ye?$-9&XjmCLbYN2lg<@x}(!W~{&y`0vQEnbXGG5ImxL;ym5im2&V9tnH zHl9bNLKP#PKa8(fl|&X&OC~(WU{tXIr*E|aEqEJ=Ds)vKpVa{VV|i+N*9+dE`Cj;= zNN3k}O!!(wxx4h{*^52PBR=|L$IlHCK-d~a%_A9mLBi#bkv6nD`? zI`FoQv4tlSc|G71*^Pidu@PpHcf;hyJ)+3)C)2|RONAglh0?*{A8b^b^4$l9r~9)h z7tgy=*-vKE0zT>N=h|BL>>M4rF*3SyPix!VipFY>9oql&`SVZjKlFatI36?H_i%B2 zWDhx{8#vL3c@4Z^j>DG5P}Ep(Nyd1Lp)iW+4Q{0nEh3nb*jSOxxgu^X4qdVo$825C z6xewx6*+DHldl|mZTG&m4nw4OTmQiw#n1K)q}rhz?(W#!l}+*4wuzC$PX%g!YumbM zm+GgTe4_bt$H(?Q+T5y&0WlMZ)UK8L*ZOMT%RDpK(o_7X7&jWwFSE`>XKw%SiLUbY z&Th#W{OscskIx<$$zm!cx_q+Bl4yDM(Y8)4(=sse_|Z$jt)kM}{?yPZm#y}r{wGbAI<{el?{fMlsc1mtZRS*GTRG7t z1#Em&>Z+)@P`Dh^1_qtHFBDId+d5Nb8!rZ;DOgVRw7zeiwI8w}uWncgani67!^s{pMDQ#7 z?#@1l6z$=mq9Y|&xF0L|LR9))#(6McG=`Ylu(AP}+GTjb z2Y%32F`jV5j5n@;AGQi!WLg-%Zc_QTwU>)_KO^l04)m1XiD!eHS`c=jXl+onPDZ%IKri@F= rQ!C?icFH)hvUGOQ7S)UP<@qzG>HEN2)P zQZ{6yCZ@=gRm%X?J^*5~44?qVc~%D?dk+w+WaO4q_^ki`9BAGXAU_}{KRI#sw8|4e z{R@D6t=zfH14CvF(84bT`NbvKmxN|AFys^f6&Wxv zGB7X){m)`xU_JK#`~Tmp%^(pJAOaQviVC=;Fvs)Td}ZKfegRT(``zp#FdC>ginWE(0mvi~!O8NB1&miGPhhm?76Mxp1yr_d@-4g=F0eQYgBw^43rPHh(EtBHk^w{l`7Dz!F==j=XXa+)V)z0S0RiF3CM?e; te`3`DI%l&5+s2g1j@9oN4JI4Z9A-4w{G}$5kx^uFSe?e?IdxBfN&vflX~h5l diff --git a/lib/d_q_icons_icons.dart b/lib/d_q_icons_icons.dart index 5d1ff3c6..7376b1ca 100644 --- a/lib/d_q_icons_icons.dart +++ b/lib/d_q_icons_icons.dart @@ -11,7 +11,7 @@ /// fonts: /// - asset: fonts/DQIcons.ttf /// -/// +/// /// import 'package:flutter/widgets.dart'; @@ -19,25 +19,80 @@ class DQIcons { DQIcons._(); static const _kFontFam = 'DQIcons'; - static const _kFontPkg = null; + static const String _kFontPkg = null; - static const IconData blood_pressure = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData blood = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData bmi = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData heart = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData height = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData outline = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData thermometer = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight_scale = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData parking_icon = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData blood_type_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData height_icon = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData online_payment_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_medicine_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vital_sign_icon = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight_icon = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData my_medical_file = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData family = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData calendar__2_ = IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData roboticon = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood_pressure = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData bmi = + IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData heart = + IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData height = + IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData outline = + IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData thermometer = + IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData weight_scale = + IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData parking_icon = + IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood_type_icon = + IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData height_icon = + IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData online_payment_icon = + IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_medicine_icon = + IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData vital_sign_icon = + IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData weight_icon = + IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData my_medical_file = + IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData family = + IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData calendar__2_ = + IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData roboticon = + IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData cart_menu_icon = + IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData categories_menu_icon = + IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData hmg_logo_icon = + IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData user_menu_icon = + IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData cart_menu_icon_1 = + IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData categories_menu_icon_1 = + IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData hmg_logo_icon_1 = + IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData emo_cry = + IconData(0xe8b5, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData emo_shoot = + IconData(0xe8b6, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData emo_squint = + IconData(0xe8b7, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData emo_laugh = + IconData(0xe8b8, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData chrome = + IconData(0xe8c0, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData opera = + IconData(0xe8c1, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ie = + IconData(0xe8c2, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData crown = + IconData(0xe8c3, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData crown_plus = + IconData(0xe8c4, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData crown_minus = + IconData(0xe8c5, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData marquee = + IconData(0xe8c6, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart index ef861c56..d1490d74 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/d_q_icons_icons.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; @@ -17,7 +18,6 @@ class BottomNavPharmacyBar extends StatefulWidget { } class _BottomNavPharmacyBarState extends State { - _changeIndex(int index) { widget.changeIndex(index); } @@ -43,8 +43,8 @@ class _BottomNavPharmacyBarState extends State { title: TranslationBase.of(context).Alhabibapp, ), BottomNavPharmacyItem( - icon: EvaIcons.list, - activeIcon: EvaIcons.list, + icon: DQIcons.categories_menu_icon, + activeIcon: DQIcons.categories_menu_icon, changeIndex: _changeIndex, index: widget.index, currentIndex: 1, @@ -59,16 +59,16 @@ class _BottomNavPharmacyBarState extends State { isHome: true, title: TranslationBase.of(context).home), BottomNavPharmacyItem( - icon: EvaIcons.person, - activeIcon: EvaIcons.person, + icon: DQIcons.user_menu_icon, + activeIcon: DQIcons.user_menu_icon, changeIndex: _changeIndex, index: widget.index, currentIndex: 2, title: TranslationBase.of(context).myAccount, ), BottomNavPharmacyItem( - icon: EvaIcons.shoppingCartOutline, - activeIcon: EvaIcons.shoppingCartOutline, + icon: DQIcons.cart_menu_icon, + activeIcon: DQIcons.cart_menu_icon, changeIndex: _changeIndex, index: widget.index, currentIndex: 3, diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index f31fa588..76a829cd 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -38,14 +38,15 @@ class BottomNavPharmacyItem extends StatelessWidget { highlightColor: Colors.transparent, splashColor: Colors.transparent, onTap: () { - if(!Provider.of(context, listen: false).isLogin && (currentIndex == 2|| currentIndex == 3)) + if (!Provider.of(context, listen: false) + .isLogin && + (currentIndex == 2 || currentIndex == 3)) Navigator.push( context, FadePage(page: WelcomeLogin()), ); else - changeIndex(currentIndex); - + changeIndex(currentIndex); }, child: Column( mainAxisSize: MainAxisSize.min, From d5f1a162c0be57cd4de91678c37a44bf4f84a7b1 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 5 Oct 2021 12:13:33 +0300 Subject: [PATCH 6/9] replace bottom sheet button --- .../screens/product-details/details_info.dart | 15 +-- .../product-details/footer-widget.dart | 112 ++++++------------ .../product-details/product-detail.dart | 39 +++--- .../product-name-and-price.dart | 5 +- lib/widgets/buttons/secondary_button.dart | 7 +- 5 files changed, 73 insertions(+), 105 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/details_info.dart b/lib/pages/pharmacies/screens/product-details/details_info.dart index a347e941..bc5e7f80 100644 --- a/lib/pages/pharmacies/screens/product-details/details_info.dart +++ b/lib/pages/pharmacies/screens/product-details/details_info.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -22,13 +23,11 @@ class DetailsInfo extends StatelessWidget { CrossAxisAlignment.start, children: [ Container( - child: Text( + child: Texts( TranslationBase.of(context) .description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + fontSize: 17, + color: Colors.grey, ), ), SizedBox( @@ -39,15 +38,13 @@ class DetailsInfo extends StatelessWidget { height: 15, ), Container( - child: Text( + child: Texts( projectViewModel.isArabic ? product.fullDescriptionn : product .fullDescription ?? "", - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), + fontSize: 16, ), ), SizedBox( diff --git a/lib/pages/pharmacies/screens/product-details/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footer-widget.dart index db048b46..72a76f39 100644 --- a/lib/pages/pharmacies/screens/product-details/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footer-widget.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -9,7 +10,7 @@ class FooterWidget extends StatefulWidget { final bool isAvailble; final int maxQuantity; final int minQuantity; - final int quantityLimit; + final int quantityLimit; final PharmacyProduct item; final Function addToCartFunction; @@ -403,84 +404,47 @@ class _FooterWidgetState extends State { }, ), ), - !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 190, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - widget.addToCartFunction(widget.price, widget.item.id, context); - }, - child: Container( - alignment: Alignment.center, - width: 190, - height: 46, - color: Colors.green, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), + + Container( + width: MediaQuery.of(context).size.width* 0.4, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () { + widget.addToCartFunction(widget.price, widget.item.id, context); + }, + borderRadius: 5, + color:Colors.green, + + ), ), + SizedBox( width: 5, ), - !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 120, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - print('buy now'); - widget.addToCartFunction(widget.price, widget.item.id, context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - child: Container( - alignment: Alignment.center, - width: 120, - height: 46, - color: Colors.blue, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), + + Container( + width: MediaQuery.of(context).size.width* 0.3, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () { + widget.addToCartFunction( + widget.price, widget.item.id, context); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + }, + borderRadius: 5, + color: !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null?Colors.grey:Colors.grey[800], ), ), ], diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 015e7958..2a1bfc3f 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -157,8 +157,7 @@ class __ProductDetailPageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - - padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), child: Texts( TranslationBase.of(context).specification, fontSize: 15, @@ -349,22 +348,26 @@ class __ProductDetailPageState extends State ], ), ), - Row( - children: [ - customerId != null - ? Container( - width: 410, - height: 50, - color: Colors.white, - child: Texts( - TranslationBase.of(context).recommended, - bold: true, - ), - ) - : Container(), - ], - ), - RecommendedProducts(product: widget.product) + + ///TODO Elham* check if we need recommanded + // Row( + // children: [ + // customerId != null + // ? Container( + // width: 410, + // height: 50, + // color: Colors.white, + // child: Texts( + // TranslationBase.of(context).recommended, + // bold: true, + // ), + // ) + // : Container(), + // ], + // ), + // RecommendedProducts(product: widget.product) + + SizedBox(height: 80,) ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 14b94269..0be6a213 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -143,12 +143,13 @@ class _ProductNameAndPriceState extends State { ), SizedBox(width: 10,), Texts( - "${widget.item.approvedTotalReviews}", + "${widget.item.approvedRatingSum}", + fontWeight: FontWeight.bold, fontSize: 12, ), SizedBox(width: 30,), Texts( - "(${widget.item.approvedTotalReviews} ${TranslationBase.of(context).review})", + "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", fontSize: 12, ), ], diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8c4ba851..9d5df436 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -29,7 +29,7 @@ class SecondaryButton extends StatefulWidget { this.small = false, this.disabled = false, this.borderColor, - this.noBorderRadius = false}) + this.noBorderRadius = false, this.borderRadius}) : super(key: key); final String label; @@ -43,6 +43,9 @@ class SecondaryButton extends StatefulWidget { final bool iconOnly; final bool disabled; final bool noBorderRadius; + final double borderRadius; + + @override _SecondaryButtonState createState() => _SecondaryButtonState(); @@ -169,7 +172,7 @@ class _SecondaryButtonState extends State child: ClipRRect( borderRadius: widget.noBorderRadius ? BorderRadius.all(Radius.circular(0.0)) - : BorderRadius.all(Radius.circular(10.0)), + : BorderRadius.all(Radius.circular(widget.borderRadius??10.0)), child: Stack( children: [ Positioned( From e20e90c20cb4156f10c82d5d73f4fe6585d62303 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 5 Oct 2021 14:38:15 +0300 Subject: [PATCH 7/9] fix quantity_box --- .../product-details/footer-widget.dart | 456 ------------------ .../product-details/footor/footer-widget.dart | 240 +++++++++ .../product-details/footor/quantity_box.dart | 42 ++ .../product-details/product-detail.dart | 2 +- 4 files changed, 283 insertions(+), 457 deletions(-) delete mode 100644 lib/pages/pharmacies/screens/product-details/footer-widget.dart create mode 100644 lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart create mode 100644 lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart diff --git a/lib/pages/pharmacies/screens/product-details/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footer-widget.dart deleted file mode 100644 index 72a76f39..00000000 --- a/lib/pages/pharmacies/screens/product-details/footer-widget.dart +++ /dev/null @@ -1,456 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; - -import '../cart-order-page.dart'; - -class FooterWidget extends StatefulWidget { - final bool isAvailble; - final int maxQuantity; - final int minQuantity; - final int quantityLimit; - final PharmacyProduct item; - final Function addToCartFunction; - - int price; - bool isOverQuantity; - - FooterWidget(this.isAvailble, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item, {this.price, this.isOverQuantity = false, this.addToCartFunction}); - - @override - _FooterWidgetState createState() => _FooterWidgetState(); -} - -class _FooterWidgetState extends State { - double quantityUI = 70; - bool showUI = false; - - @override - Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: quantityUI, - color: Colors.white, - child: Column( - children: [ - showUI - ? Container( - width: double.infinity, - height: 90, - color: Colors.white, - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).quantity, - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), - ), - ), - - Container( - height: 50.0, - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '1', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 1; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '2', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 2; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '3', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 3; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '4', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 4; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '5', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 5; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '6', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 6; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '7', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 7; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '8', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 8; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '9', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 9; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '10', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - widget.price = 10; - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - return widget.price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - Container( - width: 50.0, - child: TextField( - decoration: - InputDecoration(labelText: 'quantity #'), - onChanged: (text) { - print(widget.price); - print(widget.quantityLimit); - if (int.tryParse(text) == null) { - text = ''; - } else { - setState(() { - widget.price = int.parse(text); - if (widget.price >= widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - } - }); - } - }, - ), - ), - ], - ), - ) - ], - ), - ), - ) - : Container( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 70, - height: 50, - child: FlatButton( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 4, - child: Text( - widget.price.toString(), - style: TextStyle(fontSize: 20), - ), - ), - Expanded( - flex: 5, - child: Text( - TranslationBase.of(context).quantityShortcut, - style: TextStyle(fontSize: 16), - ), - ), - ], - ), - onPressed: () { - setState(() { - if (showUI) { - quantityUI = 70; - showUI = false; - } else { - quantityUI = 150; - showUI = true; - } - }); - }, - ), - ), - - Container( - width: MediaQuery.of(context).size.width* 0.4, - child: SecondaryButton( - label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null, - onTap: () { - widget.addToCartFunction(widget.price, widget.item.id, context); - }, - borderRadius: 5, - color:Colors.green, - - - ), - ), - - SizedBox( - width: 5, - ), - - Container( - width: MediaQuery.of(context).size.width* 0.3, - child: SecondaryButton( - label: TranslationBase.of(context).buyNow.toUpperCase(), - disabled: !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null, - onTap: () { - widget.addToCartFunction( - widget.price, widget.item.id, context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - borderRadius: 5, - color: !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null?Colors.grey:Colors.grey[800], - ), - ), - ], - ), - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart new file mode 100644 index 00000000..cca4eef5 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -0,0 +1,240 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.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'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../cart-order-page.dart'; + +class FooterWidget extends StatefulWidget { + final bool isAvailable; + final int maxQuantity; + final int minQuantity; + final int quantityLimit; + final PharmacyProduct item; + final Function addToCartFunction; + + int price; + bool isOverQuantity; + + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item, + {this.price, this.isOverQuantity = false, this.addToCartFunction}); + + @override + _FooterWidgetState createState() => _FooterWidgetState(); +} + +class _FooterWidgetState extends State { + double quantityUI = 70; + bool showUI = false; + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + width: double.infinity, + height: quantityUI, + child: Column( + children: [ + showUI + ? Container( + width: double.infinity, + height: 100, + color: Colors.white, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Quantity", + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), + ), + ), + InkWell( + child: Icon(Icons.close, color: Colors.black), + onTap: () { + setState(() { + quantityUI = 70; + showUI = false; + }); + }, + ) + ], + mainAxisAlignment: MainAxisAlignment.spaceBetween, + ), + Container( + height: 50.0, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + SizedBox( + width: 5, + ), + for (int i = 1; i <= 10; i++) + QuantityBox( + label: i, + onTapFunc: onChangeValue, + isSelected: widget.price == i), + Column( + children: [ + Container( + width: 100, + decoration: BoxDecoration( + border: + Border.all(color: Colors.grey[300]), + color: Colors.white, + ), + child: TextField( + decoration: InputDecoration( + labelText: 'quantity #'), + onChanged: (text) { + print(widget.price); + print(widget.quantityLimit); + if (int.tryParse(text) == null) { + text = ''; + } else { + setState(() { + widget.price = int.parse(text); + if (widget.price >= + widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + } + }); + } + }, + ), + ), + ], + ), + ], + ), + ) + ], + ), + ), + ) + : Container( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 70, + height: 50, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + widget.price.toString(), + style: TextStyle(fontSize: 20), + ), + ), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), + ), + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 70; + showUI = false; + } else { + quantityUI = 150; + showUI = true; + } + }); + }, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: !widget.isAvailable && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () { + widget.addToCartFunction( + widget.price, widget.item.id, context); + }, + borderRadius: 5, + color: Colors.green, + ), + ), + SizedBox( + width: 5, + ), + Container( + width: MediaQuery.of(context).size.width * 0.3, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: !widget.isAvailable && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () { + widget.addToCartFunction( + widget.price, widget.item.id, context); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + }, + borderRadius: 5, + color: !widget.isAvailable && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null + ? Colors.grey + : Colors.grey[800], + ), + ), + ], + ), + ], + ), + ); + } + + onChangeValue(int i) { + setState(() { + ///TODO Elham* Check this if its good + widget.price = i; + if (widget.price >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.price; + } + }); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart b/lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart new file mode 100644 index 00000000..35e69e0c --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; + +class QuantityBox extends StatelessWidget { + final int label; + final bool isSelected; + final Function(int) onTapFunc; + + QuantityBox({ + Key key, + this.label, + this.onTapFunc, this.isSelected = false, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + InkWell( + child: Container( + decoration: BoxDecoration( + border: Border.all(color:isSelected?Colors.green: Colors.grey[300]), + color: Colors.white, + ), + alignment: Alignment.center, + width: 50.0, + + child: Text( + '$label', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ), + ), + onTap:(){ + onTapFunc(label); + } + ), + SizedBox( + width: 5, + ) + ], + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 2a1bfc3f..71dbbddd 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -28,7 +28,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'availability_info.dart'; import 'details_info.dart'; import 'discount_description.dart'; -import 'footer-widget.dart'; +import 'footor/footer-widget.dart'; int price = 0; bool isOverQuantity = false; From f3000d0ee3470af81c55511bb3ae95b7063682b0 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 5 Oct 2021 14:54:09 +0300 Subject: [PATCH 8/9] My account design fix --- lib/pages/pharmacy/profile/profile.dart | 577 ++++++------------ lib/widgets/pharmacy/my_account_items.dart | 50 ++ lib/widgets/pharmacy/my_account_services.dart | 52 ++ 3 files changed, 301 insertions(+), 378 deletions(-) create mode 100644 lib/widgets/pharmacy/my_account_items.dart create mode 100644 lib/widgets/pharmacy/my_account_services.dart 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/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, + ), + ], + ), + ), + ); + } +} From bb96201c2e5ee6a02bc41a663d687fb669cbaad2 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 5 Oct 2021 15:15:17 +0300 Subject: [PATCH 9/9] remove the custom scaffold --- .../screens/product-details/CustomIcon.dart | 29 ++++++++ .../product-details/ProductAppBar.dart | 66 +++++++++++++++++++ .../product-details/product-detail.dart | 41 +++++++----- .../product-name-and-price.dart | 65 ++++++++++-------- lib/widgets/others/app_scaffold_widget.dart | 42 +++++++----- 5 files changed, 182 insertions(+), 61 deletions(-) create mode 100644 lib/pages/pharmacies/screens/product-details/CustomIcon.dart create mode 100644 lib/pages/pharmacies/screens/product-details/ProductAppBar.dart diff --git a/lib/pages/pharmacies/screens/product-details/CustomIcon.dart b/lib/pages/pharmacies/screens/product-details/CustomIcon.dart new file mode 100644 index 00000000..c9a71afa --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/CustomIcon.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; + +class IconWithBg extends StatelessWidget { + final IconData icon; + final Color color; + final Function onPress; + + const IconWithBg({Key key, this.icon, this.color, this.onPress}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(left: 25), + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(30), + ), + child: IconButton( + icon: Icon(icon), + color: color, + onPressed: () async { + onPress(); + }, + )); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/ProductAppBar.dart b/lib/pages/pharmacies/screens/product-details/ProductAppBar.dart new file mode 100644 index 00000000..36c43364 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/ProductAppBar.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +import '../cart-order-page.dart'; +import 'CustomIcon.dart'; + +class ProductAppBar extends StatelessWidget with PreferredSizeWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Column( + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + IconWithBg( + icon: Icons.arrow_back_ios, + color: Colors.grey, + onPress: () { + Navigator.pop(context); + }, + ), + ], + ), + Row( + children: [ + IconWithBg( + icon: Icons.shopping_cart, + color: Colors.grey, + onPress: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartOrderPage()), + ); + }), + IconWithBg( + icon: FontAwesomeIcons.ellipsisV, + color: Colors.grey, + onPress: () { + //TODO Elham* + // settingModalBottomSheet(context); + }, + ), + ], + ) + ], + ), + ], + ), + ); + } + + @override + // TODO: implement preferredSize + @override + Size get preferredSize => Size(double.maxFinite, 50); +} + + diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 71dbbddd..08a622aa 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -25,6 +25,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_mo import '../cart-order-page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'ProductAppBar.dart'; import 'availability_info.dart'; import 'details_info.dart'; import 'discount_description.dart'; @@ -106,11 +107,12 @@ class __ProductDetailPageState extends State final screenSize = MediaQuery.of(context).size; return customerId != null - ? DetailPageScafold( + ? AppScaffold( appBarTitle: TranslationBase.of(context).productDetails, isShowAppBar: true, isPharmacy: true, isShowDecPage: false, + customAppBar: ProductAppBar(), body: SingleChildScrollView( child: Column( children: [ @@ -119,14 +121,14 @@ class __ProductDetailPageState extends State color: Colors.white, child: Column( children: [ - if(widget.product.images.isNotEmpty) - Container( - height: MediaQuery.of(context).size.height*.40, - child: Image.network( - widget.product.images[0].src.trim(), - fit: BoxFit.contain, + if (widget.product.images.isNotEmpty) + Container( + height: MediaQuery.of(context).size.height * .40, + child: Image.network( + widget.product.images[0].src.trim(), + fit: BoxFit.contain, + ), ), - ), if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) ], @@ -157,7 +159,8 @@ class __ProductDetailPageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), + padding: EdgeInsets.symmetric( + vertical: 15, horizontal: 10), child: Texts( TranslationBase.of(context).specification, fontSize: 15, @@ -273,7 +276,9 @@ class __ProductDetailPageState extends State color: Colors.white, ), CustomDivider( - color: isDetails ? Colors.green : Colors.transparent, + color: isDetails + ? Colors.green + : Colors.transparent, ) ], ), @@ -298,8 +303,10 @@ class __ProductDetailPageState extends State ), color: Colors.white, ), - CustomDivider( - color: isReviews ? Colors.green : Colors.transparent, + CustomDivider( + color: isReviews + ? Colors.green + : Colors.transparent, ), ], ), @@ -324,8 +331,10 @@ class __ProductDetailPageState extends State ), color: Colors.white, ), - CustomDivider( - color: isAvailability ? Colors.green : Colors.transparent, + CustomDivider( + color: isAvailability + ? Colors.green + : Colors.transparent, ), ], ), @@ -367,7 +376,9 @@ class __ProductDetailPageState extends State // ), // RecommendedProducts(product: widget.product) - SizedBox(height: 80,) + SizedBox( + height: 80, + ) ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 0be6a213..4f607e48 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -8,6 +8,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'CustomIcon.dart'; + class ProductNameAndPrice extends StatefulWidget { BuildContext context; PharmacyProduct item; @@ -36,19 +38,25 @@ class _ProductNameAndPriceState extends State { return Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - SizedBox(height: 10,), + SizedBox( + height: 10, + ), FractionallySizedBox( widthFactor: 0.95, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Texts(widget.item.price.toString() + " " + "SAR", - fontWeight: FontWeight.bold, fontSize: 20 - ), - Texts( projectViewModel.isArabic - ? widget.item.stockAvailabilityn - : widget.item.stockAvailability, - fontWeight: FontWeight.bold, fontSize: 15, color: widget.item.stockAvailability == 'Out of stock'?Colors.red:Colors.green, + fontWeight: FontWeight.bold, fontSize: 20), + Texts( + projectViewModel.isArabic + ? widget.item.stockAvailabilityn + : widget.item.stockAvailability, + fontWeight: FontWeight.bold, + fontSize: 15, + color: widget.item.stockAvailability == 'Out of stock' + ? Colors.red + : Colors.green, ), // SizedBox(width: 20), widget.item.stockAvailability == 'Out of stock' && @@ -70,22 +78,13 @@ class _ProductNameAndPriceState extends State { ) ]), ) - : Container( - margin: projectViewModel.isArabic - ? EdgeInsets.only(right: 25) - : EdgeInsets.only(left: 25), - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey[300], - borderRadius: BorderRadius.circular(30), - ), - child: IconButton( - icon: Icon(!widget.isInWishList - ? Icons.favorite_border - : Icons.favorite), - color: !widget.isInWishList ? Colors.white : Colors.red, - onPressed: () async { + : IconWithBg( + icon: !widget.isInWishList + ? Icons.favorite_border + : Icons.favorite, + color: !widget.isInWishList ? Colors.white : Colors.red, + onPress: () async { + { if (widget.customerId != null) { if (!widget.isInWishList) { GifLoaderDialogUtils.showMyDialog(context); @@ -100,8 +99,9 @@ class _ProductNameAndPriceState extends State { return; } setState(() {}); - }, - )), + } + }, + ) ], ), ), @@ -132,7 +132,8 @@ class _ProductNameAndPriceState extends State { child: Row( children: [ RatingBar.readOnly( - initialRating:double.parse( widget.item.approvedRatingSum.toString()), + initialRating: double.parse( + widget.item.approvedRatingSum.toString()), size: 15.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[400], @@ -141,13 +142,17 @@ class _ProductNameAndPriceState extends State { filledIcon: Icons.star, emptyIcon: Icons.star, ), - SizedBox(width: 10,), + SizedBox( + width: 10, + ), Texts( "${widget.item.approvedRatingSum}", fontWeight: FontWeight.bold, fontSize: 12, ), - SizedBox(width: 30,), + SizedBox( + width: 30, + ), Texts( "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", fontSize: 12, @@ -178,7 +183,9 @@ class _ProductNameAndPriceState extends State { ], ), ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), ], ); } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index b99ac1dc..dcac916b 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -62,6 +62,8 @@ class AppScaffold extends StatelessWidget { locator(); AppBarWidget appBar; + final Widget customAppBar; + AppScaffold( {@required this.body, this.appBarTitle = '', @@ -85,7 +87,9 @@ class AppScaffold extends StatelessWidget { this.infoList, this.isHelp = false, this.showHomeAppBarIcon = true, - this.imagesInfo}); + this.imagesInfo, + appBar, + this.customAppBar}); AppScaffold setOnAppBarCartClick(VoidCallback onClick) { _onCartClick = onClick; @@ -99,16 +103,18 @@ class AppScaffold extends StatelessWidget { backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, appBar: isShowAppBar - ? appBar = AppBarWidget( - appBarTitle: appBarTitle, - appBarIcons: appBarIcons, - showHomeAppBarIcon: showHomeAppBarIcon, - isPharmacy: isPharmacy, - showPharmacyCart: showPharmacyCart, - isOfferPackages: isOfferPackages, - showOfferPackagesCart: showOfferPackagesCart, - isShowDecPage: isShowDecPage, - ) + ? customAppBar != null + ? customAppBar + : appBar = AppBarWidget( + appBarTitle: appBarTitle, + appBarIcons: appBarIcons, + showHomeAppBarIcon: showHomeAppBarIcon, + isPharmacy: isPharmacy, + showPharmacyCart: showPharmacyCart, + isOfferPackages: isOfferPackages, + showOfferPackagesCart: showOfferPackagesCart, + isShowDecPage: isShowDecPage, + ) : null, bottomSheet: bottomSheet, body: SafeArea( @@ -177,6 +183,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget { } String _badgeText = "0"; + class AppBarWidgetState extends State { @override Widget build(BuildContext context) { @@ -221,7 +228,8 @@ class AppBarWidgetState extends State { ? IconButton( icon: Badge( shape: BadgeShape.circle, - badgeContent: Text(_badgeText, style: TextStyle(color: Colors.white)), + badgeContent: + Text(_badgeText, style: TextStyle(color: Colors.white)), child: Icon(Icons.shopping_cart)), color: Colors.white, onPressed: () { @@ -365,10 +373,10 @@ class _RobotIcon extends State { bottom: -15); } - // setAnimation() async { - // /// await sharedPref.getBool(IS_ROBOT_VISIBLE) || - // // var animation = - // // IS_TEXT_COMPLETED == ? true : false; +// setAnimation() async { +// /// await sharedPref.getBool(IS_ROBOT_VISIBLE) || +// // var animation = +// // IS_TEXT_COMPLETED == ? true : false; - // } +// } }