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

Fatima new design

See merge request Cloud_Solution/diplomatic-quarter!500
merge-requests/499/merge
haroon amjad 3 years ago
commit f1b44e9f0b

@ -630,6 +630,16 @@ const Map localizedValues = {
"years-old": {"en": "years old", "ar": "سنة"},
"drag-point": {"en": "Drag point to change your age", "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": "اعادة تعيين"},
"apply": {"en": "Apply", "ar": "تطبيق"},
"viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"},

@ -57,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future notifyMe(customerId, itemID) async {
Future notifyMe(customerId, itemID, context) async {
hasError = false;
setState(ViewState.BusyLocal);
await _productDetailService.notifyMe(customerId, itemID);
await _productDetailService.notifyMe(customerId, itemID, context);
if (_productDetailService.hasError) {
error = _productDetailService.error;
setState(ViewState.ErrorLocal);
@ -68,10 +68,10 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future addToCartData(quantity, itemID) async {
Future addToCartData(quantity, itemID, context) async {
hasError = false;
setState(ViewState.BusyLocal);
var resp = await _productDetailService.addToCart(quantity, itemID);
var resp = await _productDetailService.addToCart(quantity, itemID, context);
ShoppingCartResponse object = _handleGetShoppingCartResponse(resp);
if (_productDetailService.hasError) {
error = _productDetailService.error;
@ -105,11 +105,11 @@ class ProductDetailViewModel extends BaseViewModel {
return cartResponse;
}
Future addToWishlistData(itemID) async {
Future addToWishlistData(itemID, context) async {
hasError = false;
setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.addToWishlist(itemID);
await _productDetailService.addToWishlist(itemID, context);
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) {
@ -130,11 +130,11 @@ class ProductDetailViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future deleteWishlistData(itemID) async {
Future deleteWishlistData(itemID, context) async {
hasError = false;
setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.deleteItemFromWishlist(itemID);
await _productDetailService.deleteItemFromWishlist(itemID, context);
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
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/viewModels/pharmacyModule/product_detail_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/pages/pharmacies/screens/cart-page/cart-order-page.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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart';
@ -58,6 +60,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) {
if (widget.productType == 1) {
@ -259,8 +262,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
),
),
),
Texts(
model.finalProducts[index].name,
Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name,
// model.finalProducts[index].name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
@ -414,8 +417,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
),
Container(
width: MediaQuery.of(context).size.width * 0.64,
child: Texts(
model.finalProducts[index].name,
child: Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name,
// model.finalProducts[index].name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
@ -527,6 +530,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
addToCartFunction(quantity, itemID) async {
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
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<OffersCategoriseViewModel>(
onModelReady: (model) => model.getOffersCategorise(),
@ -99,9 +100,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
.height *
0.09,
child: Center(
child: Texts(
model.categorise[index]
.name,
child: Texts(projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
// model.categorise[index].name,
fontWeight:
FontWeight.w600,
fontSize: 13.8,
@ -117,8 +117,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
String ids =
model.categorise[index].id;
categoriseName = model
.categorise[index].name;
categoriseName = projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name;
//model.categorise[index].name;
}),
],
),
@ -403,11 +403,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
),
),
),
Texts(
model
.products[
index]
.name,
Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
// model.products[index].name,
regular: true,
fontSize: 12.58,
fontWeight:
@ -649,9 +646,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
SizedBox(
height: 4.0,
),
Texts(
model.products[index]
.name,
Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
// model.products[index].name,
regular: true,
fontSize: 14.0,
fontWeight:

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

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

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class CompareList with ChangeNotifier {
@ -7,20 +8,28 @@ class CompareList with ChangeNotifier {
List<PharmacyProduct> get productListItems => _product;
void addItem(data) {
void addItem(data, context) {
if (_product.length == 0) {
_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 {
for (int i = 0; i < _product.length; i++) {
if (_product.length <= 4 && _product[i].id != data.id) {
_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;
} 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){
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 {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID);
await model.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context);
}
addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = true;
await model.addToWishlistData(itemID);
await model.addToWishlistData(itemID, context);
setState(() {});
}
deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = false;
await model.deleteWishlistData(itemID);
await model.deleteWishlistData(itemID, context);
setState(() {});
}
@ -354,11 +354,11 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
ProductDetailViewModel model,
}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID);
await model.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context);
}
}
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async {
await model.notifyMe(customerId, itemId);
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async {
await model.notifyMe(customerId, itemId, context);
}

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

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

@ -534,13 +534,13 @@ class _RecommendedProductPageState extends State<RecommendedProductPage>
addToWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = true;
await x.addToWishlistData(itemID);
await x.addToWishlistData(itemID, context);
}
deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
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:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class ProductTileItem extends StatelessWidget {
final AppSharedPreferences sharedPref = AppSharedPreferences();
@ -178,15 +179,31 @@ class ProductTileItem extends StatelessWidget {
),
Row(
children: [
Expanded(
child: StarRating(
totalAverage: item.approvedTotalReviews > 0
? (item.approvedRatingSum.toDouble() /
item.approvedTotalReviews.toDouble())
.toDouble()
: 0,
forceStars: true),
),
// Expanded(
RatingBar.readOnly(
initialRating: item.approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: 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()),
Container(
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(
scrollDirection: Axis.horizontal,
shrinkWrap: true,

@ -80,7 +80,8 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
page: model.categorise[index].id != '12'
? ParentCategorisePage(
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(
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/viewModels/pharmacyModule/product_detail_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/pages/pharmacies/screens/cart-page/cart-order-page.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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart';
@ -59,6 +61,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Widget build(BuildContext context) {
TextEditingController minField = TextEditingController();
TextEditingController maxField = TextEditingController();
ProjectViewModel projectViewModel = Provider.of(context);
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
@ -136,7 +140,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(model.subCategorise[index].name),
Texts(projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name,
// model.subCategorise[index].name
),
Divider(
thickness: 0.6,
color: Colors.black12,
@ -208,7 +214,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
height: MediaQuery.of(context).size.height * 0.10,
child: Center(
child: Texts(
model.subCategorise[index].name,
projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name,
// model.subCategorise[index].name,
fontSize: 14,
fontWeight: FontWeight.w600,
maxLines: 2,
@ -380,7 +387,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Texts('Min'),
Texts(TranslationBase.of(context).min),
Container(
color: Colors.white,
width: 200,
@ -397,7 +404,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Texts('Max'),
Texts(TranslationBase.of(context).max),
Container(
color: Colors.white,
width: 200,
@ -608,13 +615,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
),
child: Texts(
model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "",
child:model.subProducts[index].rxMessage != null ?
Texts(projectProvider.isArabic
? model.subProducts[index].rxMessagen
: model.subProducts[index].rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
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,
children: [
Texts(
model.subProducts[index].name,
projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name,
// model.subProducts[index].name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
@ -729,13 +747,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
),
child: Texts(
model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "",
child: model.subProducts[index].rxMessage != null ?
Texts(projectProvider.isArabic
? model.subProducts[index].rxMessagen
: model.subProducts[index].rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
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(
width: MediaQuery.of(context).size.width * 0.65,
child: Texts(
model.subProducts[index].name,
projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name,
// model.subProducts[index].name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
@ -889,6 +918,6 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
addToCartFunction(quantity, itemID) async {
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/specification.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
class ProductDetailService extends BaseService {
@ -94,7 +95,7 @@ class ProductDetailService extends BaseService {
}, body: request);
}
Future<Map> addToCart(quantity, itemID) async {
Future<Map> addToCart(quantity, itemID, context) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
Map<String, dynamic> request;
@ -109,7 +110,9 @@ class ProductDetailService extends BaseService {
response['shopping_carts'].forEach((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;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -120,10 +123,12 @@ class ProductDetailService extends BaseService {
return Future.value(localRes);
}
Future notifyMe(customerId, itemID) async {
Future notifyMe(customerId, itemID, context) async {
hasError = false;
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) {
hasError = true;
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);
hasError = false;
Map<String, dynamic> request;
@ -144,7 +149,9 @@ class ProductDetailService extends BaseService {
response['shopping_carts'].forEach((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) {
hasError = true;
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);
hasError = false;
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) {
_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) {
hasError = true;
super.error = error;

@ -1206,6 +1206,26 @@ class TranslationBase {
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 reset => localizedValues['reset'][locale.languageCode];

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

Loading…
Cancel
Save