Pharmacy fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 925e3cb686
commit 8d6278a59b

@ -144,12 +144,12 @@ class OrderPreviewService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future getLacumAccountInformation() async { Future getLacumAccountInformation(String identificationNo) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['IdentificationNo'] = user.patientIdentificationNo; body['IdentificationNo'] = identificationNo;
try { try {
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
@ -164,12 +164,12 @@ class OrderPreviewService extends BaseService {
} }
} }
Future getLacumGroupInformation() async { Future getLacumGroupInformation(String identificationNo) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['IdentificationNo'] = user.patientIdentificationNo; body['IdentificationNo'] = identificationNo;
body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}";
try { try {

@ -161,25 +161,25 @@ class OrderPreviewViewModel extends BaseViewModel {
return _orderService.getPaymentOptionName(paymentOption); return _orderService.getPaymentOptionName(paymentOption);
} }
getInformationsByAddress() async { getInformationsByAddress(String identificationNo) async {
await getLacumAccountInformation();
await getShippingOption(); await getShippingOption();
await getLacumAccountInformation(identificationNo);
} }
getLacumAccountInformation() async { getLacumAccountInformation(String identificationNo) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.getLacumAccountInformation(); await _orderService.getLacumAccountInformation(identificationNo);
if (_orderService.hasError) { if (_orderService.hasError) {
error = _orderService.error; error = _orderService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
getLacumGroupData(); getLacumGroupData(identificationNo);
} }
} }
Future getLacumGroupData() async { Future getLacumGroupData(String identificationNo) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.getLacumGroupInformation(); await _orderService.getLacumGroupInformation(identificationNo);
paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData paymentCheckoutData.usedLakumPoints = paymentCheckoutData
.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; .lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;

@ -40,7 +40,7 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
if(viewModel.service.customer != null) { if(viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){ await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) { }).catchError((error) {
utils.Utils.showErrorToast(error); utils.Utils.showErrorToast(error);
}); });
@ -50,7 +50,7 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
@override @override
void afterFirstLayout(BuildContext context) async{ void afterFirstLayout(BuildContext context) async{
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
} }
@override @override

@ -96,7 +96,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> with AfterLayoutMix
if(viewModel.service.customer != null) { if(viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){ await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) { }).catchError((error) {
utils.Utils.showErrorToast(error.toString()); utils.Utils.showErrorToast(error.toString());
}); });

@ -105,8 +105,8 @@ class _CartOrderPageState extends State<CartOrderPage> {
.shoppingCarts[index]) .shoppingCarts[index])
.then((value) { .then((value) {
if (model.state != ViewState.Error) { if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater( // appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}'); // '${value.quantityCount ?? 0}');
} }
if (model.state == if (model.state ==
ViewState.ErrorLocal) { ViewState.ErrorLocal) {
@ -119,8 +119,8 @@ class _CartOrderPageState extends State<CartOrderPage> {
.shoppingCarts[index]) .shoppingCarts[index])
.then((value) { .then((value) {
if (model.state != ViewState.Error) { if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater( // appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}'); // '${value.quantityCount ?? 0}');
} }
}); });
})) }))

@ -89,7 +89,7 @@ class PaymentBottomWidget extends StatelessWidget {
message: message:
"Order has been placed successfully!!"); "Order has been placed successfully!!");
openPayment( openPayment(
model.orderListModel[0], model.user); model.orderListModel[0], model.authenticatedUserObject.user);
} else { } else {
AppToast.showErrorToast(message: model.error); AppToast.showErrorToast(message: model.error);
} }

