fixed brands design and recommended products issues

merge-update-with-lab-changes
Fatimah Alshammari 4 years ago
parent 10f75191c6
commit 30a1353be6

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/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/data_display/text.dart';
@ -605,6 +606,19 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
], ],
), ),
), ),
Container(
child: IconButton(
icon: Icon(Icons.shopping_cart,
size: 15,
color: Colors.blue,),
onPressed: () async {
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
),
),
], ],
), ),
), ),

@ -130,6 +130,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
PharmacyCategorisePage(), PharmacyCategorisePage(),
PharmacyProfilePage(), PharmacyProfilePage(),
CartOrderPage(), CartOrderPage(),
], ],
), ),
bottomNavigationBar: BottomNavPharmacyBar( bottomNavigationBar: BottomNavPharmacyBar(

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_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/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
@ -35,8 +36,9 @@ class ParentCategorisePage extends StatefulWidget {
class _ParentCategorisePageState extends State<ParentCategorisePage> { class _ParentCategorisePageState extends State<ParentCategorisePage> {
String id; String id;
String titleName; String titleName;
final dynamic productID;
_ParentCategorisePageState({this.id, this.titleName}); _ParentCategorisePageState({this.id, this.titleName, this.productID});
Map<String, bool> values = {'huusam': false, 'ali': false, 'noor': false}; Map<String, bool> values = {'huusam': false, 'ali': false, 'noor': false};
bool checkedBrands = false; bool checkedBrands = false;
@ -1119,28 +1121,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
padding: padding:
const EdgeInsets const EdgeInsets
.only( .only(
top: 1, top: 4, bottom: 4),
bottom: 1), child: Texts(
child: Row( "SAR ${model.parentProducts[index].price}",
mainAxisAlignment: MainAxisAlignment.spaceAround, bold: true,
children: [ fontSize: 14,
Texts(
"SAR ${model.parentProducts[index].price}",
bold: true,
fontSize: 14,
),
Container(
child: IconButton(
icon: Icon(FontAwesomeIcons.shoppingCart, size: 15),
onPressed: () async {
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
),
),
],
), ),
), ),
Row( Row(
@ -1172,6 +1157,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
), ),
Container(
child: IconButton(
icon: Icon(Icons.shopping_cart,
size: 15,
color: Colors.blue,),
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context);
await addToCartFunction(1, productID);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
),
),
], ],
), ),
), ),
@ -1238,4 +1239,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
} }
return false; return false;
} }
addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID);
}
} }

@ -97,7 +97,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
height: 10, height: 10,
), ),
Container( Container(
height: 290, height: 420,
width: double.infinity, width: double.infinity,
color: Colors.white, color: Colors.white,
child: ListView.builder( child: ListView.builder(

@ -189,7 +189,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
Texts( Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
fontSize: 14, fontSize: 14,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -368,7 +368,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
child: Row( child: Row(
children: [ children: [
Texts( Texts(
"${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}", "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
fontSize: fontSize:
projectProvider.isArabic ? 12 : 14, projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

@ -313,7 +313,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
RecommendedProducts(product: widget.product) RecommendedProducts(product: widget.product,productDetailViewModel: model,
addToWishlistFunction: (itemID) async {
await addToWishlistFunction(itemID: itemID, model: model);
}, deleteFromWishlistFunction: (itemID) async {
await deleteFromWishlistFunction(itemID: itemID, model: model);
},)
], ],
), ),
), ),

@ -1,9 +1,11 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.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/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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/gif_loader_dialog_utils.dart';
@ -24,6 +26,9 @@ class RecommendedProducts extends StatefulWidget {
final Function addToWishlistFunction; final Function addToWishlistFunction;
final Function deleteFromWishlistFunction; final Function deleteFromWishlistFunction;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
RecommendedProducts( RecommendedProducts(
{Key key, {Key key,
this.product, this.product,
@ -134,63 +139,27 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
child: Align( child: Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: IconButton( child: IconButton(
icon: Icon(model icon: Icon(model.recommendedProductList[index].isinwishlist != true
.recommendedProductList[ ? Icons.favorite_border : Icons.favorite),
index] color: model.recommendedProductList[index].isinwishlist != true
.isinwishlist != ? Colors.grey : Colors.red,
true
? Icons.favorite_border
: Icons.favorite),
color: model
.recommendedProductList[
index]
.isinwishlist !=
true
? Colors.grey
: Colors.red,
onPressed: () async { onPressed: () async {
if (widget.customerId != null) { if (widget.authenticatedUserObject.isLogin
if (!widget.isInWishList && ) {
model if (!widget.isInWishList && model.recommendedProductList[index].isinwishlist != true) {
.recommendedProductList[ GifLoaderDialogUtils.showMyDialog(context);
index] await widget.addToWishlistFunction(model.recommendedProductList[index].id,
.isinwishlist != );
true) { GifLoaderDialogUtils.hideDialog(context);
GifLoaderDialogUtils
.showMyDialog(context);
await widget.addToWishlistFunction(
itemID: model
.recommendedProductList[
index]
.id,
model: widget
.productDetailViewModel);
// checkWishlist();
GifLoaderDialogUtils
.hideDialog(context);
setState(() { setState(() {
model model.recommendedProductList[index].isinwishlist = true;});
.recommendedProductList[
index]
.isinwishlist = true;
});
} else { } else {
GifLoaderDialogUtils GifLoaderDialogUtils.showMyDialog(context);
.showMyDialog(context); await widget.deleteFromWishlistFunction(model.recommendedProductList[index].id,
await widget.deleteFromWishlistFunction( );
itemID: model GifLoaderDialogUtils.hideDialog(context);
.recommendedProductList[
index]
.id,
model: widget
.productDetailViewModel);
GifLoaderDialogUtils
.hideDialog(context);
setState(() { setState(() {
model model.recommendedProductList[index].isinwishlist = false;
.recommendedProductList[
index]
.isinwishlist = false;
}); });
} }
} else { } else {

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.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/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -860,6 +861,19 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
], ],
), ),
), ),
Container(
child: IconButton(
icon: Icon(Icons.shopping_cart,
size: 15,
color: Colors.blue,),
onPressed: () async {
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
),
),
], ],
), ),
), ),

Loading…
Cancel
Save