updates & fixes

merge-update-with-lab-changes
haroon amjad 5 years ago
parent 123b1de1a4
commit b9a12341d5

@ -1954,4 +1954,8 @@ const Map localizedValues = {
}, },
"order-overview": {"en": "Order Overview", "ar": "ملخص الطلب"}, "order-overview": {"en": "Order Overview", "ar": "ملخص الطلب"},
"shipping-address": {"en": "Delivery Address", "ar": "عنوان التوصيل"}, "shipping-address": {"en": "Delivery Address", "ar": "عنوان التوصيل"},
"pharmacy-relogin": {
"en": "Your session has timed out, Please try again",
"ar": "انتهت مهلة جلسة الخاص بها. يرجى المحاولة مرة أخرى"
},
}; };

@ -7,6 +7,8 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -293,7 +295,13 @@ class BaseAppClient {
print("statusCode :$statusCode"); print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode < 200 || statusCode >= 400 || json == null) {
if (statusCode == 401) {
AppToast.showErrorToast(
message: TranslationBase.of(AppGlobal.context).pharmacyRelogin);
Navigator.of(AppGlobal.context).pushNamed(HOME);
} else {
onFailure('Error While Fetching data', statusCode); onFailure('Error While Fetching data', statusCode);
}
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
@ -386,7 +394,6 @@ class BaseAppClient {
return params; return params;
} }
pharmacyPost(String endPoint, pharmacyPost(String endPoint,
{Map<String, dynamic> body, {Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess, Function(dynamic response, int statusCode) onSuccess,
@ -469,9 +476,8 @@ class BaseAppClient {
var ss = json.encode(body); var ss = json.encode(body);
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), final response =
body: json.encode(body), await http.post(url.trim(), body: json.encode(body), headers: {
headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Accept': 'application/json', 'Accept': 'application/json',
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
@ -515,12 +521,11 @@ class BaseAppClient {
parsed['IsAuthenticated']) { parsed['IsAuthenticated']) {
if (parsed['message'] == null && if (parsed['message'] == null &&
parsed['ErrorEndUserMessage'] == null) { parsed['ErrorEndUserMessage'] == null) {
if(parsed['ErrorSearchMsg'] == null ){ if (parsed['ErrorSearchMsg'] == null) {
onFailure("Server Error found with no available message", onFailure("Server Error found with no available message",
statusCode); statusCode);
}else { } else {
onFailure(parsed['ErrorSearchMsg'], onFailure(parsed['ErrorSearchMsg'], statusCode);
statusCode);
} }
} else { } else {
onFailure( onFailure(

@ -1,6 +1,8 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
@ -11,6 +13,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
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';
@ -33,6 +36,9 @@ class HomePage extends StatefulWidget {
} }
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
PharmacyModuleViewModel pharmacyModuleViewModel =
locator<PharmacyModuleViewModel>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -503,8 +509,7 @@ class _HomePageState extends State<HomePage> {
), ),
if (projectViewModel.havePrivilege(65)) if (projectViewModel.havePrivilege(65))
DashboardItem( DashboardItem(
onTap: () => Navigator.push( onTap: () => getPharmacyToken(model),
context, FadePage(page: LandingPagePharmacy())),
child: Center( child: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
@ -799,10 +804,24 @@ class _HomePageState extends State<HomePage> {
); );
} }
// openBrowser() { getPharmacyToken(DashboardViewModel model) async {
// InAppBrowser browser = new InAppBrowser(); if(!model.isLogin) {
// browser.openUrl(url: "https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=ca9dd276-0a20-4924-a768-fafa9a855ef1&&CustomerId=1367368"); Navigator.push(context, FadePage(page: LandingPagePharmacy()));
// } } else {
GifLoaderDialogUtils.showMyDialog(context);
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
if (pharmacyModuleViewModel.error.isNotEmpty) {
await pharmacyModuleViewModel.createUser().then((value) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
});
} else {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
}
});
}
}
navigateToCovidDriveThru() { navigateToCovidDriveThru() {
Navigator.push(context, FadePage(page: CovidDrivethruLocation())); Navigator.push(context, FadePage(page: CovidDrivethruLocation()));

@ -28,6 +28,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<BrandsViewModel>( return BaseView<BrandsViewModel>(
allowAny: true,
onModelReady: (model) => model.getBrandsData(), onModelReady: (model) => model.getBrandsData(),
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: 'Brands page', appBarTitle: 'Brands page',
@ -142,6 +143,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
topBrand(BuildContext context) { topBrand(BuildContext context) {
return BaseView<BrandsViewModel>( return BaseView<BrandsViewModel>(
allowAny: true,
onModelReady: (model) => model.getTopBrandsData(), onModelReady: (model) => model.getTopBrandsData(),
builder: (_, model, wi) => GridView.count( builder: (_, model, wi) => GridView.count(
crossAxisCount: 4, crossAxisCount: 4,

@ -1,23 +1,22 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.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/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/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; 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/others/app_scafold_detail_page.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'screens/cart-order-page.dart'; import 'screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
int price = 0; int price = 0;
var languageID; var languageID;
@ -30,7 +29,9 @@ PharmacyProduct specificationData;
class ProductDetailPage extends StatefulWidget { class ProductDetailPage extends StatefulWidget {
final PharmacyProduct product; final PharmacyProduct product;
ProductDetailPage(this.product); ProductDetailPage(this.product);
@override @override
__ProductDetailPageState createState() => __ProductDetailPageState(); __ProductDetailPageState createState() => __ProductDetailPageState();
} }
@ -42,8 +43,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
bool isAvailabilty = false; bool isAvailabilty = false;
dynamic wishlistItems; dynamic wishlistItems;
var model; var model;
// String ProductId="4561"; // String ProductId="4561";
String productId = ""; String productId = "";
checkWishlist() async { checkWishlist() async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
@ -62,6 +65,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
setState(() {}); setState(() {});
} }
void initState() { void initState() {
price = 1; price = 1;
specificationData = widget.product; specificationData = widget.product;
@ -620,7 +624,6 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
bold: true, bold: true,
), ),
), ),
], ],
), ),
SingleChildScrollView( SingleChildScrollView(
@ -639,43 +642,68 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
child: BaseView<PharmacyModuleViewModel>( child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => onModelReady: (model) =>
model.getRecommendedProducts(widget.product.id.toString()), model.getRecommendedProducts(
builder: (_, model, wi) => widget.product.id.toString()),
Container( builder: (_, model, wi) => Container(
child: child:
// Text(model.recommendedProductList[0].id), // Text(model.recommendedProductList[0].id),
model.recommendedProductList.length != null model.recommendedProductList.length !=
null
? Expanded( ? Expanded(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection:
Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(), // physics: NeverScrollableScrollPhysics(),
itemCount: model.recommendedProductList.length, itemCount: model
itemBuilder: (context, index) { .recommendedProductList
.length,
itemBuilder:
(context, index) {
return Card( return Card(
elevation: 2, elevation: 2,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: BorderSide( side: BorderSide(
color: Colors.grey[300], width: 2), color: Colors
borderRadius: BorderRadius.circular(10)), .grey[
margin: EdgeInsets.symmetric( 300],
width: 2),
borderRadius:
BorderRadius
.circular(
10)),
margin: EdgeInsets
.symmetric(
horizontal: 8, horizontal: 8,
vertical: 0, vertical: 0,
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration:
borderRadius: BorderRadius.all( BoxDecoration(
Radius.circular(15), borderRadius:
), BorderRadius
), .all(
padding: EdgeInsets.symmetric(horizontal: 4), Radius.circular(
width: MediaQuery.of(context).size.width / 3, 15),
),
),
padding: EdgeInsets
.symmetric(
horizontal:
4),
width: MediaQuery.of(
context)
.size
.width /
3,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [
Stack(
children: [ children: [
Stack(children: [
Container( Container(
child: Align( child: Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
@ -683,8 +711,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
itemID.contains(model.recommendedProductList[index].id) itemID.contains(model.recommendedProductList[index].id)
// !isInWishlist // !isInWishlist
? IconButton( ? IconButton(
icon: Icon(Icons icon: Icon(Icons.favorite_border),
.favorite_border),
color: Colors.grey, color: Colors.grey,
iconSize: 30, iconSize: 30,
onPressed: () { onPressed: () {
@ -694,8 +721,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
) )
: IconButton( : IconButton(
icon: Icon( icon: Icon(Icons.favorite),
Icons.favorite),
color: Colors.red, color: Colors.red,
iconSize: 30, iconSize: 30,
onPressed: () { onPressed: () {
@ -709,8 +735,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin: EdgeInsets.fromLTRB(
0, 16, 10, 16), 0,
alignment: Alignment.center, 16,
10,
16),
alignment:
Alignment.center,
// padding: EdgeInsets.only(left: 25, bottom: 20), // padding: EdgeInsets.only(left: 25, bottom: 20),
child: (model.recommendedProductList[index].images != null && child: (model.recommendedProductList[index].images != null &&
model.recommendedProductList[index].images.length > 0) model.recommendedProductList[index].images.length > 0)
@ -727,65 +757,76 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
), ),
Container( Container(
width: model width: model.recommendedProductList[index].rxMessage !=
.recommendedProductList[
index]
.rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(context).size.width /
.size
.width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
decoration: BoxDecoration( EdgeInsets.all(4),
color: Color(0xffb23838), decoration:
borderRadius: BorderRadius.only( BoxDecoration(
topLeft: Radius.circular(6)), color:
Color(0xffb23838),
borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: Texts( child:
model.recommendedProductList[index] Texts(
.rxMessage != model.recommendedProductList[index].rxMessage != null
null ? model.recommendedProductList[index].rxMessage
? model
.recommendedProductList[
index]
.rxMessage
: "", : "",
color: Colors.white, color:
regular: true, Colors.white,
fontSize: 10, regular:
fontWeight: FontWeight.w400, true,
fontSize:
10,
fontWeight:
FontWeight.w400,
), ),
), ),
]), ]),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets
horizontal: 6, .symmetric(
horizontal:
6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
Text( Text(
languageID == "ar" languageID ==
"ar"
? model.recommendedProductList[index].namen ? model.recommendedProductList[index].namen
: model.recommendedProductList[index].name, : model.recommendedProductList[index].name,
style: TextStyle( style:
color: Colors.black, TextStyle(
fontSize: 13.0, color:
Colors.black,
fontSize:
13.0,
// fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
), ),
), ),
Padding( Padding(
// padding: const EdgeInsets.only(top: 15, bottom: 10), // padding: const EdgeInsets.only(top: 15, bottom: 10),
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 10, bottom: 5), top:
child: Texts( 10,
bottom:
5),
child:
Texts(
"SAR ${model.recommendedProductList[index].price}", "SAR ${model.recommendedProductList[index].price}",
bold: true, bold:
fontSize: 14, true,
fontSize:
14,
), ),
), ),
], ],
@ -793,37 +834,45 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Row( Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
children: <Widget>[ .start,
children: <
Widget>[
Container( Container(
padding: padding:
EdgeInsets.only(right: 10), EdgeInsets.only(right: 10),
// margin: EdgeInsets.only(left: 5), // margin: EdgeInsets.only(left: 5),
child: Align( child:
alignment: Alignment.topLeft, Align(
child: RatingBar.readOnly( alignment:
initialRating: model Alignment.topLeft,
.recommendedProductList[ child:
index] RatingBar.readOnly(
.approvedRatingSum initialRating:
.toDouble(), model.recommendedProductList[index].approvedRatingSum.toDouble(),
// initialRating: productRate, // initialRating: productRate,
size: 13.0, size:
13.0,
filledColor: filledColor:
Colors.yellow[700], Colors.yellow[700],
emptyColor: Colors.grey[500], emptyColor:
isHalfAllowed: true, Colors.grey[500],
isHalfAllowed:
true,
halfFilledIcon: halfFilledIcon:
Icons.star_half, Icons.star_half,
filledIcon: Icons.star, filledIcon:
emptyIcon: Icons.star, Icons.star,
emptyIcon:
Icons.star,
), ),
), ),
), ),
Texts( Texts(
"(${model.recommendedProductList[index].approvedTotalReviews.toString()})", "(${model.recommendedProductList[index].approvedTotalReviews.toString()})",
// bold: true, // bold: true,
fontSize: 12, fontSize:
12,
), ),
]), ]),
], ],
@ -835,9 +884,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
: Container( : Container(
// child: Text("NO DATA"), // child: Text("NO DATA"),
), ),
) )),
),
), ),
], ],
), ),
@ -1341,8 +1388,10 @@ class footerWidget extends StatefulWidget {
final int minQuantity; final int minQuantity;
final int quantityLimit; final int quantityLimit;
final PharmacyProduct item; final PharmacyProduct item;
footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item); this.quantityLimit, this.item);
@override @override
_footerWidgetState createState() => _footerWidgetState(); _footerWidgetState createState() => _footerWidgetState();
} }
@ -1350,6 +1399,7 @@ class footerWidget extends StatefulWidget {
class _footerWidgetState extends State<footerWidget> { class _footerWidgetState extends State<footerWidget> {
double quantityUI = 70; double quantityUI = 70;
bool showUI = false; bool showUI = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -1752,7 +1802,7 @@ class _footerWidgetState extends State<footerWidget> {
) )
: InkWell( : InkWell(
onTap: () { onTap: () {
addToCartFunction(price, widget.item.id); addToCartFunction(price, widget.item.id, context);
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -1792,11 +1842,10 @@ class _footerWidgetState extends State<footerWidget> {
: InkWell( : InkWell(
onTap: () { onTap: () {
print('buy now'); print('buy now');
addToCartFunction(price, widget.item.id); addToCartFunction(price, widget.item.id, context);
Navigator.push( Navigator.push(
context, context,
FadePage(page: FadePage(page: CartOrderPage()),
CartOrderPage()),
); );
}, },
child: Container( child: Container(
@ -1824,7 +1873,9 @@ class _footerWidgetState extends State<footerWidget> {
class productNameAndPrice extends StatefulWidget { class productNameAndPrice extends StatefulWidget {
BuildContext context; BuildContext context;
PharmacyProduct item; PharmacyProduct item;
productNameAndPrice(this.context, this.item); productNameAndPrice(this.context, this.item);
@override @override
_productNameAndPriceState createState() => _productNameAndPriceState(); _productNameAndPriceState createState() => _productNameAndPriceState();
} }
@ -2014,9 +2065,12 @@ getSpecificationData(itemID) async {
specificationData = await x.productSpecificationData(itemID); specificationData = await x.productSpecificationData(itemID);
} }
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID, BuildContext context) async {
GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID); await x.addToCartData(quantity, itemID).then((value) {
GifLoaderDialogUtils.hideDialog(context);
});
} }
notifyMeWhenAvailable(context, itemId) async { notifyMeWhenAvailable(context, itemId) async {
@ -2071,7 +2125,7 @@ settingModalBottomSheet(context) {
title: Text('Add to cart'), title: Text('Add to cart'),
onTap: () => { onTap: () => {
if (price > 0) if (price > 0)
{addToCartFunction(price, itemID)} {addToCartFunction(price, itemID, context)}
else else
{ {
AppToast.showErrorToast( AppToast.showErrorToast(

@ -4,25 +4,25 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/address-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.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/in_app_browser/InAppBrowser.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:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/scheduler.dart';
class OrderPreviewPage extends StatelessWidget { class OrderPreviewPage extends StatelessWidget {
final List<Addresses> addresses; final List<Addresses> addresses;
OrderPreviewPage(this.addresses); OrderPreviewPage(this.addresses);
MyInAppBrowser browser;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
@ -783,7 +783,9 @@ class PaymentBottomWidget extends StatelessWidget {
? () async { ? () async {
await model.makeOrder(); await model.makeOrder();
if (model.state != ViewState.Idle) { if (model.state != ViewState.Idle) {
AppToast.showSuccessToast(message: "Order has been placed successfully!!"); AppToast.showSuccessToast(
message:
"Order has been placed successfully!!");
} else { } else {
AppToast.showErrorToast(message: model.error); AppToast.showErrorToast(message: model.error);
} }

@ -1570,6 +1570,7 @@ class TranslationBase {
String get shippingAddresss => String get shippingAddresss =>
localizedValues["shipping-address"][locale.languageCode]; localizedValues["shipping-address"][locale.languageCode];
String get covidAlert => localizedValues["covid-alert"][locale.languageCode]; String get covidAlert => localizedValues["covid-alert"][locale.languageCode];
String get pharmacyRelogin => localizedValues["pharmacy-relogin"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save