@ -37,14 +37,14 @@ class SelectAddressWidget extends StatefulWidget {
class _SelectAddressWidgetState extends State<SelectAddressWidget> { class _SelectAddressWidgetState extends State<SelectAddressWidget> {
AddressInfo address; AddressInfo address;
_navigateToAddressPage() { _navigateToAddressPage(String identificationNo) {
Navigator.push(context, FadePage(page: PharmacyAddressesPage())) Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) { .then((result) {
if (result != null) { if (result != null) {
address = result; address = result;
widget.model.paymentCheckoutData.address = widget.model.paymentCheckoutData.address =
Addresses.fromJson(address.toJson()); Addresses.fromJson(address.toJson());
widget.model.getInformationsByAddress(); widget.model.getInformationsByAddress(identificationNo);
widget.changeMainState(); widget.changeMainState();
} }
}); });
@ -66,7 +66,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
color: Colors.white, color: Colors.white,
child: address == null child: address == null
? InkWell( ? InkWell(
onTap: () => {_navigateToAddressPage()}, onTap: () => {_navigateToAddressPage(model.user.patientIdentificationNo)},
child: Container( child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row( child: Row(
@ -125,7 +125,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
), ),
), ),
InkWell( InkWell(
onTap: () => {_navigateToAddressPage()}, onTap: () => {_navigateToAddressPage(model.authenticatedUserObject.user.patientIdentificationNo)},
child: Texts( child: Texts(
TranslationBase.of(context).changeAddress, TranslationBase.of(context).changeAddress,
fontSize: 12, fontSize: 12,

@ -55,7 +55,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
//crossAxisAlignment: CrossAxisAlignment.start, //crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
BannerPager(model), BannerPager(model),
GridViewButtons(model), // GridViewButtons(model),
PrescriptionsWidget(), PrescriptionsWidget(),
ShopByBrandWidget(), ShopByBrandWidget(),
RecentlyViewedWidget(), RecentlyViewedWidget(),

@ -1,12 +1,7 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.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';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
@ -16,7 +11,6 @@ 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/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'availability_info.dart'; import 'availability_info.dart';
@ -108,8 +102,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
deleteFromWishlistFunction: () async { deleteFromWishlistFunction: () async {
await deleteFromWishlistFunction(itemID: itemID, model: model); await deleteFromWishlistFunction(itemID: itemID, model: model);
}, },
isInWishList:isInWishList, isInWishList: isInWishList,
addToCartFunction:addToCartFunction , addToCartFunction: addToCartFunction,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
@ -127,8 +121,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
if (widget.product.discountDescription != null) if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
DiscountDescription(product: widget.product)
], ],
), ),
), ),
@ -146,15 +139,11 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
setState(() {}); setState(() {});
}, },
deleteFromWishlistFunction: (item) { deleteFromWishlistFunction: (item) {
deleteFromWishlistFunction( deleteFromWishlistFunction(itemID: item, model: model);
itemID: item, model: model);
setState(() {}); setState(() {});
}, },
notifyMeWhenAvailable: (context, itemId) { notifyMeWhenAvailable: (context, itemId) {
notifyMeWhenAvailable( notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model);
itemId: itemId,
customerId: customerId,
model: model);
}, },
isInWishList: isInWishList, isInWishList: isInWishList,
), ),
@ -169,8 +158,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
vertical: 15, horizontal: 10),
child: Texts( child: Texts(
TranslationBase.of(context).specification, TranslationBase.of(context).specification,
fontSize: 15, fontSize: 15,
@ -207,16 +195,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).details, TranslationBase.of(context).details,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isDetails color: isDetails ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
) )
], ],
), ),
@ -227,14 +211,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: () async {
if (widget.product.approvedTotalReviews > if (widget.product.approvedTotalReviews > 0) {
0) { GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog( await model.getProductReviewsData(widget.product.id);
context); GifLoaderDialogUtils.hideDialog(context);
await model.getProductReviewsData(
widget.product.id);
GifLoaderDialogUtils.hideDialog(
context);
} else { } else {
model.clearReview(); model.clearReview();
} }
@ -246,16 +226,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).reviews, TranslationBase.of(context).reviews,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isReviews color: isReviews ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -266,8 +242,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model.getProductLocationData(); await model.getProductLocationData();
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -279,16 +254,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isAvailability color: isAvailability ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -317,12 +288,16 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
RecommendedProducts(product: widget.product,productDetailViewModel: model, RecommendedProducts(
product: widget.product,
productDetailViewModel: model,
addToWishlistFunction: (itemID) async { addToWishlistFunction: (itemID) async {
await addToWishlistFunction(itemID: itemID, model: model); await addToWishlistFunction(itemID: itemID, model: model);
}, deleteFromWishlistFunction: (itemID) async { },
deleteFromWishlistFunction: (itemID) async {
await deleteFromWishlistFunction(itemID: itemID, model: model); await deleteFromWishlistFunction(itemID: itemID, model: model);
},) },
)
], ],
), ),
), ),
@ -340,9 +315,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
)); ));
} }
addToShoppingCartFunction({quantity,itemID,ProductDetailViewModel model})async{
await model.addToCartData(quantity,itemID);
addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async {
await model.addToCartData(quantity, itemID);
} }
addToWishlistFunction({itemID, ProductDetailViewModel model}) async { addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
@ -356,20 +331,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
await model.deleteWishlistData(itemID); await model.deleteWishlistData(itemID);
setState(() {}); setState(() {});
} }
addToCartFunction(
{quantity, addToCartFunction({
itemID, quantity,
ProductDetailViewModel model, itemID,
}) async { ProductDetailViewModel model,
}) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID); await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
} }
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async {
notifyMeWhenAvailable(
{itemId, customerId, ProductDetailViewModel model}) async {
await model.notifyMe(customerId, itemId); await model.notifyMe(customerId, itemId);
} }

