Product Detail page fix

merge-update-with-lab-changes
haroon amjad 4 years ago
parent fd3d2b588b
commit 11d37d26e5

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

@ -24,7 +24,7 @@ class ProductNameAndPrice extends StatefulWidget {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
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
_ProductNameAndPriceState createState() => _ProductNameAndPriceState();

@ -2,15 +2,11 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.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/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/uitl/utils.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
class ProductDetailService extends BaseService {
bool isLogin = false;
@ -57,7 +53,9 @@ class ProductDetailService extends BaseService {
});
_stockQuantity = response['products'][0]['stock_quantity'];
_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) {
hasError = true;
super.error = error;

Loading…
Cancel
Save