Merge branch 'Fatima-New-Design' into 'development_new_design_2.0'

Fatima new design

See merge request Cloud_Solution/diplomatic-quarter!500
merge-update-with-lab-changes
haroon amjad 4 years ago
commit f1b44e9f0b

@ -630,6 +630,16 @@ const Map localizedValues = {
"years-old": {"en": "years old", "ar": "سنة"}, "years-old": {"en": "years old", "ar": "سنة"},
"drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"},
"refine": {"en": "Refine", "ar": "تصفية"}, "refine": {"en": "Refine", "ar": "تصفية"},
"max": {"en": "Max", "ar": "اعلى"},
"addToCompareMsg": {"en": "You have added a product to the Compare list", "ar": "تمت الاضافه لقائمة المقارنه"},
"itInListMsg": {"en": "Item is already in the list", "ar": "المنتج موجود في القائمه"},
"compareListFull": {"en": "Your compare list is full", "ar": "قائمة المقارنة ممتلئه"},
"addQuantity": {"en": "You should add quantity", "ar": "اختر الكمية"},
"addToCartMsg": {"en": "You have added a product to the cart", "ar": "تمت اضافة المنتج بنجاح"},
"addToWishlistMsg": {"en": "You have added a product to the Wishlist", "ar": "تمت الاضافة لقائمة الرغبات"},
"notifyMeMsg": {"en": "You will be notified when product available", "ar": "سيتم اخبارك في حال توفر المنتج"},
"removeFromWishlistMsg": {"en": "You have removed a product from the Wishlist", "ar": "تمت ازالة المنتج بنجاح"},
"min": {"en": "Min", "ar": "اقل"},
"reset": {"en": "Reset", "ar": "اعادة تعيين"}, "reset": {"en": "Reset", "ar": "اعادة تعيين"},
"apply": {"en": "Apply", "ar": "تطبيق"}, "apply": {"en": "Apply", "ar": "تطبيق"},
"viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"}, "viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"},

@ -57,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future notifyMe(customerId, itemID) async { Future notifyMe(customerId, itemID, context) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _productDetailService.notifyMe(customerId, itemID); await _productDetailService.notifyMe(customerId, itemID, context);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {
error = _productDetailService.error; error = _productDetailService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -68,10 +68,10 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future addToCartData(quantity, itemID) async { Future addToCartData(quantity, itemID, context) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
var resp = await _productDetailService.addToCart(quantity, itemID); var resp = await _productDetailService.addToCart(quantity, itemID, context);
ShoppingCartResponse object = _handleGetShoppingCartResponse(resp); ShoppingCartResponse object = _handleGetShoppingCartResponse(resp);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {
error = _productDetailService.error; error = _productDetailService.error;
@ -105,11 +105,11 @@ class ProductDetailViewModel extends BaseViewModel {
return cartResponse; return cartResponse;
} }
Future addToWishlistData(itemID) async { Future addToWishlistData(itemID, context) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext); GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.addToWishlist(itemID); await _productDetailService.addToWishlist(itemID, context);
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext); GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {
@ -130,11 +130,11 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future deleteWishlistData(itemID) async { Future deleteWishlistData(itemID, context) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext); GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.deleteItemFromWishlist(itemID); await _productDetailService.deleteItemFromWishlist(itemID, context);
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext); GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -58,6 +60,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) { onModelReady: (model) {
if (widget.productType == 1) { if (widget.productType == 1) {
@ -259,8 +262,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
), ),
), ),
Texts( Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name,
model.finalProducts[index].name, // model.finalProducts[index].name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -414,8 +417,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.64, width: MediaQuery.of(context).size.width * 0.64,
child: Texts( child: Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name,
model.finalProducts[index].name, // model.finalProducts[index].name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -527,6 +530,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID); await x.addToCartData(quantity, itemID, context);
} }
} }

