Merge branch 'development_new_design_2.0' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into nov_fixes

merge-update-with-lab-changes
Elham Rababh 4 years ago
commit 41097f119c

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.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/viewModels/pharmacyModule/product_detail_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/base/base_view.dart';
@ -11,6 +12,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'availability_info.dart'; import 'availability_info.dart';
@ -87,8 +89,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>( return BaseView<ProductDetailViewModel>(
allowAny: true, allowAny: true,
onModelReady: (model) { onModelReady: (model) async {
model.getProductReviewsData(widget.product.id); await model.getProductReviewsData(widget.product.id).then((value) {});
}, },
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails, appBarTitle: TranslationBase.of(context).productDetails,
@ -108,7 +110,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
isInWishList: isInWishList, isInWishList: isInWishList,
addToCartFunction: addToCartFunction, addToCartFunction: addToCartFunction,
), ),
body: SingleChildScrollView( body: model.state == ViewState.Idle
? SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
Container( Container(
@ -304,8 +307,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
) )
], ],
), ),
), )
bottomSheet: FooterWidget( : AppCircularProgressIndicator(),
bottomSheet: model.state == ViewState.Idle
? FooterWidget(
model.isStockAvailable, model.isStockAvailable,
widget.product.orderMaximumQuantity, widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity, widget.product.orderMinimumQuantity,
@ -316,7 +321,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
addToCartFunction: addToCartFunction, addToCartFunction: addToCartFunction,
addToShoppingCartFunction: addToShoppingCartFunction, addToShoppingCartFunction: addToShoppingCartFunction,
model: model, model: model,
), )
: SizedBox(),
)); ));
} }

@ -24,7 +24,7 @@ class ProductNameAndPrice extends StatefulWidget {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
ProductNameAndPrice(this.context, this.item, ProductNameAndPrice(this.context, this.item,
{this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, @required this.isStockAvailable}); {this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, this.isStockAvailable = false});
@override @override
_ProductNameAndPriceState createState() => _ProductNameAndPriceState(); _ProductNameAndPriceState createState() => _ProductNameAndPriceState();

@ -2,15 +2,11 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
class ProductDetailService extends BaseService { class ProductDetailService extends BaseService {
bool isLogin = false; bool isLogin = false;
@ -57,7 +53,9 @@ class ProductDetailService extends BaseService {
}); });
_stockQuantity = response['products'][0]['stock_quantity']; _stockQuantity = response['products'][0]['stock_quantity'];
_stockAvailability = response['products'][0]['stock_availability']; _stockAvailability = response['products'][0]['stock_availability'];
_isStockAvailable = response['products'][0]['IsStockAvailable'];
// _isStockAvailable = response['products'][0]['IsStockAvailable'];
_isStockAvailable = _stockAvailability == "In stock" ? true : false;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

Loading…
Cancel
Save