@ -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.28, height: MediaQuery.of(context).size.height * 0.18,
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,

@ -12,13 +12,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreview
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_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/pages/pharmacy/profile/profile.dart';
import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
@ -27,7 +22,6 @@ import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -45,8 +39,6 @@ import 'not_auh_page.dart';
VoidCallback _onCartClick; VoidCallback _onCartClick;
class AppScaffold extends StatefulWidget { class AppScaffold extends StatefulWidget {
AppBarWidget appBar;
final String appBarTitle; final String appBarTitle;
final Widget body; final Widget body;
final Widget bottomSheet; final Widget bottomSheet;
@ -60,11 +52,9 @@ class AppScaffold extends StatefulWidget {
final bool isBottomBar; final bool isBottomBar;
final Widget floatingActionButton; final Widget floatingActionButton;
final bool isPharmacy; final bool isPharmacy;
final bool isMainPharmacyPages;
final bool isOfferPackages; final bool isOfferPackages;
final bool showPharmacyCart; final bool showPharmacyCart;
final bool showOfferPackagesCart; final bool showOfferPackagesCart;
final bool extendBody;
final String title; final String title;
final String description; final String description;
final bool isShowDecPage; final bool isShowDecPage;
@ -83,13 +73,12 @@ class AppScaffold extends StatefulWidget {
List<String> dropDownList; List<String> dropDownList;
final Function(int) dropDownIndexChange; final Function(int) dropDownIndexChange;
Function onTap; Function onTap;
final bool isMainPharmacyPages;
final bool extendBody;
final ValueChanged<int> changeCurrentTab; final ValueChanged<int> changeCurrentTab;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
final Widget customAppBar;
final int currentTab; final int currentTab;
final bool isShowPharmacyAppbar; final bool isShowPharmacyAppbar;
final Widget customAppBar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) { AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick; _onCartClick = onClick;
@ -103,17 +92,17 @@ class AppScaffold extends StatefulWidget {
this.isShowAppBar = false, this.isShowAppBar = false,
this.showNewAppBar = false, this.showNewAppBar = false,
this.showNewAppBarTitle = false, this.showNewAppBarTitle = false,
this.isMainPharmacyPages = false,
this.extendBody = false,
this.hasAppBarParam, this.hasAppBarParam,
this.bottomSheet, this.bottomSheet,
this.bottomNavigationBar, this.bottomNavigationBar,
this.baseViewModel, this.baseViewModel,
this.floatingActionButton, this.floatingActionButton,
this.isPharmacy = false, this.isPharmacy = false,
this.isMainPharmacyPages = false,
this.showPharmacyCart = true, this.showPharmacyCart = true,
this.isOfferPackages = false, this.isOfferPackages = false,
this.showOfferPackagesCart = false, this.showOfferPackagesCart = false,
this.extendBody = false,
this.title, this.title,
this.description, this.description,
this.isShowDecPage = true, this.isShowDecPage = true,
@ -145,9 +134,11 @@ class AppScaffold extends StatefulWidget {
class _AppScaffoldState extends State<AppScaffold> { class _AppScaffoldState extends State<AppScaffold> {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppBarWidget appBar;
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
} }
@ -218,66 +209,87 @@ class _AppScaffoldState extends State<AppScaffold> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
AppGlobal.context = context; AppGlobal.context = context;
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage); bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && widget.isShowDecPage);
return Scaffold( return Scaffold(
backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color, backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
// appBar: widget.isShowPharmacyAppbar
// ? pharmacyAppbar()
// : widget.isShowAppBar
// ? widget.customAppBar != null
// ? widget.customAppBar
appBar: isUserNotLogin appBar: isUserNotLogin
? null ? null
: (widget.isShowPharmacyAppbar : widget.isShowPharmacyAppbar
? pharmacyAppbar() ? pharmacyAppbar()
: showNewAppBar : (widget.showNewAppBar
? NewAppBarWidget( ? NewAppBarWidget(
title: appBarTitle, title: widget.appBarTitle,
showTitle: showNewAppBarTitle, showTitle: widget.showNewAppBarTitle,
showDropDown: showDropDown, showDropDown: widget.showDropDown,
dropdownIndexValue: dropdownIndexValue, dropdownIndexValue: widget.dropdownIndexValue,
dropDownList: dropDownList ?? [], dropDownList: widget.dropDownList ?? [],
dropDownIndexChange: dropDownIndexChange, dropDownIndexChange: widget.dropDownIndexChange,
appBarIcons: appBarIcons, appBarIcons: widget.appBarIcons,
onTap: onTap, onTap: widget.onTap,
) )
: (isShowAppBar : (widget.isShowAppBar
? customAppBar != null ? widget.customAppBar != null
? customAppBar ? widget.customAppBar
: appBar = AppBarWidget( : appBar = AppBarWidget(
appBarTitle: appBarTitle, appBarTitle: widget.appBarTitle,
appBarIcons: appBarIcons, appBarIcons: widget.appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon, showHomeAppBarIcon: widget.showHomeAppBarIcon,
isPharmacy: isPharmacy, isPharmacy: widget.isPharmacy,
showPharmacyCart: showPharmacyCart, showPharmacyCart: widget.showPharmacyCart,
isOfferPackages: isOfferPackages, isOfferPackages: widget.isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart, showOfferPackagesCart: widget.showOfferPackagesCart,
isShowDecPage: isShowDecPage, isShowDecPage: widget.isShowDecPage,
backButtonTab: backButtonTab, backButtonTab: widget.backButtonTab,
) )
: null)), : null)),
bottomSheet: bottomSheet, bottomSheet: widget.bottomSheet,
body: SafeArea( body: SafeArea(
top: true, top: true,
bottom: true, bottom: true,
child: isUserNotLogin child: isUserNotLogin
? NotAutPage( ? NotAutPage(
title: title ?? appBarTitle, title: widget.title ?? widget.appBarTitle,
description: description, description: widget.description,
infoList: infoList, infoList: widget.infoList,
imagesInfo: imagesInfo, imagesInfo: widget.imagesInfo,
icon: icon, icon: widget.icon,
) )
: baseViewModel != null : widget.baseViewModel != null
? NetworkBaseView( ? NetworkBaseView(
child: buildBodyWidget(context), child: buildBodyWidget(context),
baseViewModel: baseViewModel, baseViewModel: widget.baseViewModel,
) )
: buildBodyWidget(context), : buildBodyWidget(context),
), ),
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: widget.isBottomBar
floatingActionButton: floatingActionButton, ? BottomNavPharmacyBar(
changeIndex: changeCurrentTab,
index: widget.currentTab,
)
: null,
floatingActionButton: widget.floatingActionButton,
); );
} }
void changeCurrentTab(int value) {
if (widget.isMainPharmacyPages) {
widget.changeCurrentTab(value);
} else {
Navigator.pushAndRemoveUntil(
locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route<dynamic> r) => false);
}
}
void _scanQrAndGetProduct() async { void _scanQrAndGetProduct() async {
try { try {
String result = await BarcodeScanner.scan(); String result = await BarcodeScanner.scan();
@ -304,7 +316,7 @@ class _AppScaffoldState extends State<AppScaffold> {
} }
buildBodyWidget(context) { buildBodyWidget(context) {
return Stack(children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]); return Stack(children: <Widget>[widget.body, widget.isHelp == true ? RobotIcon() : Container()]);
} }
} }

@ -7,14 +7,10 @@ import 'bottom_nav_pharmacy_item.dart';
class BottomNavPharmacyBar extends StatefulWidget { class BottomNavPharmacyBar extends StatefulWidget {
final ValueChanged<int> changeIndex; final ValueChanged<int> changeIndex;
final int index;
BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key); BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key);
int index = 0; int index = 0;
BottomNavPharmacyBar({Key key, this.changeIndex, this.index})
: super(key: key);
@override @override
_BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState(); _BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState();
} }

Loading…
Cancel
Save