@ -28,6 +28,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
return BaseView<OffersCategoriseViewModel>( return BaseView<OffersCategoriseViewModel>(
onModelReady: (model) => model.getOffersCategorise(), onModelReady: (model) => model.getOffersCategorise(),
@ -99,9 +100,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
.height * .height *
0.09, 0.09,
child: Center( child: Center(
child: Texts( child: Texts(projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
model.categorise[index] // model.categorise[index].name,
.name,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
fontSize: 13.8, fontSize: 13.8,
@ -117,8 +117,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
String ids = String ids =
model.categorise[index].id; model.categorise[index].id;
categoriseName = model categoriseName = projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name;
.categorise[index].name; //model.categorise[index].name;
}), }),
], ],
), ),
@ -403,11 +403,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
), ),
), ),
Texts( Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
model // model.products[index].name,
.products[
index]
.name,
regular: true, regular: true,
fontSize: 12.58, fontSize: 12.58,
fontWeight: fontWeight:
@ -649,9 +646,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
SizedBox( SizedBox(
height: 4.0, height: 4.0,
), ),
Texts( Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
model.products[index] // model.products[index].name,
.name,
regular: true, regular: true,
fontSize: 14.0, fontSize: 14.0,
fontWeight: fontWeight:

@ -69,6 +69,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
TextEditingController minField = TextEditingController(); TextEditingController minField = TextEditingController();
TextEditingController maxField = TextEditingController(); TextEditingController maxField = TextEditingController();
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id), onModelReady: (model) => model.getCategoriseParent(i: id),
allowAny: true, allowAny: true,
@ -116,12 +117,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( InkWell(
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Row(
children: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Padding( children: [
padding: EdgeInsets.all(10.0), Padding(
child: InkWell( padding: EdgeInsets.all(10.0),
child: Container( child: Container(
child: Texts( child: Texts(
TranslationBase.of(context).viewCategorise, TranslationBase.of(context).viewCategorise,
@ -129,70 +130,19 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
), ),
), ),
onTap: () {
Navigator.push(
context,
FadePage(
page: SubCategoriseModalsheet(
// id: model.categorise[0].id,
// titleName: model.categorise[0].name,
)),
);
// showModalBottomSheet<void>(
// isScrollControlled: true,
// context: context,
// builder: (BuildContext context) {
// return Container(
// // height: MediaQuery.of(context)
// // .size
// // .height *
// // 0.89,
// color: Colors.white,
// child: Center(
// child: ListView.builder(
// scrollDirection: Axis.vertical,
// itemCount: model.categoriseParent.length,
// itemBuilder: (BuildContext context, int index) {
// return Container(
// child: Padding(
// padding: EdgeInsets.all(4.0),
// child: InkWell(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts(projectViewModel.isArabic
// ? model.categoriseParent[index].namen
// : model.categoriseParent[index].name),
// Divider(
// thickness: 0.6,
// color: Colors.black12,
// )
// ],
// ),
// onTap: () {
// Navigator.push(
// context,
// FadePage(
// page: SubCategorisePage(
// title: model.categoriseParent[index].name,
// id: model.categoriseParent[index].id,
// parentId: id,
// )),
// );
// },
// ),
// ),
// );
// }),
// ),
// );
// },
// );
},
), ),
),
Icon(Icons.arrow_forward) Icon(Icons.arrow_forward)
], ],
),
onTap: () {
Navigator.push(
context,
FadePage(
page: SubCategoriseModalsheet(
// id: model.categorise[0].id,
// titleName: model.categorise[0].name,
)),
);}
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
@ -256,7 +206,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
context, context,
FadePage( FadePage(
page: SubCategorisePage( page: SubCategorisePage(
title: model.categoriseParent[index].name, title: projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name,
// title: model.categoriseParent[index].name,
id: model.categoriseParent[index].id, id: model.categoriseParent[index].id,
parentId: id, parentId: id,
)), )),
@ -289,7 +240,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
width: 10.0, width: 10.0,
), ),
Texts( Texts(
'Refine', TranslationBase.of(context).refine,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
], ],
@ -418,7 +369,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Texts('Min'), Texts(TranslationBase.of(context).min),
Container( Container(
color: Colors.white, color: Colors.white,
width: 200, width: 200,
@ -435,7 +386,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Texts('Max'), Texts(TranslationBase.of(context).max),
Container( Container(
color: Colors.white, color: Colors.white,
width: 200, width: 200,
@ -638,7 +589,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
bottom: 5.0, bottom: 5.0,
), ),
child: Texts( child: Texts(
'offer'.toUpperCase(), TranslationBase.of(context).offers.toUpperCase(),
color: Colors.red, color: Colors.red,
fontSize: 13.0, fontSize: 13.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
@ -665,13 +616,23 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Color(0xffb23838), color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: Texts( child:model.parentProducts[index].rxMessage != null ?
model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", Texts(projectProvider.isArabic
color: Colors.white, ? model.parentProducts[index].rxMessagen
regular: true, : model.parentProducts[index].rxMessage,
fontSize: 10, color: Colors.white,
fontWeight: FontWeight.w400, regular: true,
), fontSize: 10,
fontWeight: FontWeight.w400,
)
: Texts(""),
// Texts(
// model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "",
// color: Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight: FontWeight.w400,
// ),
), ),
], ],
), ),
@ -802,13 +763,23 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Color(0xffb23838), color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: Texts( child: model.parentProducts[index].rxMessage != null ?
model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", Texts(projectProvider.isArabic
? model.parentProducts[index].rxMessagen
: model.parentProducts[index].rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), )
: Texts(""),
// Texts(
// model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "",
// color: Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight: FontWeight.w400,
// ),
), ),
], ],
), ),
@ -926,8 +897,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(TranslationBase.of(context).noData,
'There is no data', // 'There is no data',
style: TextStyle(fontSize: 30), style: TextStyle(fontSize: 30),
), ),
) )
@ -945,7 +916,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID); await x.addToCartData(quantity, itemID, context);
} }
bool isEntityListSelected(CategoriseParentModel masterKey) { bool isEntityListSelected(CategoriseParentModel masterKey) {

@ -48,7 +48,7 @@ class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> {
deleteWishListItem(itemID) async { deleteWishListItem(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await x.deleteWishlistData(itemID); await x.deleteWishlistData(itemID, context);
await widget.model.getWishlistData(isLocalLoader: true); await widget.model.getWishlistData(isLocalLoader: true);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class CompareList with ChangeNotifier { class CompareList with ChangeNotifier {
@ -7,20 +8,28 @@ class CompareList with ChangeNotifier {
List<PharmacyProduct> get productListItems => _product; List<PharmacyProduct> get productListItems => _product;
void addItem(data) { void addItem(data, context) {
if (_product.length == 0) { if (_product.length == 0) {
_product.add(data); _product.add(data);
AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg
// 'You have added a product to the Compare list'
);
} else { } else {
for (int i = 0; i < _product.length; i++) { for (int i = 0; i < _product.length; i++) {
if (_product.length <= 4 && _product[i].id != data.id) { if (_product.length <= 4 && _product[i].id != data.id) {
_product.add(data); _product.add(data);
AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg
// 'You have added a product to the Compare list'
);
break; break;
} else if(_product[i].id == data.id){ } else if(_product[i].id == data.id){
AppToast.showErrorToast(message: 'the item is already in the list'); AppToast.showErrorToast(message:TranslationBase.of(context).itInListMsg
// 'the item is already in the list'
);
} else if(_product.length == 4){ } else if(_product.length == 4){
AppToast.showErrorToast(message: 'your compare list is full'); AppToast.showErrorToast(message: TranslationBase.of(context).compareListFull
// 'your compare list is full'
);
} }
} }
} }

@ -332,19 +332,19 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async { addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID); await model.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
addToWishlistFunction({itemID, ProductDetailViewModel model}) async { addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = true; isInWishList = true;
await model.addToWishlistData(itemID); await model.addToWishlistData(itemID, context);
setState(() {}); setState(() {});
} }
deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async { deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = false; isInWishList = false;
await model.deleteWishlistData(itemID); await model.deleteWishlistData(itemID, context);
setState(() {}); setState(() {});
} }
@ -354,11 +354,11 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
ProductDetailViewModel model, ProductDetailViewModel model,
}) async { }) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID); await model.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
} }
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async { notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async {
await model.notifyMe(customerId, itemId); await model.notifyMe(customerId, itemId, context);
} }

@ -129,11 +129,11 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Texts( // Texts(
"${widget.item.approvedRatingSum}", // "${widget.item.approvedRatingSum}",
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 12, // fontSize: 12,
), // ),
SizedBox( SizedBox(
width: 30, width: 30,
), ),

@ -157,7 +157,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} else { } else {
AppToast.showErrorToast(message: "you should add quantity"); AppToast.showErrorToast(message: TranslationBase.of(context).addQuantity
// "you should add quantity"
);
} }
}), }),
ListTile( ListTile(
@ -184,7 +186,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
), ),
onTap: () { onTap: () {
Provider.of<CompareList>(context, listen: false) Provider.of<CompareList>(context, listen: false)
.addItem(specificationData); .addItem(specificationData,context);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),

@ -534,13 +534,13 @@ class _RecommendedProductPageState extends State<RecommendedProductPage>
addToWishlistFunction(itemID) async { addToWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = true; isInWishlist = true;
await x.addToWishlistData(itemID); await x.addToWishlistData(itemID, context);
} }
deleteFromWishlistFunction(itemID) async { deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = false; isInWishlist = false;
await x.addToWishlistData(itemID); await x.addToWishlistData(itemID, context);
} }
} }

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class ProductTileItem extends StatelessWidget { class ProductTileItem extends StatelessWidget {
final AppSharedPreferences sharedPref = AppSharedPreferences(); final AppSharedPreferences sharedPref = AppSharedPreferences();
@ -178,15 +179,31 @@ class ProductTileItem extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
Expanded( // Expanded(
child: StarRating( RatingBar.readOnly(
totalAverage: item.approvedTotalReviews > 0 initialRating: item.approvedRatingSum.toDouble(),
? (item.approvedRatingSum.toDouble() / size: 15.0,
item.approvedTotalReviews.toDouble()) filledColor: Colors.yellow[700],
.toDouble() emptyColor: Colors.grey[500],
: 0, isHalfAllowed: true,
forceStars: true), halfFilledIcon: Icons.star_half,
), filledIcon: Icons.star,
emptyIcon: Icons.star,
),
Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
)
// StarRating(
// totalAverage: item.approvedTotalReviews > 0
// ? (item.approvedRatingSum.toDouble() /
// item.approvedTotalReviews.toDouble())
// .toDouble()
// : 0,
// forceStars: true),
// ),
], ],
), ),
], ],

@ -36,7 +36,7 @@ class PrescriptionsWidget extends StatelessWidget {
ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()),
Container( Container(
margin: EdgeInsets.only(right: 10.0, left: 10.0), margin: EdgeInsets.only(right: 10.0, left: 10.0),
height: MediaQuery.of(context).size.height * 0.19, height: MediaQuery.of(context).size.height * 0.30,
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,

@ -80,7 +80,8 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
page: model.categorise[index].id != '12' page: model.categorise[index].id != '12'
? ParentCategorisePage( ? ParentCategorisePage(
id: model.categorise[index].id, id: model.categorise[index].id,
titleName: model.categorise[index].name, titleName: projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
// titleName: model.categorise[index].name,
) )
: FinalProductsPage( : FinalProductsPage(
id: model.categorise[index].id, id: model.categorise[index].id,

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
@ -17,6 +18,7 @@ import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -59,6 +61,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
TextEditingController minField = TextEditingController(); TextEditingController minField = TextEditingController();
TextEditingController maxField = TextEditingController(); TextEditingController maxField = TextEditingController();
ProjectViewModel projectViewModel = Provider.of(context);
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id), onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
@ -136,7 +140,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts(model.subCategorise[index].name), Texts(projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name,
// model.subCategorise[index].name
),
Divider( Divider(
thickness: 0.6, thickness: 0.6,
color: Colors.black12, color: Colors.black12,
@ -208,7 +214,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
height: MediaQuery.of(context).size.height * 0.10, height: MediaQuery.of(context).size.height * 0.10,
child: Center( child: Center(
child: Texts( child: Texts(
model.subCategorise[index].name, projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name,
// model.subCategorise[index].name,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
maxLines: 2, maxLines: 2,
@ -380,7 +387,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Texts('Min'), Texts(TranslationBase.of(context).min),
Container( Container(
color: Colors.white, color: Colors.white,
width: 200, width: 200,
@ -397,7 +404,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Texts('Max'), Texts(TranslationBase.of(context).max),
Container( Container(
color: Colors.white, color: Colors.white,
width: 200, width: 200,
@ -608,13 +615,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Color(0xffb23838), color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: Texts( child:model.subProducts[index].rxMessage != null ?
model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", Texts(projectProvider.isArabic
? model.subProducts[index].rxMessagen
: model.subProducts[index].rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), )
: Texts(""),
// Texts(
// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "",
// color: Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight: FontWeight.w400,
// ),
), ),
], ],
), ),
@ -627,7 +644,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( Texts(
model.subProducts[index].name, projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name,
// model.subProducts[index].name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -729,13 +747,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Color(0xffb23838), color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: Texts( child: model.subProducts[index].rxMessage != null ?
model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", Texts(projectProvider.isArabic
? model.subProducts[index].rxMessagen
: model.subProducts[index].rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), )
: Texts(""),
// Texts(
// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "",
// color: Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight: FontWeight.w400,
// ),
), ),
], ],
), ),
@ -757,7 +785,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Container( Container(
width: MediaQuery.of(context).size.width * 0.65, width: MediaQuery.of(context).size.width * 0.65,
child: Texts( child: Texts(
model.subProducts[index].name, projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name,
// model.subProducts[index].name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -889,6 +918,6 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID); await x.addToCartData(quantity, itemID, context);
} }
} }

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
class ProductDetailService extends BaseService { class ProductDetailService extends BaseService {
@ -94,7 +95,7 @@ class ProductDetailService extends BaseService {
}, body: request); }, body: request);
} }
Future<Map> addToCart(quantity, itemID) async { Future<Map> addToCart(quantity, itemID, context) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false; hasError = false;
Map<String, dynamic> request; Map<String, dynamic> request;
@ -109,7 +110,9 @@ class ProductDetailService extends BaseService {
response['shopping_carts'].forEach((item) { response['shopping_carts'].forEach((item) {
_addToCartModel.add(Wishlist.fromJson(item)); _addToCartModel.add(Wishlist.fromJson(item));
}); });
AppToast.showSuccessToast(message: 'You have added a product to the cart'); AppToast.showSuccessToast(message: TranslationBase.of(context).addToCartMsg
// 'You have added a product to the cart'
);
localRes = response; localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -120,10 +123,12 @@ class ProductDetailService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future notifyMe(customerId, itemID) async { Future notifyMe(customerId, itemID, context) async {
hasError = false; hasError = false;
await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) {
AppToast.showSuccessToast(message: 'You will be notified when product available'); AppToast.showSuccessToast(message: TranslationBase.of(context).notifyMeMsg
//'You will be notified when product available'
);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
@ -131,7 +136,7 @@ class ProductDetailService extends BaseService {
}); });
} }
Future addToWishlist(itemID) async { Future addToWishlist(itemID, context) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false; hasError = false;
Map<String, dynamic> request; Map<String, dynamic> request;
@ -144,7 +149,9 @@ class ProductDetailService extends BaseService {
response['shopping_carts'].forEach((item) { response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item)); _wishListProducts.add(Wishlist.fromJson(item));
}); });
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); AppToast.showSuccessToast(message: TranslationBase.of(context).addToWishlistMsg
// 'You have added a product to the Wishlist'
);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
@ -166,7 +173,7 @@ class ProductDetailService extends BaseService {
}); });
} }
Future deleteItemFromWishlist(itemID) async { Future deleteItemFromWishlist(itemID, context) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false; hasError = false;
await baseAppClient.getPharmacy(DELETE_WISHLIST + customerId + "+&product_id=" + itemID + "&cart_type=Wishlist", onSuccess: (dynamic response, int statusCode) { await baseAppClient.getPharmacy(DELETE_WISHLIST + customerId + "+&product_id=" + itemID + "&cart_type=Wishlist", onSuccess: (dynamic response, int statusCode) {
@ -174,7 +181,9 @@ class ProductDetailService extends BaseService {
response['shopping_carts'].forEach((item) { response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item)); _wishListProducts.add(Wishlist.fromJson(item));
}); });
AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist'); AppToast.showSuccessToast(message: TranslationBase.of(context).removeFromWishlistMsg
// 'You have removed a product from the Wishlist'
);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -1206,6 +1206,26 @@ class TranslationBase {
String get refine => localizedValues['refine'][locale.languageCode]; String get refine => localizedValues['refine'][locale.languageCode];
String get max => localizedValues['max'][locale.languageCode];
String get min => localizedValues['min'][locale.languageCode];
String get addToCompareMsg => localizedValues['addToCompareMsg'][locale.languageCode];
String get itInListMsg => localizedValues['itInListMsg'][locale.languageCode];
String get compareListFull => localizedValues['compareListFull'][locale.languageCode];
String get addQuantity => localizedValues['addQuantity'][locale.languageCode];
String get addToCartMsg => localizedValues['addToCartMsg'][locale.languageCode];
String get addToWishlistMsg => localizedValues['addToWishlistMsg'][locale.languageCode];
String get notifyMeMsg => localizedValues['notifyMeMsg'][locale.languageCode];
String get removeFromWishlistMsg => localizedValues['removeFromWishlistMsg'][locale.languageCode];
String get apply => localizedValues['apply'][locale.languageCode]; String get apply => localizedValues['apply'][locale.languageCode];
String get reset => localizedValues['reset'][locale.languageCode]; String get reset => localizedValues['reset'][locale.languageCode];

@ -295,6 +295,6 @@ class productTile extends StatelessWidget {
addToCartFunction(quantity, itemID, BuildContext context) async { addToCartFunction(quantity, itemID, BuildContext context) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID); await x.addToCartData(quantity, itemID, context);
} }
} }

Loading…
Cancel
Save